Skip to content

Rename jsonCompiler to libsolc#3010

Merged
axic merged 1 commit intodevelopfrom
libsolc
Dec 12, 2017
Merged

Rename jsonCompiler to libsolc#3010
axic merged 1 commit intodevelopfrom
libsolc

Conversation

@axic
Copy link
Contributor

@axic axic commented Oct 2, 2017

Part of #2864.

@axic axic force-pushed the libsolc branch 2 times, most recently from 7c1317d to cac25a2 Compare October 2, 2017 21:39
@chriseth
Copy link
Contributor

chriseth commented Oct 4, 2017

I think this might break the emscripten deploy step (also solc-js has to be adapted).

@axic
Copy link
Contributor Author

axic commented Oct 4, 2017

I'd just keep the name as soljson for solc-js/solc-bin in this PR. We could consider renaming that part separately to this to minimize dependencies.

@axic
Copy link
Contributor Author

axic commented Oct 18, 2017

@chfast the executable solc and the library libsolc are conflicting at link time (i.e. solfuzzer cannot decide which one to link to). Can this be fixed in cmake?

@chfast
Copy link
Contributor

chfast commented Oct 18, 2017

If you use the same target names you will have the problem.
There are 2 solutions:

  1. Use common pattern of starting library names with capital letter, libSolc.a.
  2. Use target name "libsolc" and set the output name to "solc" for it.
    set_target_properties(libsolc PROPERTIES OUTPUT_NAME solc)
    

@axic
Copy link
Contributor Author

axic commented Oct 18, 2017

I am actually using libsolc as target name. Can you have a look at the changes?

@@ -0,0 +1,11 @@
set(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering about this. The same applies to solc/CMakeLists.txt too I guess.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The set() just sets the variable value. It is sources = "". If sources are not used anywhere remove it.

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s EXPORTED_FUNCTIONS='[\"_compileJSON\",\"_license\",\"_version\",\"_compileJSONMulti\",\"_compileJSONCallback\",\"_compileStandard\"]' -s RESERVED_FUNCTION_POINTERS=20")
add_executable(libsolc libsolc.cpp)
else()
add_library(libsolc libsolc.cpp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without changing the OUTPUT_NAME you will get a file of name liblibsolc.a.

if [[ "$SOLC_EMSCRIPTEN" = "On" ]]
then
cp "$REPO_ROOT/build/solc/soljson.js" .
cp "$REPO_ROOT/build/libsolc/libsolc.js" .
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

. needs to be replaced with soljson.js

@@ -0,0 +1,11 @@
set(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to include this script in main CMakeLists.txt script. CMake does not know what libsolc is and it assumed its some system library.

@axic
Copy link
Contributor Author

axic commented Oct 18, 2017

The properties thing doesn't work here:

  Cannot find source file:

    PROPERTIES

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx

@chfast
Copy link
Contributor

chfast commented Oct 18, 2017

This is a separated command:

add_library(libsolc ...)
set_target_properties(libsolc PROPERTIES OUTPUT_NAME solc)

@axic
Copy link
Contributor Author

axic commented Oct 18, 2017

My bad. It seems to work perfectly now, thanks!

@axic axic force-pushed the libsolc branch 2 times, most recently from 93e36a4 to 19b8e4f Compare October 18, 2017 12:33
add_executable(soljson libsolc.cpp)
target_link_libraries(soljson PRIVATE solidity)
else()
add_library(libsolc SHARED libsolc.cpp)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SHARED part could be skipped for this PR.

Copy link
Contributor

@chfast chfast Oct 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need it to be a shared library?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimate goal of #2864.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So let's keep it here now.

@axic
Copy link
Contributor Author

axic commented Nov 17, 2017

@chriseth happy to merge?

@chriseth
Copy link
Contributor

needs rebase

@axic axic merged commit 1ddd4e2 into develop Dec 12, 2017
@axic axic deleted the libsolc branch December 12, 2017 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants