[cfe-dev] A linker error happens when Clang runs with my Clang frontend

yuzhen_3301 yuzhen_3301 at aliyun.com
Wed Aug 13 19:29:12 PDT 2014


Hello, Everyone!

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 directory         clang: 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...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140814/a81ac9bf/attachment.html>


More information about the cfe-dev mailing list