[cfe-dev] A linker error happens when clang runs with the PrintFunctionNames plugin
yuzhen_3301 at aliyun.com
Thu Aug 14 19:12:34 PDT 2014
Recently, I am leanring how to write a Clang plugin. I begin with the plugin PrintFunctionsNames. PrintFunctionsName is issued with Clang(locating in CLANG_SOURCE_PATH/examples/PrintFunctionNames), and is used for an exmple to illustrate how to write a plugin for Clang.
I use command "make" to generate libPrintFunctionNames.so and libPrintFunctionNames.a, then use the command "clang ./hello.c -Xclang -load -Xclang LLVM_BUILD_PATH/Release+Asserts/lib/libPrintFunctionNames.so -Xclang -plugin -Xclang print-fns" to test the plugin on ./hello.c, which is a simple helloworld program.
But I get an error, which is
"/usr/bin/ld: cannot find /tmp/hello-xxxxxx.o: No such file or directoryclang: error: linker command failed with exit code 1 (use -v to see invocation)".
Howevery, if I use the command "clang ./hello.c -E -Xclang -load -Xclang LLVM_BUILD_PATH/Release+Asserts/lib/libPrintFunctionNames.so -Xclang -plugin -Xclang print-fns", PrintFunctionNames works well.
So I want to know why I cannot use clang to generate a executable file for ./hello.c when the plugin PrintFunctionNames is enabled?
Any help is appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev