Ld too old?

Is the ld I’m using too old? I can work around this with -fuse-ld=lld though.

$ clang++ -fopenmp -fopenmp-targets=nvptx64 test.cpp
/usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/…/lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)@GLIBCXX_3.4.21' /usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/../lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_M_create(unsigned long&, unsigned long)@GLIBCXX_3.4.21
/usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/…/lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()@GLIBCXX_3.4.21' /usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/../lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits, std::allocator >::operator=(char const*)@GLIBCXX_3.4.21
/usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/…/lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_capacity(unsigned long)@GLIBCXX_3.4.21' /usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/../lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_M_data() const@GLIBCXX_3.4.21’
/usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/…/lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::c_str() const@GLIBCXX_3.4.21' /usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/../lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_S_copy_chars(char*, char*, char*)@GLIBCXX_3.4.21
/usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/…/lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data(char*)@GLIBCXX_3.4.21' /usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/../lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_M_local_data()@GLIBCXX_3.4.21
/usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/…/lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()@GLIBCXX_3.4.21' /usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/../lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits, std::allocator >::~basic_string()@GLIBCXX_3.4.21
/usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/…/lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21' /usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/../lib/libomptarget.so: undefined reference to std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_M_set_length(unsigned long)@GLIBCXX_3.4.21
/usr/local/software/jureca/Stages/2019a/software/binutils/2.32-GCCcore-8.3.0/bin/ld: /p/project/cjzam11/kitayama1/opt/clang/201912192353/bin/…/lib/libomptarget.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_Alloc_hider::_Alloc_hider(char*, std::allocator const&)@GLIBCXX_3.4.21
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

Please response on the list.

You’ll have to look at the Clang docs for minimum compiler versions but I think this is a library issue and perhaps can be solved by setting -std=c++11 or perhaps the ABI preprocess macro (https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html).

Jeff

Thanks, I’ll check them out.

Per the document: https://llvm.org/docs/GettingStarted.html , GCC requreiment is just 5.1.0 or higher.

So I suspect there’s a strict requirement for GCC, when enabling the OpenMP offloading features.

Checking also the LLVM OpenMP project page: https://openmp.llvm.org/ seems to be updated
partially, but most of them are talking about couples years ago’s stuff and old GCC releases
are said to be supported.