0

I'm trying to use clang++ instead of g++ to create object files that will later be linked by the gnu linker.

I'm am able to do this successfully using native clang++, but when I use clang++ with a plugin, I get a link error:

clang: error: linker command failed with exit code 1 (use -v to see invocation)

That's okay! I just need the object files! However, when I specify -S or -c I do not get any object file, even if I use .o to explicitly specify an output file.

I am unable to do this even with clang's example plugins.

How can I get clang to give an object file?

Much Thanks!

4

1 回答 1

7

我有同样的问题。对我来说,在我的命令行上用“-add-plugin”替换“-plugin”解决了这个问题。我不确定有什么区别或为什么会起作用,但确实如此。

此外,如果您在命令行上使用“-cc1”,请尝试删除它并在每个插件特定参数前加上“-Xclang”,即“clang -Xclang -load -Xclang plugin.so -Xclang -add-plugin -Xclang”插件名称”。同样,我不确定为什么 -cc1 对我不起作用,但事实并非如此,这解决了它。

于 2012-07-23T13:34:37.153 回答