Hi, I tried to implement an 'llc'-like tool in my project to manage different passes and a target machine. I use given llvm project structure to avoid problems but I have a link problem and don't know how to solve it: The target machine uses 'FindUsedTypes' pass and when I try to use my target machine in the tool I got "Undefined symbols: "llvm::FindUsedTypes ... ld: symbol(s) not found" I tried following link options: LLVMLIBS = LLVMAnalysis.a LINK_COMPONENTS = analysis LINK_COMPONENTS = all But nothing solved my problem (in fact the last made some other problems with code I never touched). I would be very appreciated for any idea. Thanks a lot Nico PS: output from "make VERBOSE=1" llvm[2]: Linking Release executable llx (without symbols) /Users/me/Work/code/llvm-2.4/mklib --tag=CXX --tag=disable-shared -- mode=link g++ -I/Users/me/Work/code/llvm-2.4/include -I/Users/me/Work/ code/synphony/llvmllila/build/include -I/Users/me/Work/code/synphony/ llvmllila/build/tools/llx -I/Users/me/Work/code/synphony/llvmllila/ include -I/Users/me/Work/code/synphony/llvmllila/tools/llx -D_DEBUG - D_GNU_SOURCE -D__STDC_LIMIT_MACROS -O3 -fno-exceptions -Woverloaded- virtual -pedantic -Wall -W -Wwrite-strings -Wno-long-long -Wunused - Wno-unused-parameter -fstrict-aliasing -Wstrict-aliasing -O3 -rpath / Users/me/Work/code/synphony/llvmllila/build/Release//bin -export- dynamic -L/Users/me/Work/code/synphony/llvmllila/build/Release//lib -L/ Users/me/Work/code/llvm-2.4/Release//lib -o /Users/me/Work/code/ synphony/llvmllila/build/Release//bin/llx /Users/me/Work/code/ synphony/llvmllila/build/tools/llx/Release/main.o -lLMABE -lPartition - lLLVMBitReader -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMSupport - lLLVMSystem \ -lpthread -lm g++ -I/Users/me/Work/code/llvm-2.4/include -I/Users/me/Work/code/ synphony/llvmllila/build/include -I/Users/me/Work/code/synphony/ llvmllila/build/tools/llx -I/Users/me/Work/code/synphony/llvmllila/ include -I/Users/me/Work/code/synphony/llvmllila/tools/llx -D_DEBUG - D_GNU_SOURCE -D__STDC_LIMIT_MACROS -O3 -fno-exceptions -Woverloaded- virtual -pedantic -Wall -W -Wwrite-strings -Wno-long-long -Wunused - Wno-unused-parameter -fstrict-aliasing -Wstrict-aliasing -O3 -o /Users/ me/Work/code/synphony/llvmllila/build/Release//bin/llx /Users/me/Work/ code/synphony/llvmllila/build/tools/llx/Release/main.o -L/Users/me/ Work/code/synphony/llvmllila/build/Release//lib -L/Users/me/Work/code/ llvm-2.4/Release//lib -lLMABE -lPartition -lLLVMBitReader - lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMSupport -lLLVMSystem - lpthread -lm Undefined symbols: "llvm::FindUsedTypes::ID", referenced from: __ZN4llvm13FindUsedTypes2IDE$non_lazy_ptr in libLMABE.a(LMAWriter.o) "typeinfo for llvm::FindUsedTypes", referenced from: __ZTIN4llvm13FindUsedTypesE$non_lazy_ptr in libLMABE.a(LMAWriter.o) ld: symbol(s) not found collect2: ld returned 1 exit status make[2]: *** [/Users/me/Work/code/synphony/llvmllila/build/Release// bin/llx] Error 1 make[1]: *** [all] Error 1 make: *** [all] Error 1
Dear Nico, I believe you need to add LLVMipa to the list of libraries to link into your tool. FindUsedTypes::ID is defined in lib/Analysis/IPA. I think it would be LLVMipa.a if you added it to LLVMLIBS and ipa if you added it to LINK_COMPONENTS. -- John T. Nico wrote:> Hi, > > I tried to implement an 'llc'-like tool in my project to manage > different passes and a target machine. > > I use given llvm project structure to avoid problems but I have a link > problem and don't know how to solve it: > The target machine uses 'FindUsedTypes' pass and when I try to use my > target machine in the tool I got "Undefined symbols: > "llvm::FindUsedTypes ... ld: symbol(s) not found" > > I tried following link options: > LLVMLIBS = LLVMAnalysis.a > LINK_COMPONENTS = analysis > LINK_COMPONENTS = all > But nothing solved my problem (in fact the last made some other > problems with code I never touched). > > I would be very appreciated for any idea. > > Thanks a lot > Nico > > PS: output from "make VERBOSE=1" > > llvm[2]: Linking Release executable llx (without symbols) > /Users/me/Work/code/llvm-2.4/mklib --tag=CXX --tag=disable-shared -- > mode=link g++ -I/Users/me/Work/code/llvm-2.4/include -I/Users/me/Work/ > code/synphony/llvmllila/build/include -I/Users/me/Work/code/synphony/ > llvmllila/build/tools/llx -I/Users/me/Work/code/synphony/llvmllila/ > include -I/Users/me/Work/code/synphony/llvmllila/tools/llx -D_DEBUG - > D_GNU_SOURCE -D__STDC_LIMIT_MACROS -O3 -fno-exceptions -Woverloaded- > virtual -pedantic -Wall -W -Wwrite-strings -Wno-long-long -Wunused - > Wno-unused-parameter -fstrict-aliasing -Wstrict-aliasing -O3 -rpath / > Users/me/Work/code/synphony/llvmllila/build/Release//bin -export- > dynamic -L/Users/me/Work/code/synphony/llvmllila/build/Release//lib -L/ > Users/me/Work/code/llvm-2.4/Release//lib -o /Users/me/Work/code/ > synphony/llvmllila/build/Release//bin/llx /Users/me/Work/code/ > synphony/llvmllila/build/tools/llx/Release/main.o -lLMABE -lPartition - > lLLVMBitReader -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMSupport - > lLLVMSystem \ > -lpthread -lm > g++ -I/Users/me/Work/code/llvm-2.4/include -I/Users/me/Work/code/ > synphony/llvmllila/build/include -I/Users/me/Work/code/synphony/ > llvmllila/build/tools/llx -I/Users/me/Work/code/synphony/llvmllila/ > include -I/Users/me/Work/code/synphony/llvmllila/tools/llx -D_DEBUG - > D_GNU_SOURCE -D__STDC_LIMIT_MACROS -O3 -fno-exceptions -Woverloaded- > virtual -pedantic -Wall -W -Wwrite-strings -Wno-long-long -Wunused - > Wno-unused-parameter -fstrict-aliasing -Wstrict-aliasing -O3 -o /Users/ > me/Work/code/synphony/llvmllila/build/Release//bin/llx /Users/me/Work/ > code/synphony/llvmllila/build/tools/llx/Release/main.o -L/Users/me/ > Work/code/synphony/llvmllila/build/Release//lib -L/Users/me/Work/code/ > llvm-2.4/Release//lib -lLMABE -lPartition -lLLVMBitReader - > lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMSupport -lLLVMSystem - > lpthread -lm > Undefined symbols: > "llvm::FindUsedTypes::ID", referenced from: > __ZN4llvm13FindUsedTypes2IDE$non_lazy_ptr in > libLMABE.a(LMAWriter.o) > "typeinfo for llvm::FindUsedTypes", referenced from: > __ZTIN4llvm13FindUsedTypesE$non_lazy_ptr in > libLMABE.a(LMAWriter.o) > ld: symbol(s) not found > collect2: ld returned 1 exit status > make[2]: *** [/Users/me/Work/code/synphony/llvmllila/build/Release// > bin/llx] Error 1 > make[1]: *** [all] Error 1 > make: *** [all] Error 1 > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Dear John, thanks! I was irritated by the path of the header file/declaration. It is not like the definition in a subdirectory. Sorry my fault. Is there an overview where classes and link options are mapped to each other? Kind regards, Nico On Jan 4, 2009, at 4:07 PM, John Criswell wrote:> Dear Nico, > > I believe you need to add LLVMipa to the list of libraries to link > into > your tool. FindUsedTypes::ID is defined in lib/Analysis/IPA. > > I think it would be LLVMipa.a if you added it to LLVMLIBS and ipa if > you > added it to LINK_COMPONENTS. > > -- John T. > > Nico wrote: >> Hi, >> >> I tried to implement an 'llc'-like tool in my project to manage >> different passes and a target machine. >> >> I use given llvm project structure to avoid problems but I have a >> link >> problem and don't know how to solve it: >> The target machine uses 'FindUsedTypes' pass and when I try to use my >> target machine in the tool I got "Undefined symbols: >> "llvm::FindUsedTypes ... ld: symbol(s) not found" >> >> I tried following link options: >> LLVMLIBS = LLVMAnalysis.a >> LINK_COMPONENTS = analysis >> LINK_COMPONENTS = all >> But nothing solved my problem (in fact the last made some other >> problems with code I never touched). >> >> I would be very appreciated for any idea. >> >> Thanks a lot >> Nico >> >> PS: output from "make VERBOSE=1" >> >> llvm[2]: Linking Release executable llx (without symbols) >> /Users/me/Work/code/llvm-2.4/mklib --tag=CXX --tag=disable-shared -- >> mode=link g++ -I/Users/me/Work/code/llvm-2.4/include -I/Users/me/ >> Work/ >> code/synphony/llvmllila/build/include -I/Users/me/Work/code/synphony/ >> llvmllila/build/tools/llx -I/Users/me/Work/code/synphony/llvmllila/ >> include -I/Users/me/Work/code/synphony/llvmllila/tools/llx - >> D_DEBUG - >> D_GNU_SOURCE -D__STDC_LIMIT_MACROS -O3 -fno-exceptions - >> Woverloaded- >> virtual -pedantic -Wall -W -Wwrite-strings -Wno-long-long -Wunused - >> Wno-unused-parameter -fstrict-aliasing -Wstrict-aliasing -O3 - >> rpath / >> Users/me/Work/code/synphony/llvmllila/build/Release//bin -export- >> dynamic -L/Users/me/Work/code/synphony/llvmllila/build/Release//lib >> -L/ >> Users/me/Work/code/llvm-2.4/Release//lib -o /Users/me/Work/code/ >> synphony/llvmllila/build/Release//bin/llx /Users/me/Work/code/ >> synphony/llvmllila/build/tools/llx/Release/main.o -lLMABE - >> lPartition - >> lLLVMBitReader -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMSupport - >> lLLVMSystem \ >> -lpthread -lm >> g++ -I/Users/me/Work/code/llvm-2.4/include -I/Users/me/Work/code/ >> synphony/llvmllila/build/include -I/Users/me/Work/code/synphony/ >> llvmllila/build/tools/llx -I/Users/me/Work/code/synphony/llvmllila/ >> include -I/Users/me/Work/code/synphony/llvmllila/tools/llx -D_DEBUG - >> D_GNU_SOURCE -D__STDC_LIMIT_MACROS -O3 -fno-exceptions -Woverloaded- >> virtual -pedantic -Wall -W -Wwrite-strings -Wno-long-long -Wunused - >> Wno-unused-parameter -fstrict-aliasing -Wstrict-aliasing -O3 -o / >> Users/ >> me/Work/code/synphony/llvmllila/build/Release//bin/llx /Users/me/ >> Work/ >> code/synphony/llvmllila/build/tools/llx/Release/main.o -L/Users/me/ >> Work/code/synphony/llvmllila/build/Release//lib -L/Users/me/Work/ >> code/ >> llvm-2.4/Release//lib -lLMABE -lPartition -lLLVMBitReader - >> lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMSupport -lLLVMSystem - >> lpthread -lm >> Undefined symbols: >> "llvm::FindUsedTypes::ID", referenced from: >> __ZN4llvm13FindUsedTypes2IDE$non_lazy_ptr in >> libLMABE.a(LMAWriter.o) >> "typeinfo for llvm::FindUsedTypes", referenced from: >> __ZTIN4llvm13FindUsedTypesE$non_lazy_ptr in >> libLMABE.a(LMAWriter.o) >> ld: symbol(s) not found >> collect2: ld returned 1 exit status >> make[2]: *** [/Users/me/Work/code/synphony/llvmllila/build/Release// >> bin/llx] Error 1 >> make[1]: *** [all] Error 1 >> make: *** [all] Error 1 >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev