Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build <0.8.5 from source in M1 #12784

Closed
gakonst opened this issue Mar 13, 2022 · 10 comments
Closed

Cannot build <0.8.5 from source in M1 #12784

gakonst opened this issue Mar 13, 2022 · 10 comments
Labels
build system 🏗️ closed due inactivity The issue/PR was automatically closed due to inactivity. stale The issue/PR was marked as stale because it has been open for too long.

Comments

@gakonst
Copy link

gakonst commented Mar 13, 2022

Context

Given there are no official Apple Silicon (#12291) builds, we have started building them and packaging on our own here https://github.com/roynalnaruto/svm-rs/ / https://github.com/roynalnaruto/solc-builds/tree/master/macosx/aarch64. Up to version 0.8.5 everything's good, but problems seem to arise for earlier versions, presumably some dependency versioning mismatch.

v0.8.1 and 0.8.2

[ 16%] Built target evmasm
Consolidate compiler generated dependencies of target yul
[ 16%] Building CXX object libyul/CMakeFiles/yul.dir/AsmAnalysis.cpp.o
[ 17%] Building CXX object libyul/CMakeFiles/yul.dir/AsmJsonConverter.cpp.o
[ 17%] Building CXX object libyul/CMakeFiles/yul.dir/AsmParser.cpp.o
[ 18%] Building CXX object libyul/CMakeFiles/yul.dir/AssemblyStack.cpp.o
[ 18%] Building CXX object libyul/CMakeFiles/yul.dir/CompilabilityChecker.cpp.o
[ 19%] Building CXX object libyul/CMakeFiles/yul.dir/ObjectParser.cpp.o
[ 19%] Building CXX object libyul/CMakeFiles/yul.dir/ScopeFiller.cpp.o
[ 19%] Building CXX object libyul/CMakeFiles/yul.dir/backends/evm/AsmCodeGen.cpp.o
[ 20%] Building CXX object libyul/CMakeFiles/yul.dir/backends/evm/ConstantOptimiser.cpp.o
[ 20%] Building CXX object libyul/CMakeFiles/yul.dir/backends/evm/EVMAssembly.cpp.o
[ 20%] Building CXX object libyul/CMakeFiles/yul.dir/backends/evm/EVMCodeTransform.cpp.o
[ 20%] Building CXX object libyul/CMakeFiles/yul.dir/backends/evm/EVMDialect.cpp.o
[ 21%] Building CXX object libyul/CMakeFiles/yul.dir/backends/evm/EVMObjectCompiler.cpp.o
[ 21%] Building CXX object libyul/CMakeFiles/yul.dir/backends/evm/EVMMetrics.cpp.o
[ 21%] Building CXX object libyul/CMakeFiles/yul.dir/backends/evm/NoOutputAssembly.cpp.o
[ 21%] Building CXX object libyul/CMakeFiles/yul.dir/backends/wasm/EVMToEwasmTranslator.cpp.o
[ 21%] Building CXX object libyul/CMakeFiles/yul.dir/optimiser/CircularReferencesPruner.cpp.o
[ 22%] Building CXX object libyul/CMakeFiles/yul.dir/optimiser/CommonSubexpressionEliminator.cpp.o
In file included from /Users/georgios/oss/solidity/libyul/optimiser/CircularReferencesPruner.cpp:24:
/Users/georgios/oss/solidity/libsolutil/Algorithms.h:123:7: error: no template named 'list' in namespace 'std'
        std::list<V> verticesToTraverse;
        ~~~~~^
1 error generated.
make[2]: *** [libyul/CMakeFiles/yul.dir/optimiser/CircularReferencesPruner.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [libyul/CMakeFiles/yul.dir/all] Error 2
make: *** [all] Error 2

Compiling <0.8.1 and >0.8.2 passes the above stage, but then produces a different error as shown below. Here's the diff between 0.8.2 and 0.8.3.

<v0.8.1, v0.8.3, v0.8.4

Interestingly enough, for the versions <0.8.1 and 0.8.3 and 0.8.4, it fails at a later stage, plausibly a boost version mismatch


[ 64%] Building CXX object test/tools/ossfuzz/CMakeFiles/solc_ossfuzz.dir/solc_ossfuzz.cpp.o
[ 64%] Building CXX object test/tools/ossfuzz/CMakeFiles/solc_ossfuzz.dir/__/fuzzer_common.cpp.o
[ 64%] Linking CXX executable yulopti
ld: warning: object file (/opt/homebrew/lib/libboost_program_options-mt.a(convert.o)) was built for newer macOS version (12.0) than being linked (11.0)
ld: warning: object file (/opt/homebrew/lib/libboost_program_options-mt.a(variables_map.o)) was built for newer macOS version (12.0) than being linked (11.0)
ld: warning: object file (/opt/homebrew/lib/libboost_program_options-mt.a(options_description.o)) was built for newer macOS version (12.0) than being linked (11.0)
ld: warning: object file (/opt/homebrew/lib/libboost_program_options-mt.a(positional_options.o)) was built for newer macOS version (12.0) than being linked (11.0)
ld: warning: object file (/opt/homebrew/lib/libboost_program_options-mt.a(value_semantic.o)) was built for newer macOS version (12.0) than being linked (11.0)
ld: warning: object file (/opt/homebrew/lib/libboost_program_options-mt.a(cmdline.o)) was built for newer macOS version (12.0) than being linked (11.0)
ld: warning: object file (/opt/homebrew/lib/libboost_filesystem-mt.a(path.o)) was built for newer macOS version (12.0) than being linked (11.0)
ld: warning: object file (/opt/homebrew/lib/libboost_program_options-mt.a(utf8_codecvt_facet.o)) was built for newer macOS version (12.0) than being linked (11.0)
ld: warning: object file (/opt/homebrew/lib/libboost_filesystem-mt.a(utf8_codecvt_facet.o)) was built for newer macOS version (12.0) than being linked (11.0)
ld: warning: object file (../../deps/lib/libjsoncpp.a(json_value.cpp.o)) was built for newer macOS version (12.0) than being linked (11.0)
ld: warning: object file (../../deps/lib/libjsoncpp.a(json_writer.cpp.o)) was built for newer macOS version (12.0) than being linked (11.0)

[... bunch of cmake progress ]

In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/c++/v1/__functional_base:18:
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/c++/v1/utility:305:9: error: implicit instantiation of undefined template 'boost::rational<boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<0, 0, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, std::allocator<unsigned long long>>, boost::multiprecision::et_on>>'
    _T1 first;
        ^
/Users/georgios/oss/solidity/test/ExecutionFramework.h:154:25: note: in instantiation of template class 'std::pair<boost::rational<boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<0, 0, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, std::allocator<unsigned long long>>, boost::multiprecision::et_on>>, int>' requested here
                                        util::toHex(encode(argument))
                                                           ^
/opt/homebrew/include/boost/integer/common_factor_rt.hpp:45:10: note: template is declared here
   class rational;
         ^
In file included from /Users/georgios/oss/solidity/test/libsolidity/SemanticTest.cpp:15:
In file included from /Users/georgios/oss/solidity/test/libsolidity/SemanticTest.h:19:
In file included from /Users/georgios/oss/solidity/test/libsolidity/SolidityExecutionFramework.h:28:
/Users/georgios/oss/solidity/test/ExecutionFramework.h:173:28: error: implicit instantiation of undefined template 'boost::rational<boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<0, 0, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, std::allocator<unsigned long long>>, boost::multiprecision::et_on>>'
                return encode(u256((value.numerator() << fractionalBits) / value.denominator()));
                                         ^
/opt/homebrew/include/boost/integer/common_factor_rt.hpp:45:10: note: template is declared here
   class rational;
         ^
In file included from /Users/georgios/oss/solidity/test/libsolidity/SemanticTest.cpp:15:
In file included from /Users/georgios/oss/solidity/test/libsolidity/SemanticTest.h:19:
In file included from /Users/georgios/oss/solidity/test/libsolidity/SolidityExecutionFramework.h:28:
/Users/georgios/oss/solidity/test/ExecutionFramework.h:173:67: error: implicit instantiation of undefined template 'boost::rational<boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<0, 0, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, std::allocator<unsigned long long>>, boost::multiprecision::et_on>>'
                return encode(u256((value.numerator() << fractionalBits) / value.denominator()));
                                                                                ^
/opt/homebrew/include/boost/integer/common_factor_rt.hpp:45:10: note: template is declared here
   class rational;
         ^
3 errors generated.
make[2]: *** [test/tools/CMakeFiles/isoltest.dir/__/libsolidity/SemanticTest.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [test/tools/CMakeFiles/isoltest.dir/all] Error 2
make: *** [all] Error 2

Environment

Darwin gak 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64

Steps to Reproduce

git checkout v0.8.1 && ./scripts/build.sh

@gakonst gakonst changed the title Cannot build 0.8.1 from source in Mac M! Cannot build <v0.8.3 from source Mar 13, 2022
@gakonst gakonst changed the title Cannot build <v0.8.3 from source Cannot build 0.8.1 and 0.8.2 from source Mar 13, 2022
@gakonst gakonst changed the title Cannot build 0.8.1 and 0.8.2 from source Cannot build <0.8.5 from source in M1 Mar 13, 2022
@roynalnaruto
Copy link

On my M1 machine I see a different (but the same compilation error) for both v0.8.4 and v0.8.1:

https://gist.github.com/roynalnaruto/5a44eec0f33cecf7c077c08dab99aec5

[ 46%] Building CXX object libsolidity/CMakeFiles/solidity.dir/codegen/CompilerUtils.cpp.o
/Users/narurkar/Develop/solidity/libsolidity/codegen/CompilerContext.cpp:343:16: error: no matching conversion for functional-style cast from 'util::PanicCode' to 'solidity::u256' (aka 'number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>')
        templ("code", u256(_code).str());
                      ^~~~~~~~~~

@gakonst
Copy link
Author

gakonst commented Mar 13, 2022

My boost version installed with brew install boost is 1.78 btw.

gakonst added a commit to foundry-rs/foundry that referenced this issue Mar 13, 2022
Bumps SVM making Solidity compiler fall back to Rosetta for versions
before 0.8.5

ref:
alloy-rs/svm-rs#29
ethereum/solidity#12784
@chriseth
Copy link
Contributor

These errors should be easy to resolve. If you need some help, please don't hesitate to come to our chat on matrix / gitter.

@gakonst
Copy link
Author

gakonst commented Mar 14, 2022

How should one be approaching this? I do not write much C++, so any guidance would be appreciated :)

@chriseth
Copy link
Contributor

As I said: chat is probably best here. The first error can be fixed by adding #include <list> to the top of CircularReferencesPruner.cpp

@chriseth
Copy link
Contributor

Sorry, to Algorithms.h

@cameel
Copy link
Member

cameel commented Mar 14, 2022

Interestingly enough, for the versions <0.8.1 and 0.8.3 and 0.8.4, it fails at a later stage, plausibly a boost version mismatch

Could be the same thing as #11398. This unfortunately required a change on our side for newer boost (#11399) so you'll probably need older boost for that version

@gakonst
Copy link
Author

gakonst commented Mar 14, 2022

Cherry-picking 8f56c6a on 0.8.1 gets me past the first error.

Cherry-picking #11398 on v0.8.1 on boost 1.76/1.77 doesnt make a change unfortunately.

On Brew, Boost 1.76 is the latest one (brew search boost), as a result you cannot "easily" switch to an older version, meaning you must manually install it.

So summarizing:

  • Solidity <0.8.5 requires boost <1.76
  • Solidity >=0.8.5 requires boost >=1.76

Extra context from @cameel: ethereum/solc-bin#53 (comment), ethereum/solc-bin#74, https://github.com/ethereum/solc-bin/blob/gh-pages/.github/workflows/random-macosx-build.yml on further complications as you try to build older solc versions

charisma98 added a commit to charisma98/foundry that referenced this issue Mar 4, 2023
Bumps SVM making Solidity compiler fall back to Rosetta for versions
before 0.8.5

ref:
alloy-rs/svm-rs#29
ethereum/solidity#12784
@github-actions
Copy link

This issue has been marked as stale due to inactivity for the last 90 days.
It will be automatically closed in 7 days.

@github-actions github-actions bot added the stale The issue/PR was marked as stale because it has been open for too long. label Mar 24, 2023
@github-actions
Copy link

github-actions bot commented Apr 1, 2023

Hi everyone! This issue has been automatically closed due to inactivity.
If you think this issue is still relevant in the latest Solidity version and you have something to contribute, feel free to reopen.
However, unless the issue is a concrete proposal that can be implemented, we recommend starting a language discussion on the forum instead.

@github-actions github-actions bot added the closed due inactivity The issue/PR was automatically closed due to inactivity. label Apr 1, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2023
0129general added a commit to 0129general/FoundryProject that referenced this issue May 8, 2024
Bumps SVM making Solidity compiler fall back to Rosetta for versions
before 0.8.5

ref:
alloy-rs/svm-rs#29
ethereum/solidity#12784
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system 🏗️ closed due inactivity The issue/PR was automatically closed due to inactivity. stale The issue/PR was marked as stale because it has been open for too long.
Projects
None yet
Development

No branches or pull requests

4 participants