This is a project that means to generate "fat jar" files containing self-contained compiler binaries for solc under Mac, Windows, and Linux, in the format pioneered by, and compatible with those generated by ether-camp/solcJ.
Self-contained is relative. In particular, Windows builds currently require a Visual Studio runtime dll
that cannot be bundled with solc
since it is not open source. As of solc
version 0.4.18, the
Visual Studio 2015 runtime works.
All scripting is done in sbt, so builds should be portable and reproducible. To build a jar for a new version of solc, the following steps are required:
- Reset the version in
build.sbt
to a version number beginning with the base version ofsolc
you wish to bundle. Any non-numeric suffix is acceptible. For example, if you wish to bundlesolc
version0.4.18+commit.9cf6e910.Darwin.appleclang
, acceptible versions inbuild.sbt
would be0.4.18
,0.4.18rev1
,0.4.18-SNAPSHOT
, etc. at your discretion. Only the dot-separated base semantic version,0.4.18
in this case, is used by the project - In
src/main/versions
create a directory named precisely the dot-separated base semantic version, e.g. "0.4.18". Within this directory, create the following three subdirectory paths:native/mac/solc
native/win/solc
native/linux/solc
- Within each of the three
solc
directories defined above, place appropriate binaries. The binaries ideally will be self-contained statically linked compilatins of the solidity compiler, but if shared libraries or other resources are required, these may be bundled alongside the binaries in the same directory or subdirectories, if the binary will link them by relative path. The compiler binaries themselves must be calledsolc
orsolc.exe
. - Once the binaries are available, to build the jar file, it's just
You will find the jar file in the target directory.
$ sbt package
The project may contain binaries for multiple versions of solc
.
Which version is bundled into the jar files produced depends on the
version setting in build.sbt
.
This project includes binaries from solc and is indebted to the original solcJ project.
It is licensed under GPLv3, after the solidity compiler itself.
Note: When building solc from a release build, touch prerelease.txt
at
the top-level of the solidity distribution so that the build is not flagged as
a development build (and does not emit annoying warnings about being a
prerelease version. See
https://ethereum.stackexchange.com/questions/25584/how-to-compile-solidity-release-version/25593#25593