FairRootGroup / FairRoot

C++ simulation, reconstruction and analysis framework for particle physics experiments
http://fairroot.gsi.de
Other
57 stars 96 forks source link

Catch2 Test failed when using the compiler from a custom location #1542

Closed YanzhaoW closed 3 months ago

YanzhaoW commented 3 months ago

Hi

Describe the bug

I'm trying to compile FairRoot v19 using a compiler from the custom location. The lib location (which contains a newer version of libstdc++) has been already added to the env variable LD_LIBRARY_PATH before starting the compilation. However, the compilation process failed due to catch2 test using the system libstdc++, which is too old.

To Reproduce Steps to reproduce the behavior:

  1. Use a compiler installed in a custom location
  2. Compile the FairRoot with version 19

Expected behavior Catch2 test should use the libstdc++ specified by the user instead of the system location.

Logs / Screenshots

/u/yanwang/software/src/FairRoot/build/tests/examples/simulation/Tutorial1/test_ExSimulation1: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /u/yanwang/software/src/FairRoot/build/lib/libExSimulation1.so.19.0.0)
/u/yanwang/software/src/FairRoot/build/tests/examples/simulation/Tutorial1/test_ExSimulation1: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /u/yanwang/software/src/FairRoot/build/lib/libBase.so.19.0.0)
/u/yanwang/software/src/FairRoot/build/tests/examples/simulation/Tutorial1/test_ExSimulation1: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /u/yanwang/software/src/FairRoot/build/lib/libCatch2.so.3.5.4)
/u/yanwang/software/src/FairRoot/build/tests/examples/simulation/Tutorial1/test_ExSimulation1: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.13' not found (required by /u/yanwang/software/src/FairRoot/build/lib/libCatch2.so.3.5.4)
/u/yanwang/software/src/FairRoot/build/tests/examples/simulation/Tutorial1/test_ExSimulation1: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /u/yanwang/software/src/FairRoot/build/lib/libGeoBase.so.19.0.0)
/u/yanwang/software/src/FairRoot/build/tests/examples/simulation/Tutorial1/test_ExSimulation1: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /u/yanwang/software/src/FairRoot/build/lib/libExMCStack.so.19.0.0)
CMake Error at /u/yanwang/software/src/FairRoot/third_party/Catch2_v3.5.4/extras/CatchAddTests.cmake:70 (message):
  Error running test executable
  '/u/yanwang/software/src/FairRoot/build/tests/examples/simulation/Tutorial1/test_ExSimulation1':

    Result: 1
    Output:

Call Stack (most recent call first):
  /u/yanwang/software/src/FairRoot/third_party/Catch2_v3.5.4/extras/CatchAddTests.cmake:175 (catch_discover_tests_impl)

System information (please complete the following information):

Additional context

The issue could be fix by changing the following lines:

https://github.com/FairRootGroup/FairRoot/blob/99be5f48d4bfed7ee7179524c07bc49a6b37a5c5/tests/examples/simulation/Tutorial1/CMakeLists.txt#L12-L16

to

  set(workaround)

Or use the LD_LIBRARY_PATH defined by the user. Currently, LD_LIBRARY_PATH is set only to contain the lib dirs from FairSoft and FairRoot.

dennisklein commented 3 months ago

Please try setting the environment variable $LIBRARY_PATH (pointing to the directory containing your custom libstdc++) instead of $LD_LIBRARY_PATH.

YanzhaoW commented 3 months ago

Hi, @dennisklein thanks for your reply.

In my case, $LIBRARY_PATH already has the correct path that contains the newer version of libstdc++.

From this post, it seems that $LIBRARY_PATH is only responsible for compile time linking. However, from the error message:

Error running test executable

It has an error when running the test executable, which use $LD_LIBRARY_PATH instead.

dennisklein commented 3 months ago

Yes, you are correct, the cmake macro runs the test executables in order to print the list of contained test cases.

Hm, before modifying the logic to include the currently set $LD_LIBRARY_PATH, there is one more thing to try:

YanzhaoW commented 3 months ago

Hi, @dennisklein

Compilation runs fine. But ctest fails with the exact same error message.

But if I go to the build/tests/examples/simulation/Tutorial1 and run

./test_ExSimulation1

It works fine.

YanzhaoW commented 3 months ago

Fixed by #1543