ecmwf / eckit

A C++ toolkit that supports development of tools and applications at ECMWF.

Home Page:https://confluence.ecmwf.int/display/eckit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

test_thread_mutex Build failure for Intel 19.0.5

mmiesch opened this issue · comments

The most recent release, 1.10.1 fails to build with version Intel 19.0.5 of the intel compiler suite:

[ 90%] Linking CXX executable eckit_test_thread_mutex
ld: CMakeFiles/eckit_test_thread_mutex.dir/test_mutex.cc.o(.text+0x1a5): unresolvable R_X86_64_TPOFF32 relocation against symbol `_ZSt15__once_callable@@GLIBCXX_3.4.11'
ld: final link failed: Nonrepresentable section on output
tests/thread/CMakeFiles/eckit_test_thread_mutex.dir/build.make:100: recipe for target 'tests/thread/eckit_test_thread_mutex' failed
make[2]: *** [tests/thread/eckit_test_thread_mutex] Error 1
CMakeFiles/Makefile2:5573: recipe for target 'tests/thread/CMakeFiles/eckit_test_thread_mutex.dir/all' failed
make[1]: *** [tests/thread/CMakeFiles/eckit_test_thread_mutex.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

This is using the most recent release of ecbuild, namely 2020.04.0 (also occurs for earlier ecbuild releases).

Has anyone else noticed this? A simple workaround is to comment out that test. Everything else works.

@oiffrig did we not encounter something like this as well?

We did. I have not managed to identify the issue. The only workaround I have found so far is to add -fPIC to the compile flags (in that case, setting CXXFLAGS=-fPIC should get rid of the error)

Thanks @oiffrig - I can confirm that that fix works.

Workaround found. We believe this to be an issue with this particular compiler.

I hate to say this, but it looks like this issue may be back for the latest intel compilers.

You can see here that -fPIC is indeed used in the compilation but it still triggers that error again. This is with version 2020.1.217 of parallel studio, which comes with version 19.1.1.217 of the intel compiler suite.

And, this is for release 1.11.6 of eckit. Any other ideas?

[ 90%] Linking CXX executable eckit_test_thread_mutex
cd /root/eckit/build/tests/thread && /usr/local/bin/cmake -E remove EXE_FILENAME-NOTFOUND
cd /root/eckit/build/tests/thread && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/eckit_test_thread_mutex.dir/link.txt --verbose=1
/opt/intel/compilers_and_libraries_2020.1.217/linux/mpi/intel64/bin/mpiicpc  -fPIC -O0 -g -traceback      -Wl,--disable-new-dtags CMakeFiles/eckit_test_thread_mutex.dir/test_mutex.cc.o  -o eckit_test_thread_mutex -Wl,-rpath,/root/eckit/build/lib ../../lib/libeckit.so /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/x86_64-linux-gnu/libcurl.so /usr/lib/x86_64-linux-gnu/librt.so -lm -ldl 
ld: CMakeFiles/eckit_test_thread_mutex.dir/test_mutex.cc.o(.text+0x130): unresolvable R_X86_64_TPOFF32 relocation against symbol `_ZSt15__once_callable@@GLIBCXX_3.4.11'
ld: final link failed: Nonrepresentable section on output
tests/thread/CMakeFiles/eckit_test_thread_mutex.dir/build.make:89: recipe for target 'tests/thread/eckit_test_thread_mutex' failed
make[2]: *** [tests/thread/eckit_test_thread_mutex] Error 1
make[2]: Leaving directory '/root/eckit/build'
CMakeFiles/Makefile2:5618: recipe for target 'tests/thread/CMakeFiles/eckit_test_thread_mutex.dir/all' failed
make[1]: *** [tests/thread/CMakeFiles/eckit_test_thread_mutex.dir/all] Error 2
make[1]: Leaving directory '/root/eckit/build'
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

@oiffrig, @tlmquintino, I can confirm that also on our tems system the workaround of

export CXXFLAGS=-fPIC

seems to no longer work with module intel/19.1.1. I verified that it still works with module intel/19.0.5

Until this is completely understood (compiler bug? -- may need bug reporting), we can temporarily do some CMake introspection and remove the test from compilation?

The test has been modified to not exhibit this issue anymore.
See fc85194 in develop branch. We can therefore close this issue.

The problem was that if you compile test_thread_mutex.cc with intel 19.x, linking fails due to the mixing of std::async (in the test itself) and pthreads (in eckit/thread/Mutex.cc) ; adding -fPIC to the command line solves the problem with intel 19.0.5, but not intel 19.1, because the latter drops -fPIC if -fPIE is present after it on the command line.