Solidity: Cannot install older versions of the solidity compiler on the mac -- Workaround provided

Created on 2 Oct 2018  路  19Comments  路  Source: ethereum/solidity

I am having difficulty installing older versions of the solidity compiler on my Macbook Air (running MacOs High Sierra 10.13.6). The latest version 0.4.25 of solc installs fine.

I tried 0.4.11 and failed:

$ brew install https://raw.githubusercontent.com/ethereum/homebrew-ethereum/2de22833e3182e68d16ee490e8a62f556a0c5a5f/solidity.rb
######################################################################## 100.0%
Warning: solidity 0.4.25 is available and more recent than version 0.4.11.
==> Downloading https://github.com/ethereum/solidity/releases/download/v0.4.11/solidity_0.4.11.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/40892817/eb3c1a5c-3183-11e7-9db9-de75ff7430d7?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz
######################################################################## 100.0%
Error: An exception occured within a child process:
  ChecksumMismatchError: SHA256 mismatch
Expected: 55d3820253e6bc7a335705caba1f334fd6f4ae2ade9678ddef2bbfea92bbe4c6
Actual: 5a96a3ba4d0d6457ad8101d6219152610e46b384bfbd48244e3474573f7a6d47
Archive: /Users/pieter/Library/Caches/Homebrew/downloads/c35c8fbaab4585b497de2b60ca1545693036ca57e9576675418284386cf5554f--solidity_0.4.11.tar.gz
To retry an incomplete download, remove the file above.

I tried 0.4.20 and failed also, but in a different way:

