I'm new to clang and fairly new to fedora (and just signed up on the forum:-)
Short summary: I'm trying to use link time optimization (i.e. "-flto") with clang and get the following error:
Longer description:
I've got a project I've been successfully compiling with GCC using link time optimization (i.e. the "-flto" flag). I'm trying to get this code to compile using clang. My preference is to use the clang from the Fedora18 distribution. I.e. "yum install clang".
It was trivial to get the project to compile with clang without using -flto. Basic tests are passing, builds are a bit faster. Yay.
But I am not having any luck using -flto. Compiles are fine, but when linking I get the errors mentioned above. I've reduced the problem to a trivial hello-world.c. E.g.
I clearly don't have an "LLVMgold.so" on the computer, and I'm not seeing anything obvious when grepping "yum list" for "llvm", "gold", etc. And I'm not having luck searching for info about this, and there's little in the way of documentation for clang.
Any ideas?
Here's what I have installed:
Short summary: I'm trying to use link time optimization (i.e. "-flto") with clang and get the following error:
Code:
/usr/bin/ld: /usr/bin/../lib/LLVMgold.so: error loading plugin
/usr/bin/ld: /usr/bin/../lib/LLVMgold.so: error in plugin cleanup (ignored)
I've got a project I've been successfully compiling with GCC using link time optimization (i.e. the "-flto" flag). I'm trying to get this code to compile using clang. My preference is to use the clang from the Fedora18 distribution. I.e. "yum install clang".
It was trivial to get the project to compile with clang without using -flto. Basic tests are passing, builds are a bit faster. Yay.
But I am not having any luck using -flto. Compiles are fine, but when linking I get the errors mentioned above. I've reduced the problem to a trivial hello-world.c. E.g.
Code:
$ clang -g -flto -o hello.o -x c -c hello.c
$ clang -g -flto -o hello hello.o
/usr/bin/ld: /usr/bin/../lib/LLVMgold.so: error loading plugin
/usr/bin/ld: /usr/bin/../lib/LLVMgold.so: error in plugin cleanup (ignored)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$
Any ideas?
Here's what I have installed:
Code:
$ yum list installed llvm* clang*
Loaded plugins: langpacks, presto, refresh-packagekit
Installed Packages
clang.x86_64 3.2-2.fc18 @updates
clang-devel.x86_64 3.2-2.fc18 @updates
clang-doc.noarch 3.2-2.fc18 @updates
llvm.x86_64 3.2-2.fc18 @updates
llvm-libs.x86_64 3.2-2.fc18 @updates