SyneRBI / SIRF-SuperBuild

SIRF CMake SuperBuild
http://www.ccpsynerbi.ac.uk
Apache License 2.0
15 stars 17 forks source link

Linking error on SuperBuild master with Boost #496

Closed paskino closed 3 years ago

paskino commented 3 years ago

Currently running in a problem linking ISMRMRD (1.4.1) with Boost (1.65.1) on SuperBuild master. Any idea?

[ 62%] Linking CXX executable ismrmrd_generate_cartesian_shepp_logan CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o: In function `boost::program_options::typed_value, std::allocator >, char>::xparse(boost::any&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&) const': generate_cartesian_shepp_logan.cpp:(.text._ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE6xparseERNS_3anyERKSt6vectorIS7_SaIS7_EE[_ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE6xparseERNS_3anyERKSt6vectorIS7_SaIS7_EE]+0x19): undefined reference to `boost::program_options::validate(boost::any&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, std::__cxx11::basic_string, std::allocator >*, int)' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o: In function `boost::program_options::typed_value::xparse(boost::any&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&) const': generate_cartesian_shepp_logan.cpp:(.text._ZNK5boost15program_options11typed_valueIbcE6xparseERNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EE[_ZNK5boost15program_options11typed_valueIbcE6xparseERNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EE]+0x19): undefined reference to `boost::program_options::validate(boost::any&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, bool*, int)' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o: In function `boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, int)': generate_cartesian_shepp_logan.cpp:(.text._ZN5boost15program_options16validation_errorC2ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i[_ZN5boost15program_options16validation_errorC5ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i]+0x1f): undefined reference to `boost::program_options::validation_error::get_template[abi:cxx11](boost::program_options::validation_error::kind_t)' generate_cartesian_shepp_logan.cpp:(.text._ZN5boost15program_options16validation_errorC2ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i[_ZN5boost15program_options16validation_errorC5ENS1_6kind_tERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_i]+0x33): undefined reference to `boost::program_options::error_with_option_name::error_with_option_name(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, int)' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o: In function `boost::program_options::basic_command_line_parser::extra_parser(boost::function1, std::allocator >, std::__cxx11::basic_string, std::allocator > >, std::__cxx11::basic_string, std::allocator > const&>)': generate_cartesian_shepp_logan.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcE12extra_parserENS_9function1ISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_ERKSA_EE[_ZN5boost15program_options25basic_command_line_parserIcE12extra_parserENS_9function1ISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_ERKSA_EE]+0x3e): undefined reference to `boost::program_options::detail::cmdline::set_additional_parser(boost::function1, std::allocator >, std::__cxx11::basic_string, std::allocator > >, std::__cxx11::basic_string, std::allocator > const&>)' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o: In function `boost::program_options::basic_parsed_options boost::program_options::parse_command_line(int, char const* const*, boost::program_options::options_description const&, int, boost::function1, std::allocator >, std::__cxx11::basic_string, std::allocator > >, std::__cxx11::basic_string, std::allocator > const&>)': generate_cartesian_shepp_logan.cpp:(.text._ZN5boost15program_options18parse_command_lineIcEENS0_20basic_parsed_optionsIT_EEiPKPKS3_RKNS0_19options_descriptionEiNS_9function1ISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESJ_ERKSJ_EE[_ZN5boost15program_options18parse_command_lineIcEENS0_20basic_parsed_optionsIT_EEiPKPKS3_RKNS0_19options_descriptionEiNS_9function1ISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESJ_ERKSJ_EE]+0x1d0): undefined reference to `boost::program_options::to_internal(std::__cxx11::basic_string, std::allocator > const&)' generate_cartesian_shepp_logan.cpp:(.text._ZN5boost15program_options18parse_command_lineIcEENS0_20basic_parsed_optionsIT_EEiPKPKS3_RKNS0_19options_descriptionEiNS_9function1ISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESJ_ERKSJ_EE[_ZN5boost15program_options18parse_command_lineIcEENS0_20basic_parsed_optionsIT_EEiPKPKS3_RKNS0_19options_descriptionEiNS_9function1ISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESJ_ERKSJ_EE]+0x2a7): undefined reference to `boost::program_options::detail::cmdline::cmdline(std::vector, std::allocator >, std::allocator, std::allocator > > > const&)' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o: In function `boost::program_options::typed_value::name[abi:cxx11]() const': generate_cartesian_shepp_logan.cpp:(.text._ZNK5boost15program_options11typed_valueIjcE4nameB5cxx11Ev[_ZNK5boost15program_options11typed_valueIjcE4nameB5cxx11Ev]+0x1f): undefined reference to `boost::program_options::arg[abi:cxx11]' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o: In function `boost::program_options::typed_value::name[abi:cxx11]() const': generate_cartesian_shepp_logan.cpp:(.text._ZNK5boost15program_options11typed_valueIfcE4nameB5cxx11Ev[_ZNK5boost15program_options11typed_valueIfcE4nameB5cxx11Ev]+0x1f): undefined reference to `boost::program_options::arg[abi:cxx11]' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o: In function `boost::program_options::typed_value, std::allocator >, char>::name() const': generate_cartesian_shepp_logan.cpp:(.text._ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE4nameEv[_ZNK5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcE4nameEv]+0x1f): undefined reference to `boost::program_options::arg[abi:cxx11]' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o: In function `boost::program_options::typed_value::name[abi:cxx11]() const': generate_cartesian_shepp_logan.cpp:(.text._ZNK5boost15program_options11typed_valueIbcE4nameB5cxx11Ev[_ZNK5boost15program_options11typed_valueIbcE4nameB5cxx11Ev]+0x1f): undefined reference to `boost::program_options::arg[abi:cxx11]' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o: In function `main': generate_cartesian_shepp_logan.cpp:(.text.startup+0xa1): undefined reference to `boost::program_options::options_description::options_description(std::__cxx11::basic_string, std::allocator > const&, unsigned int, unsigned int)' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o: In function `void boost::program_options::validate(boost::any&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, unsigned int*, long) [clone .constprop.352]': generate_cartesian_shepp_logan.cpp:(.text._ZN5boost15program_options8validateIjcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l.constprop.352[_ZNK5boost15program_options11typed_valueIjcE6xparseERNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EE]+0x48c): undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::__cxx11::basic_string, std::allocator > const&)' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o: In function `void boost::program_options::validate(boost::any&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, float*, long) [clone .constprop.353]': generate_cartesian_shepp_logan.cpp:(.text._ZN5boost15program_options8validateIfcEEvRNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIT0_St11char_traitsIS7_ESaIS7_EEESaISB_EEPT_l.constprop.353[_ZNK5boost15program_options11typed_valueIfcE6xparseERNS_3anyERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISB_EE]+0x53f): undefined reference to `boost::program_options::invalid_option_value::invalid_option_value(std::__cxx11::basic_string, std::allocator > const&)' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o:(.rodata._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15program_options20invalid_option_valueEEE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string, std::allocator > const&) const' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o:(.rodata._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE[_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options20invalid_option_valueEEEEE]+0x38): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string, std::allocator > const&) const' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o:(.rodata._ZTVN5boost16exception_detail19error_info_injectorINS_15program_options16validation_errorEEE[_ZTVN5boost16exception_detail19error_info_injectorINS_15program_options16validation_errorEEE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string, std::allocator > const&) const' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o:(.rodata._ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options16validation_errorEEEEE[_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15program_options16validation_errorEEEEE]+0x38): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string, std::allocator > const&) const' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o:(.rodata._ZTVN5boost15program_options16validation_errorE[_ZTVN5boost15program_options16validation_errorE]+0x30): undefined reference to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string, std::allocator > const&) const' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o:(.rodata._ZTVN5boost15program_options20invalid_option_valueE[_ZTVN5boost15program_options20invalid_option_valueE]+0x30): more undefined references to `boost::program_options::error_with_option_name::substitute_placeholders(std::__cxx11::basic_string, std::allocator > const&) const' follow CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o:(.rodata._ZTVN5boost15program_options11typed_valueIjcEE[_ZTVN5boost15program_options11typed_valueIjcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper::parse(boost::any&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, bool) const' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o:(.rodata._ZTVN5boost15program_options11typed_valueIfcEE[_ZTVN5boost15program_options11typed_valueIfcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper::parse(boost::any&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, bool) const' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o:(.rodata._ZTVN5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEE[_ZTVN5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper::parse(boost::any&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, bool) const' CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o:(.rodata._ZTVN5boost15program_options11typed_valueIbcEE[_ZTVN5boost15program_options11typed_valueIbcEE]+0x38): undefined reference to `boost::program_options::value_semantic_codecvt_helper::parse(boost::any&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, bool) const' collect2: error: ld returned 1 exit status
KrisThielemans commented 3 years ago

