ethereum / solidity

Solidity, the Smart Contract Programming Language
https://soliditylang.org
GNU General Public License v3.0
23.3k stars 5.77k forks source link

Linker error when building the compiler on Ubuntu 16.04 / GCC 8.0.1 with `/scripts/build.sh`: `undefined reference to boost::test_tools::tt_detail::print_log_value` #12400

Closed cvcook7 closed 2 years ago

cvcook7 commented 2 years ago

Hi, do you guys know how to solve the following "'boost::test_tools::tt_detail::......." make error? My Ubuntu 16.04 has Boost 1.66 installed.

un3481@un3481:~/solidity$ sudo ./scripts/build.sh 
-- Found Boost headers in 
-- Found Boost::filesystem at /usr/local/lib/libboost_filesystem.a
-- Found Boost::unit_test_framework at /usr/local/lib/libboost_unit_test_framework.a
-- Found Boost::program_options at /usr/local/lib/libboost_program_options.a
-- Found Boost::system at /usr/local/lib/libboost_system.a
-- Module support is disabled.
-- Version: 8.0.1
-- Build type: Release
-- CXX_STANDARD: 17
-- Required features: cxx_variadic_templates
-- Performing Test fmacro-prefix-map=/home/un3481/solidity=/solidity
-- Performing Test fmacro-prefix-map=/home/un3481/solidity=/solidity - Success

------------------------------------------------------------------------
-- Configuring solidity 0.8.11
------------------------------------------------------------------------
--                  CMake Version                            3.16.0
-- CMAKE_BUILD_TYPE Build type                               Release
-- TARGET_PLATFORM  Target platform                          Linux
--------------------------------------------------------------- features
-- COVERAGE         Coverage support                         OFF
------------------------------------------------------------- components
-- TESTS            Build tests                              ON
------------------------------------------------------------------ flags
-- OSSFUZZ                                                   OFF
------------------------------------------------------------------------

-- Could NOT find Z3 (missing: Z3_LIBRARY Z3_INCLUDE_DIR) 
No SMT solver found (or it has been forcefully disabled). Optional SMT checking will not be available.  
Please install Z3 or CVC4 or remove the option disabling them (USE_Z3, USE_CVC4).
-- Configuring done
-- Generating done
-- Build files have been written to: /home/un3481/solidity/build
[  2%] Built target range-v3-project
[  4%] Built target jsoncpp-project
[  4%] Built target fmt
[  5%] Built target evmc_loader
[  5%] Built target solidity_BuildInfo.h
[  8%] Built target solutil
[ 11%] Built target langutil
[ 12%] Built target smtutil
[ 16%] Built target evmasm
[ 38%] Built target yul
[ 38%] Built target strictasm_opt_ossfuzz
[ 38%] Built target strictasm_assembly_ossfuzz
Scanning dependencies of target solidity
[ 38%] Building CXX object libsolidity/CMakeFiles/solidity.dir/interface/Version.cpp.o
[ 39%] Linking CXX static library libsolidity.a
[ 56%] Built target solidity
[ 56%] Built target libsolc
[ 56%] Linking CXX executable solidity-upgrade
Scanning dependencies of target phaser
[ 56%] Building CXX object tools/CMakeFiles/phaser.dir/yulPhaser/Phaser.cpp.o
[ 57%] Built target solidity-upgrade
Scanning dependencies of target solcli
[ 57%] Building CXX object solc/CMakeFiles/solcli.dir/CommandLineInterface.cpp.o
[ 57%] Linking CXX static library libphaser.a
[ 60%] Built target phaser
[ 61%] Built target yulInterpreter
[ 61%] Linking CXX executable solfuzzer
[ 61%] Built target solfuzzer
[ 62%] Linking CXX executable yulrun
[ 62%] Built target yulrun
[ 62%] Linking CXX executable isoltest
[ 70%] Built target isoltest
[ 70%] Linking CXX executable yulopti
[ 70%] Built target yulopti
[ 70%] Built target solc_mutator_ossfuzz
[ 70%] Built target const_opt_ossfuzz
[ 71%] Built target strictasm_diff_ossfuzz
[ 72%] Built target solc_ossfuzz
[ 73%] Linking CXX executable yul-phaser
[ 73%] Built target yul-phaser
[ 74%] Linking CXX static library libsolcli.a
[ 74%] Built target solcli
[ 75%] Linking CXX executable solc
Scanning dependencies of target soltest
[ 76%] Building CXX object test/CMakeFiles/soltest.dir/yulPhaser/Phaser.cpp.o
[ 76%] Built target solc
[ 76%] Linking CXX executable soltest
CMakeFiles/soltest.dir/yulPhaser/Phaser.cpp.o:Phaser.cpp:function solidity::phaser::test::Phaser::PhaserTest::ProgramCacheFactoryTest::build_should_return_nullptr_for_each_input_program_if_cache_disabled::test_method(): error: undefined reference to 'boost::test_tools::tt_detail::print_log_value<decltype(nullptr)>::operator()(std::ostream&, decltype(nullptr))'
collect2: error: ld returned 1 exit status
test/CMakeFiles/soltest.dir/build.make:1710: recipe for target 'test/soltest' failed
make[2]: *** [test/soltest] Error 1
CMakeFiles/Makefile2:921: recipe for target 'test/CMakeFiles/soltest.dir/all' failed
make[1]: *** [test/CMakeFiles/soltest.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
cameel commented 2 years ago

I think your Boost version might be too old. The failure seems to be related to the boost::test_tools::tt_detail namespace, which AFAIK was introduced in Boost 1.59.0. We do require Boost >= 1.65.0 though, so if yours is indeed too old, it's weird that you did not get an error from EthDependencies.cmake instead.

Can you check which version your are using?

Please also try updating your compiler. I think we still do support 8.0.1 but it's already pretty old. If upgrading it solves your problem then maybe we need to think about bumping the requirement.

NunoFilipeSantos commented 2 years ago

Hi @cvcook7! We're closing this issue due to inactivity. If @cameel's suggestion didn't help you, feel free to reopen it. Thank you!