zoglauer / megalib

MEGAlib - the Medium-Energy Gamma-ray Astronomy library
http://megalibtoolkit.com
Other
42 stars 34 forks source link

is only available from C++17 onwards #42

Closed aleita closed 6 years ago

aleita commented 6 years ago

I'm trying to compile MEGAlib but at the end I always get to the following error: I also tried to specify -std=c++17/ -std=gnu++17 config/Makefile.linxgcc.

/cvmfs/sft.cern.ch/lcg/releases/ROOT/6.14.02-c2be2/x86_64-centos7-gcc8-opt/include/TString.h:110:13: error: expected type-specifier operator std::string_view() const { return std::string_view(Data(),fExtent); } ^~~ /cvmfs/sft.cern.ch/lcg/releases/ROOT/6.14.02-c2be2/x86_64-centos7-gcc8-opt/include/TString.h:275:23: error: ‘string_view’ in namespace ‘std’ does not name a type TString(const std::string_view &sub); ^~~ /cvmfs/sft.cern.ch/lcg/releases/ROOT/6.14.02-c2be2/x86_64-centos7-gcc8-opt/include/TString.h:275:18: note: ‘std::string_view’ is only available from C++17 onwards TString(const std::string_view &sub);

is there a certain version conbination between all the components [gcc 8.2, cmake 3.12, binutil 2.30, ROOT 6.14.02, GENAT4 10.02.p02] which is supposed to work ?

thanks in advance

zoglauer commented 6 years ago

Did you compile ROOT & Geant4 with the setup.sh script which comes with MEGAlib? Or did you use one of the CERN precompiled versions? It looks like the latter.

If you have tried to use the setup script to compile ROOT, then let me know the exact OS version you are using. It looks like the latest centos version?

Thanks, Andreas

aleita commented 6 years ago

in the above example I used the CERN one in particular

/cvmfs/sft.cern.ch/lcg/releases/ROOT/6.14.02-c2be2/x86_64-centos7-gcc8-opt/ /cvmfs/sft.cern.ch/lcg/releases/Geant4/10.02.p02-63aaa/x86_64-centos7-gcc62-opt/

I've an ongoing attempt to compile ROOT using the setup script

zoglauer commented 6 years ago

OK. Let me know how your compile attempt goes. Because the error message looks like you used a different setup for compiling MEGAlib than what was used to compile ROOT. Is this possible?

aleita commented 6 years ago

This is the point, find the right environment/config in order to have a working copy of the code. I've done several attempts using different version of the various components [gcc , cmake , binutil , ROOT , GENAT4] but at the end the one posted in this issue seems to me the one closest to the solution.

have you already seen this error message " is only available from C++17 onwards" ?

zoglauer commented 6 years ago

The setup script compiles all necessary libraries, thus this problem should normally not appear. I have seen similar problems with centos, yes.

If everything fails, just a few weeks back I made my first MEGAlib docker: https://hub.docker.com/r/zoglauer/megalib

Feel free to try that one.

aleita commented 6 years ago

yes, I successfully tried it but having a compiled version is a local requirements :-)

aleita commented 6 years ago

ROOT building process failed due to an "undefined reference " for tbb library.

same result even if the ROOT setup script builds tbb library by itself

in the following example I tried to use tbb library from CERN

the error it is quite strange because the last stdlibc++ is available in LD_LIBRARY_PATH

