10

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?

masec
  • 584
  • 5
  • 16

3 Answers3

2

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.

Dharman
  • 30,962
  • 25
  • 85
  • 135
0

I have same problem with recently llvm version 10. it seems not a bug of llvm, so would not patched in the future. so, I wrotten here how to fix this.

after build the llvm, you should ran the make install command. but LLVMgold.so installed to '/usr/local/lib' typically. therefore clang show message like this '/../lib/LLVMgold.so: cannot open shared object file: No such file or directory'

you must link LLVMgold to right path. in ubuntu, 'ln -sf /usr/lib/llvm-3.4/lib/LLVMgold.so /usr/local/lib/LLVMgold.so' will fix this.

hanbumpark
  • 233
  • 2
  • 14
0

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.

Nathan Moinvaziri
  • 5,506
  • 4
  • 29
  • 30