$ brew unlink solidity; brew install https://raw.githubusercontent.com/ethereum/homebrew-ethereum/76432c9aa279b6907e5b1323b9195f2681c30844/solidity.rb
Unlinking /usr/local/Cellar/solidity/0.4.25... 0 symlinks removed
######################################################################## 100.0%
Warning: solidity 0.4.25 is available and more recent than version 0.4.20.
==> Downloading https://github.com/ethereum/solidity/releases/download/v0.4.20/solidity_0.4.20.tar.gz
Already downloaded: /Users/pieter/Library/Caches/Homebrew/downloads/efdf851b494d6dab556986f5a61d77508c6786b10b8348cc75e52a8e4b4a3583--solidity_0.4.20.tar.gz
==> cmake . -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/solidity/0.4.20 -DCMAKE_BUILD_TYPE=Release -DCMA
==> make install
Last 15 lines from /Users/pieter/Library/Logs/Homebrew/solidity/02.make:
make[5]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_reader.cpp.o] Error 127
make[4]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [deps/src/jsoncpp-project-stamp/jsoncpp-project-build] Error 2
make[1]: *** [CMakeFiles/jsoncpp-project.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[  8%] Building CXX object libdevcore/CMakeFiles/devcore.dir/Whiskers.cpp.o
cd /tmp/solidity-20181002-98866-yajqy8/solidity_0.4.20/libdevcore && /usr/local/bin/ccache /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang++   -I/tmp/solidity-20181002-98866-yajqy8/solidity_0.4.20/include -I/tmp/solidity-20181002-98866-yajqy8/solidity_0.4.20 -isystem /usr/local/include  -std=c++11 -fpermissive -O3 -DNDEBUG   -fstack-protector-strong -Wimplicit-fallthrough -Wall -Wextra -Werror -Wno-unknown-pragmas -Wno-unused-function -Wno-dangling-else -o CMakeFiles/devcore.dir/Whiskers.cpp.o -c /tmp/solidity-20181002-98866-yajqy8/solidity_0.4.20/libdevcore/Whiskers.cpp
[  8%] Linking CXX static library libdevcore.a
cd /tmp/solidity-20181002-98866-yajqy8/solidity_0.4.20/libdevcore && /usr/local/Cellar/cmake/3.12.2/bin/cmake -P CMakeFiles/devcore.dir/cmake_clean_target.cmake
cd /tmp/solidity-20181002-98866-yajqy8/solidity_0.4.20/libdevcore && /usr/local/Cellar/cmake/3.12.2/bin/cmake -E cmake_link_script CMakeFiles/devcore.dir/link.txt --verbose=1
/usr/bin/ar qc libdevcore.a  CMakeFiles/devcore.dir/CommonData.cpp.o CMakeFiles/devcore.dir/CommonIO.cpp.o CMakeFiles/devcore.dir/Exceptions.cpp.o CMakeFiles/devcore.dir/IndentedWriter.cpp.o CMakeFiles/devcore.dir/SHA3.cpp.o CMakeFiles/devcore.dir/StringUtils.cpp.o CMakeFiles/devcore.dir/SwarmHash.cpp.o CMakeFiles/devcore.dir/UTF8.cpp.o CMakeFiles/devcore.dir/Whiskers.cpp.o
/usr/bin/ranlib libdevcore.a
[  8%] Built target devcore
make: *** [all] Error 2

Do not report this issue to Homebrew/brew or Homebrew/core!
documentation

Most helpful comment

I will look at this next week everyone and attempt to figure out a solution.

All 19 comments

I disabled the checksum verification (yes, I know this is bad) and retried 0.4.11. This time another error that I have seen in another issue already where it was claimed to have been fixed. Apparently not for version 0.4.11...

$ brew install https://raw.githubusercontent.com/ethereum/homebrew-ethereum/2de22833e3182e68d16ee490e8a62f556a0c5a5f/solidity.rb
######################################################################## 100.0%
Warning: solidity 0.4.25 is available and more recent than version 0.4.11.
==> Downloading https://github.com/ethereum/solidity/releases/download/v0.4.11/solidity_0.4.11.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/40892817/eb3c1a5c-3183-11e7-9db9-de75ff7430d7?X-Amz-Algorithm
######################################################################## 100.0%
==> cmake . -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/solidity/0.4.11 -DCMAKE_B
==> make install
Last 15 lines from /Users/pieter/Library/Logs/Homebrew/solidity/02.make:
[ 25%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_reader.cpp.o
[ 50%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_value.cpp.o
[ 75%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_writer.cpp.o
/bin/sh: ccache: command not found
/bin/sh: ccache: command not found
make[5]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_value.cpp.o] Error 127
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_reader.cpp.o] Error 127
/bin/sh: ccache: command not found
make[5]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_writer.cpp.o] Error 127
make[4]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [deps/jsoncpp/src/jsoncpp-project-stamp/jsoncpp-project-build] Error 2
make[1]: *** [CMakeFiles/jsoncpp-project.dir/all] Error 2
make: *** [all] Error 2

Do not report this issue to Homebrew/brew or Homebrew/core!

I disabled the checksum verification (Yes, I know this is bad) and tried to install V0.4.11 again. This time another error appears...

```
$ brew install https://raw.githubusercontent.com/ethereum/homebrew-ethereum/2de22833e3182e68d16ee490e8a62f556a0c5a5f/solidity.rb

################################################################## 100.0%

Warning: solidity 0.4.25 is available and more recent than version 0.4.11.
==> Downloading https://github.com/ethereum/solidity/releases/download/v0.4.11/solidity_0.4.11.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/40892817/eb3c1a5c-3183-11e7-9db9-de75ff7430d7?X-Amz-Algorithm

################################################################## 100.0%

==> cmake . -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/solidity/0.4.11 -DCMAKE_B
==> make install
Last 15 lines from /Users/pieter/Library/Logs/Homebrew/solidity/02.make:
[ 25%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_reader.cpp.o
[ 50%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_value.cpp.o
[ 75%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_writer.cpp.o
/bin/sh: ccache: command not found
/bin/sh: ccache: command not found
make[5]: * [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_value.cpp.o] Error 127
make[5]:
Waiting for unfinished jobs....
make[5]:
[src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_reader.cpp.o] Error 127
/bin/sh: ccache: command not found
make[5]:
[src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_writer.cpp.o] Error 127
make[4]:
[src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/all] Error 2
make[3]:
[all] Error 2
make[2]:
[deps/jsoncpp/src/jsoncpp-project-stamp/jsoncpp-project-build] Error 2
make[1]:
[CMakeFiles/jsoncpp-project.dir/all] Error 2
make: *
* [all] Error 2

Do not report this issue to Homebrew/brew or Homebrew/core!
```

Same error for v0.4.21...

$ brew install https://raw.githubusercontent.com/ethereum/homebrew-ethereum/70314d6cd077d2e6dd466a8932ed93064464737f/solidity.rb
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.

######################################################################## 100.0%
Warning: solidity 0.4.25 is available and more recent than version 0.4.21.
==> Downloading https://github.com/ethereum/solidity/releases/download/v0.4.21/solidity_0.4.21.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/40892817/521e8f00-22a8-11e8-867a-3899196166ee?X-Amz-Algorithm
######################################################################## 100.0%
==> cmake . -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/solidity/0.4.21 -DCMAKE_B
==> make install
Last 15 lines from /Users/pieter/Library/Logs/Homebrew/solidity/02.make:
[ 50%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_reader.cpp.o
[ 50%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_value.cpp.o
[ 75%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_writer.cpp.o
/bin/sh: ccache: command not found
/bin/sh: ccache: command not found
make[5]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_writer.cpp.o] Error 127
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_reader.cpp.o] Error 127
/bin/sh: ccache: command not found
make[5]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_value.cpp.o] Error 127
make[4]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [deps/src/jsoncpp-project-stamp/jsoncpp-project-build] Error 2
make[1]: *** [CMakeFiles/jsoncpp-project.dir/all] Error 2
make: *** [all] Error 2

Do not report this issue to Homebrew/brew or Homebrew/core!

We do not really support older versions, but it seems like you need to either install ccache or properly re-run the configuration (which seems to have detected that ccache is installed although it is not).

Unfortunately, we cannot really help you there. We try to keep solidity compilable on macos but do not really have the resources to properly support homebrew.

I found a workaround to the problem of installing older versions of the Solidity compiler. Here it is in three rather messy steps. But beware: the installs may go through, but most of the compiler versions throw a variety of errors. I have found an interesting blog https://blog.curvegrid.com/daysofblock/2017/05/12/daysofblock-02-solc-versions.html that suggest that building from source in the end is easier :-(

(1) To deal with the "ChecksumMismatchError: SHA256 mismatch" error, disable the checksum verification as described above.

(2) To deal with the "/bin/sh: ccache: command not found" error, one has to include "/usr/local/bin" in the PATH. The instructions https://docs.brew.sh/FAQ suggest the following:

$ sudo launchctl config system path /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Then reboot, and check:

$ launchctl getenv PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Indeed /usr/local/bin appears in the PATH, but the "/bin/sh: ccache: command not found" persists. I am wondering whether the FAQ is wrong?
In the end I added a link to ccache in a directory that did get included in the PATH:

$ cd /usr/local/opt/cmake/bin
$ ln ../../../bin/ccache

(3) Then another error appeared:

Undefined symbols for architecture x86_64:
  "Json::Value::append(Json::Value&&)", referenced from:
      dev::eth::Assembly::streamAsmJson(std::__1::basic_ostream<char,

To fix this, a tip from https://github.com/ethereum/homebrew-ethereum/issues/164 helped:
$ brew uninstall --ignore-dependencies jsoncpp

Finally all v0.4.x installs went trough, as shown below. It took several hours to do all the installs.

$ brew info solidity
ethereum/ethereum/solidity: stable 0.4.25 [pinned at 0.4.25]
The Solidity Contract-Oriented Programming Language
http://solidity.readthedocs.org
/usr/local/Cellar/solidity/0.4.1 (11 files, 4.5MB)
  Built from source on 2018-10-06 at 08:59:25
/usr/local/Cellar/solidity/0.4.2 (11 files, 4.5MB)
  Built from source on 2018-10-06 at 10:09:50
/usr/local/Cellar/solidity/0.4.4 (11 files, 4.5MB)
  Built from source on 2018-10-06 at 10:04:40
/usr/local/Cellar/solidity/0.4.8 (11 files, 5MB)
  Built from source on 2018-10-06 at 17:02:22
/usr/local/Cellar/solidity/0.4.9 (11 files, 5.1MB)
  Built from source on 2018-10-06 at 16:53:34
/usr/local/Cellar/solidity/0.4.10 (11 files, 5.3MB)
  Built from source on 2018-10-06 at 16:45:29
/usr/local/Cellar/solidity/0.4.11 (11 files, 5.4MB)
  Built from source on 2018-10-06 at 16:38:28
/usr/local/Cellar/solidity/0.4.13 (11 files, 5.9MB)
  Built from source on 2018-10-06 at 16:31:23
/usr/local/Cellar/solidity/0.4.15 (11 files, 5.8MB)
  Built from source on 2018-10-06 at 16:22:21
/usr/local/Cellar/solidity/0.4.16 (6 files, 4.8MB)
  Built from source on 2018-10-06 at 16:14:37
/usr/local/Cellar/solidity/0.4.17 (6 files, 4.9MB)
  Built from source on 2018-10-06 at 16:06:15
/usr/local/Cellar/solidity/0.4.18 (6 files, 5MB)
  Built from source on 2018-10-06 at 15:31:27
/usr/local/Cellar/solidity/0.4.20 (6 files, 5.3MB)
  Built from source on 2018-10-06 at 15:58:01
/usr/local/Cellar/solidity/0.4.21 (6 files, 5.4MB)
  Built from source on 2018-10-05 at 16:04:12
/usr/local/Cellar/solidity/0.4.22 (6 files, 5.5MB)
  Built from source on 2018-10-06 at 15:48:38
/usr/local/Cellar/solidity/0.4.23 (6 files, 5.5MB)
  Built from source on 2018-10-06 at 15:42:19
/usr/local/Cellar/solidity/0.4.24 (6 files, 5.7MB)
  Built from source on 2018-10-06 at 09:08:12
/usr/local/Cellar/solidity/0.4.25 (6 files, 5.7MB)
  Built from source on 2018-10-02 at 21:06:29
From: https://github.com/ethereum/homebrew-ethereum/blob/master/solidity.rb
==> Dependencies
Build: cmake, ccache
Required: boost --c++11, z3

Hi @pieterhartel , thanks for the workaround, hopefully it will help folks with the same problem.
It seems like it worked for you in the end, so can we close the issue?

We do not really support older versions, but it seems like you need to either install ccache or properly re-run the configuration (which seems to have detected that ccache is installed although it is not).

There was a bug in cmake with homebrew and it always detected it, but didn't pick it up properly.

I suggest to install it outside of homebrew.

To fix this, a tip from https://github.com/ethereum/homebrew-ethereum/issues/164 helped:
$ brew uninstall --ignore-dependencies jsoncpp

Yes, this was another bug in our cmake.

Is it worth mentioning these in the documentation? I think. @ChrisChinchilla what do you think?

I think so @axic but any idea of how many people have had this issue/need before?

@ChrisChinchilla There was another report coming in today: https://github.com/ethereum/solidity/issues/5449. I have the feeling that we should mention them in the documentation and provide this and hopefully a workaround for the other issue.

@bit-shift I think that makes it worth it then :)

same issue, what's the workaround for the issue? Thanks!

==> make install
Last 15 lines from /Users/hadv/Library/Logs/Homebrew/solidity/02.make:
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:792:5: note: candidate constructor not viable: requires 3 arguments, but 1 was provided
    basic_string(size_type __n, _CharT __c, const _Allocator& __a);
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:796:5: note: candidate constructor not viable: requires at least 2 arguments, but 1 was provided
    basic_string(const basic_string& __str, size_type __pos,
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:793:5: note: candidate constructor not viable: requires at least 3 arguments, but 1 was provided
    basic_string(const basic_string& __str, size_type __pos, size_type __n,
    ^
2 errors generated.
make[2]: *** [libevmasm/CMakeFiles/evmasm.dir/Assembly.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [libevmasm/CMakeFiles/evmasm.dir/all] Error 2
make: *** [all] Error 2

Do not report this issue to Homebrew/brew or Homebrew/core!

+1

I will look at this next week everyone and attempt to figure out a solution.

I will look at this next week everyone and attempt to figure out a solution.

did you find any clue for this? @ChrisChinchilla

@hadv @purbanow @pieterhartel Yes, we have a Homebrew experiment in progress here - https://github.com/ethereum/homebrew-ethereum/pull/212

But it is basically wrapping just building from particular version releases, so in the meantime continuing to do that is the best solution.

It will take me a little time to create a formula for each version and test each one to update dependencies etc (especially as its hard to get macOS in VMs) so bear with me. But you can see the general principles in that PR and contributions to help build that library of formulae are welcome.

+1

this issue was done? @ChrisChinchilla ?

@hadv merged in https://github.com/ethereum/homebrew-ethereum/pull/221.

Tutorial:
https://medium.com/@zulhhandyplast/how-to-install-solidity-0-4-x-on-mac-using-homebrew-8dfadb244f5d

@zulhfreelancer thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

axic picture axic  路  3Comments

chriseth picture chriseth  路  4Comments

chriseth picture chriseth  路  3Comments

chriseth picture chriseth  路  3Comments

kkagill picture kkagill  路  4Comments