Closed mtw33 closed 3 years ago
Hi @mtw33. Can you run cmake in verbose mode (cmake VERBOSE=1) and include the full output. It would be good to see the compile line. Perhaps it is putting -lm
on the compile line after IteratorsTest.cpp.o
?
I ran make in VERBOSE mode and also added an -lm to the CXX_FLAGS in the CMakeLists.txt file - still the same error. In particular I get
cd /home/mary/C++/Aboria/tests && /usr/bin/cmake -E cmake_link_script CMakeFiles/H2Test.dir/link.txt --verbose=1 /usr/bin/gcc-8 -Wall -Wno-deprecated -std=c++14 -ftemplate-backtrace-limit=0 -lm -rdynamic CMakeFiles/H2Test.dir/H2Test.cpp.o -o H2Test /usr/lib64/libboost_serialization.so.1.74.0 /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/H2Test.dir/H2Test.cpp.o: undefined reference to symbol '_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@@GLIBCXX_3.4' /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/libstdc++.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: [tests/CMakeFiles/H2Test.dir/build.make:103: tests/H2Test] Error 1 make[2]: Leaving directory '/home/mary/C++/Aboria' make[1]: [CMakeFiles/Makefile2:158: tests/CMakeFiles/H2Test.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....
apologies, I misspoke. The -lm
should be after the object file, so "gcc ... CMakeFiles/H2Test.dir/H2Test.cpp.o ... -lm ..."
I am asking the most ridiculous question ever - where do I have to do that in the CMake.txt. Sorry I know how to program C/C++, but I never used cmake myself.
not a ridiculous question at all, it isn't very straightforward. I think it should work if you add the m
library to the end of the list in the Aboria_LIBRARIES
cmake variable, so try adding this to line 129 of CMakeLists.txt (just after the if statement for Aboria_USE_INTEL_MKL):
list(APPEND Aboria_LIBRARIES "m")
That didn't solve the problem .... still the same error message
cd /home/mary/C++/Aboria/tests && /usr/bin/cmake -E cmake_link_script CMakeFiles/H2Test.dir/link.txt --verbose=1 /usr/bin/gcc-8 -Wall -Wno-deprecated -std=c++14 -ftemplate-backtrace-limit=0 -rdynamic CMakeFiles/H2Test.dir/H2Test.cpp.o -o H2Test /usr/lib64/libboost_serialization.so.1.74.0 -lm /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/H2Test.dir/H2Test.cpp.o: undefined reference to symbol '_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@@GLIBCXX_3.4' /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/libstdc++.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: [tests/CMakeFiles/H2Test.dir/build.make:100: tests/H2Test] Error 1 make[2]: Leaving directory '/home/mary/C++/Aboria' make[1]: [CMakeFiles/Makefile2:155: tests/CMakeFiles/H2Test.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....
ok, I just noticed that the compiler being used is gcc, rather than c++, g++ or clang++. Can you check that cmake is finding a C++ compiler?. What is detected when you first run cmake, ie you should get something like:
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- serialization
Aboria libraries /usr/lib/x86_64-linux-gnu/libboost_serialization.so;m
-- Adding test suites:
/home/mrobins/git/Aboria/tests/metafunctions.h
/home/mrobins/git/Aboria/tests/neighbours.h
/home/mrobins/git/Aboria/tests/data_structures.h
/home/mrobins/git/Aboria/tests/id_search.h
/home/mrobins/git/Aboria/tests/particle_container.h
/home/mrobins/git/Aboria/tests/symbolic.h
/home/mrobins/git/Aboria/tests/variables.h
/home/mrobins/git/Aboria/tests/constructors.h
/home/mrobins/git/Aboria/tests/operators.h
/home/mrobins/git/Aboria/tests/utils.h
/home/mrobins/git/Aboria/tests/iterators.h
/home/mrobins/git/Aboria/tests/chebyshev.h
/home/mrobins/git/Aboria/tests/fmm.h
/home/mrobins/git/Aboria/tests/doc_getting_started.h
/home/mrobins/git/Aboria/tests/parallel.h
/home/mrobins/git/Aboria/tests/h2.h
/home/mrobins/git/Aboria/tests/example_container.h
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mrobins/git/Aboria/build
Arghhhhh I missed that - I ran cmake with the -DCMAKE_CXX_COMPILER flag and everything works now.
Thank you very much for your help and patience!
no problem :) glad you got it working
Hi,
I have some problems installing the library - I am running Suse Leap 15.1 and I get the following error message when running make
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/IteratorsTest.dir/IteratorsTest.cpp.o: undefined reference to symbol 'floor@@GLIBC_2.2.5' /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: /lib64/libm.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: [tests/CMakeFiles/IteratorsTest.dir/build.make:100: tests/IteratorsTest] Error 1 make[1]: [CMakeFiles/Makefile2:266: tests/CMakeFiles/IteratorsTest.dir/all] Error 2 make: *** [Makefile:95: all] Error 2
Any ideas what's going wrong here ?
Thank you very much Mary