sigh. Mixed versions of boost? What OS etc? I guess do make VERBOSE=ON to see what it's doing.

paskino commented 3 years ago

That's on the cluster.

cd /work3/cse/synerbi/mcir_build/buildVM/builds/ISMRMRD/build/utilities && 
/home/vol05/scarf595/miniconda1907/envs/mcir/bin/cmake -E cmake_link_script 
CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/link.txt --verbose=1

/apps/gcc/8.1.0/gcc/4.8.5/bin/g++ -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED -Wall -std=c++11 -O3 -DNDEBUG -rdynamic 
CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/generate_cartesian_shepp_logan.cpp.o 
CMakeFiles/ismrmrd_generate_cartesian_shepp_logan.dir/ismrmrd_phantom.cpp.o -o ismrmrd_generate_cartesian_shepp_logan  
-Wl,-rpath,/work3/cse/synerbi/mcir_build/buildVM/builds/ISMRMRD/build:/work3/cse/synerbi/mcir_build/install/lib: 
../libismrmrd.so.1.4.0 /work3/cse/synerbi/mcir_build/install/lib/libboost_program_options.so 
/work3/cse/synerbi/mcir_build/install/lib/libfftw3f.a /work3/cse/synerbi/mcir_build/install/lib/libhdf5.so