[ 98%] Building CXX object proof/pq2/CMakeFiles/pq2.dir/src/redirguard.cxx.o [ 98%] Linking CXX executable ../../bin/pq2 /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference to std::length_error::length_error(char const*)@GLIBCXX_3.4.21' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference tocxa_init_primary_exception@CXXABI_1.3.11' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference to `cxa_throw_bad_array_new_length@CXXABI_1.3.8' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference to std::invalid_argument::invalid_argument(char const*)@GLIBCXX_3.4.21' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference tostd::__exception_ptr::exception_ptr::exception_ptr(void)@CXXABI_1.3.11' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference to `std::runtime_error::runtime_error(char const)@GLIBCXX_3.4.21' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference to std::out_of_range::out_of_range(char const*)@GLIBCXX_3.4.21' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference tostd::range_error::range_error(char const)@GLIBCXX_3.4.21' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference to `operator delete(void, unsigned long)@CXXABI_1.3.9' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference to `operator delete[](void*, unsigned long)@CXXABI_1.3.9' collect2: error: ld returned 1 exit status make[2]: [bin/pq2] Error 1 make[1]: [proof/pq2/CMakeFiles/pq2.dir/all] Error 2 make: *** [all] Error 2 ERROR: Something went wrong while compiling ROOT!

ERROR: Something went wrong during the ROOT setup.

zoglauer commented 6 years ago

Remind me of your exact OS version: the latest Centos 7 1804?

I will try to install it in a virtualbox and try to build MEGAlib there.

However, In the output is one suspicious thing: the reference to „/cvmfs/sft.cern.ch/lcg/releases”

This means you are pulling in a library not built on your local computer and thus maybe build with a different ABI since I see references to 1.3.1 & 1.3.8 & 1.3.9 which might be the cause for the problem.

Could you check that your environment paths are clear from any reference to /cvmfs/sft.cern.ch/lcg/releases, especially LD_LIBRRAY_PATH?

On Aug 17, 2018, at 2:43 AM, Alessandro Italiano notifications@github.com wrote:

ROOT building process failed due to an "undefined reference " for tbb library.

same result even if the ROOT setup script build tbb library by itself

in the following example I tried to use the CERN one

[ 98%] Building CXX object proof/pq2/CMakeFiles/pq2.dir/src/redirguard.cxx.o [ 98%] Linking CXX executable ../../bin/pq2 /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference to std::length_error::length_error(char const)@GLIBCXX_3.4.21' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference tocxa_init_primary_exception@CXXABI_1.3.11' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference to cxa_throw_bad_array_new_length@CXXABI_1.3.8' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference tostd::invalid_argument::invalid_argument(char const)@GLIBCXX_3.4.21' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference to std::__exception_ptr::exception_ptr::exception_ptr(void)@CXXABI_1.3.11' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference tostd::runtime_error::runtime_error(char const)@GLIBCXX_3.4.21' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference to std::out_of_range::out_of_range(char const)@GLIBCXX_3.4.21' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference tostd::range_error::range_error(char const)@GLIBCXX_3.4.21' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference to operator delete(void, unsigned long)@CXXABI_1.3.9' /cvmfs/sft.cern.ch/lcg/releases/tbb/44_20160413-f254c/x86_64-centos7-gcc7-opt/lib/libtbb.so.2: undefined reference tooperator delete[](void, unsigned long)@CXXABI_1.3.9' collect2: error: ld returned 1 exit status make[2]: [bin/pq2] Error 1 make[1]: [proof/pq2/CMakeFiles/pq2.dir/all] Error 2 make: *** [all] Error 2 ERROR: Something went wrong while compiling ROOT!

ERROR: Something went wrong during the ROOT setup.

Please take a look if you find the issue here (look at open and closed issues): https://github.com/zoglauer/megalib/issues If not add your problem and write me an email! — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

aleita commented 6 years ago

-bash-4.2# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) -bash-4.2#

zoglauer commented 6 years ago

I installed exactly this CentOS version, switched to the latest devtools, and MEGAlib installed without problems.

I strongly suggest you check your environment variables. For some reason ROOT finds a libtbb.so, which seems to be compiled with a different compiler.

aleita commented 6 years ago

You are definitely right. I’ve just installed cmake3 and devtoolset-7 and I finally managed to install MEGAlib, ROOT AND G4.

Thanks for your help and patience

Ale

zoglauer commented 6 years ago

Great!