/usr/bin/ld: /usr/local/clang-7.0.0/bin/…/lib/LLVMgold.so: error loading plugin: /usr/local/clang-7.0.0/bin/…/lib/LLVMgold.so: cannot open shared object file: No such file or directory
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
/usr/bin/ld: /usr/local/clang-7.0.0/bin/../lib/LLVMgold.so: error loading plugin: /usr/local/clang-7.0.0/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or directory
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
Seems clang was not build with the gold linker, or the linker is not installed?
Thanks, but that does not really solve the problem since the deb package installs the plugin somewhere in /usr/lib/.. and the pre-installed clang expects the .so somewhere in /usr/local/...
After some back-and-forth I ended up installing the clang-7 package under bionic and use this one instead of the pre-installed one. Maybe I could have copied the file to the right place where the linker expected it?
I wonder why Travis maintains its own clang version despite having a readily available packaged version from Ubuntu? (which has the added benefit of a working gold linker with LTO support)
I really hoped that it would pick up the libs under /usr/lib/…
That puzzled me, too. It’s way more straightforward to just use the Apt package. A custom installation is only good if there are some customizations – and there don’t seem to be any.
'${CXX} printf.cpp" is a bad test case. The problem appears when the linker tries to use to LTO plugin so you need at least 2 compilation units that are linked in a separate step.
it’s not an upstream problem. apt installing llvm/clang works and fixes the problem. The installed instance in /usr/local/clang-7.0.0 doesn’t include the necessary plugin for lto.
ah, that’s what you meant by upstream problem.
It looks like the gold plugin is built only if LLVM_BINUTILS_INCDIR is set at configure time. I’m not sure if there’s a plugin that was built with the upstream binary tarball.
for ubuntu it’s distributed in llvm-X-dev package.
it might be best to just use the apt version, either the distro one or https://apt.llvm.org
There’s one more reason to use the apt versions. The binary tarball is built using clang, so running llvm-config --cxxflags can include flags that are not supported by the system compiler.
This topic can be renamed to “Use apt version of llvm/clang”.