BTW the build was done by

export CC=/apps/gcc/8.1.0/gcc/4.8.5/bin/gcc \
export CXX=/apps/gcc/8.1.0/gcc/4.8.5/bin/g++ \

cmake ../SIRF-SuperBuild -DCMAKE_BUILD_TYPE=Release \
-DUSE_SYSTEM_ACE=OFF \
-DUSE_SYSTEM_Boost=OFF \
-DUSE_SYSTEM_HDF5=OFF \
-DBUILD_Gadgetron=OFF \
-DUSE_CUDA=OFF \
-DCMAKE_INSTALL_PREFIX=../install \
-DUSE_SYSTEM_Armadillo=OFF \
-DUSE_SYSTEM_FFTW3=OFF \
-DBUILD_siemens_to_ismrmrd=OFF \
-DUSE_ITK=ON \
-DDEVEL_BUILD=OFF \
-DBUILD_CIL_LITE=ON\
-DCMAKE_CXX_FLAGS="-Ofast -march=znver2"\
-DCMAKE_SHARED_LINKER_FLAGS="-L/libm-install-dir/lib -lamdlibm"
KrisThielemans commented 3 years ago

I seem to think I've seen this /apps/gcc/8.1.0/gcc/4.8.5/bin/g++ before. I'm hoping it's not gcc 4.8.5... (and that you told me so).

One possible reason is that boost was compiled with a different compiler, see e.g. https://stackoverflow.com/questions/12179154/undefined-reference-to-boostprogram-optionsoptions-descriptionm-default-l. This is a known problem https://github.com/SyneRBI/SIRF-SuperBuild/issues/14#issuecomment-445404313

A final possible (but unlikely) reason is that you set CMAKE_CXX_FLAGS, which in some settings causes problems https://github.com/SyneRBI/SIRF-SuperBuild/issues/455, but unlikely to be the problem here.

Are you sure you cannot use the system boost? (although that might have the same problem of course)

paskino commented 3 years ago

Thanks @KrisThielemans! It was indeed the wrong compiler. I set the environment variable CC and CXX which affects the CMake projects but Boost will not be influenced by it, so it'd pick whatever is pointed out by gcc or g++, which in my case was a different compiler.

It's building now. At least it passed that problem!

KrisThielemans commented 3 years ago

Close as duplicate of #14? Or change title to more accurately reflect the problem

paskino commented 3 years ago

closed as duplicate of #14