I would like to use llvm control flow integrity and I used the clang+llvm binary packaged version 7.0.1 shipped for Ubuntu 14.04. When I use clang++ with options '-fsanitize=cfi -flto -fvisibility=hidden' I get the following error:
/usr/bin/ld: /home/username/llvm-7.0.1/bin/../lib/LLVMgold.so: error loading plugin: /home/username/llvm-7.0.1/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or directory
Any idea how can I fix that without compiling the source code with option that enables gold?
LLVMgold uses the interface file plugin-api. h from gold which means that the resulting LLVMgold.so binary is also GPLv3. This can still be used to link non-GPLv3 programs just as much as gold could without the plugin.
The binaries for LLVM tools are placed in ~/llvm/build/bin . These tools are used to run the LLVM passes. To make it easy to run the tools, it is a good idea to add the path to the binaries to the bash PATH variable so that you can invoke the tools from any directory.
How Is LLVM Different From GCC? LLVM and the GNU Compiler Collection (GCC) are both compilers. The difference is that GCC supports a number of programming languages while LLVM isn't a compiler for any given language. LLVM is a framework to generate object code from any kind of source code.
I received a similar error when linking with clang 13.0.0-2
.
/usr/bin/ld: /usr/lib/llvm-13/bin/../lib/LLVMgold.so: error loading plugin: /usr/lib/llvm-13/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I ran apt search
for llvmgold
and found llvm-13-linker-tools
recommended. Installing this made the issue go away.
sudo apt-get install llvm-13-linker-tools
I got clang
simply via sudo apt-get install clang
. Try looking for the llvm-7
equivalent.
I received a similar error warning when trying to compile Python from sources with --with-lto
option on Ubuntu 14. The easiest thing to do was to just remove the --with-lto
flag during configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With