The output of `llvm-config --cppflags --ldflags --libs core support` and `llvm-config --cppflags --ldflags --libs core` is the same. I've also tried specifying -lLLVMSupport manually. Same result. --Eugene ----- Original Message ----- Hi Eugene, >I do this, and I've tried a few variations of on it: >clang++ `llvm-config --cppflags --ldflags --libs core` -o clangtest clangtest.cpp the missing routine is defined in the support library, not the core library, try --libs core support Ciao, Duncan. >>I've also tried removing the library and the include file in turn, which in both cases succefully made the compiler not find the files needed. >>----- Original Message ----- >Hi Eugene, >>On 17/07/12 03:46, Eugene wrote: >>I'm trying to make use of the llvm compiler libraries, but I can't get them to link to my program correctly. >>>>#include <llvm/Constants.h> >>#include <llvm/DerivedTypes.h> >>>>>>int main(){ >>>>llvm::APInt(1,0); >>>>return 0; >>} >>>>I get an error like: >>undefined reference to `llvm::APInt::initSlowCase(unsigned int, unsigned long long, bool) >>did you link with -lLLVMSupport (see the output of `llvm-config --libs >support`)? What link command did you use? >>Ciao, Duncan. >>>>>(this function is called by the inline APInt constructor) >>>>The library seems to be found correctly; it doesn't give any other errors. Using nm I can see the mangled function initSlowCase exactly where I expect it to be. I'm out of ideas of that could be wrong. >>>>I'm using kubuntu 12.04. Same error occurs with both clang++ and g++. LLVM libraries are 3.1 >>Any ideas on what might be the problem? >>>>>>_______________________________________________ >>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 >>>_______________________________________________ >LLVM Developers mailing list >LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Hi Eugene,> The output of `llvm-config --cppflags --ldflags --libs core support` and > `llvm-config --cppflags --ldflags --libs core` is the same. I've also tried specifying -lLLVMSupport manually. Same result.maybe then llvm-config comes from a different version or build of LLVM than the one providing the LLVM header files you are building your code against. Ciao, Duncan.> > --Eugene > > ----- Original Message ----- > Hi Eugene, >I do this, and I've tried a few variations of on it: >clang++ `llvm-config --cppflags --ldflags --libs core` -o clangtest clangtest.cpp the missing routine is defined in the support library, not the core library, try > --libs core support Ciao, Duncan. >>I've also tried removing the library and the include file in turn, which in both cases succefully made the compiler not find the files needed. >>----- Original Message ----- >Hi Eugene, >>On 17/07/12 03:46, Eugene wrote: >>I'm trying to make use of the llvm compiler libraries, but I can't get them to link to my program correctly. >>>>#include <llvm/Constants.h> >>#include <llvm/DerivedTypes.h> >>>>>>int main(){ >>>>llvm::APInt(1,0); >>>>return 0; >>} >>>>I get an error like: >>undefined reference to `llvm::APInt::initSlowCase(unsigned int, unsigned long long, bool) >>did you link with -lLLVMSupport (see the output of `llvm-config --libs >support`)? What link command did you use? >>Ciao, Duncan. >>>>>(this function is called by the inline APInt constructor) >>>>The library seems to be found correctly; it doesn't give any other errors. Using nm I can see the mangled function initSlowCase exactly where I expect it to be. > I'm out of ideas of that could be wrong. >>>>I'm using kubuntu 12.04. Same error occurs with both clang++ and g++. LLVM libraries are 3.1 >>Any ideas on what might be the problem? >>>>>>_______________________________________________ >>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 >>>_______________________________________________ >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 >
Eugene, how about below? $ clang clangtest.cpp `llvm-config --ldflags --libs core` (I guess linking order would be) 2012/7/18 Eugene <code_ep at yahoo.com>:> The output of `llvm-config --cppflags --ldflags --libs core support` and > `llvm-config --cppflags --ldflags --libs core` is the same. I've also tried specifying -lLLVMSupport manually. Same result. > > --Eugene > > ----- Original Message ----- > Hi Eugene, >I do this, and I've tried a few variations of on it: >clang++ `llvm-config --cppflags --ldflags --libs core` -o clangtest clangtest.cpp the missing routine is defined in the support library, not the core library, try > --libs core support Ciao, Duncan. >>I've also tried removing the library and the include file in turn, which in both cases succefully made the compiler not find the files needed. >>----- Original Message ----- >Hi Eugene, >>On 17/07/12 03:46, Eugene wrote: >>I'm trying to make use of the llvm compiler libraries, but I can't get them to link to my program correctly. >>>>#include <llvm/Constants.h> >>#include <llvm/DerivedTypes.h> >>>>>>int main(){ >>>>llvm::APInt(1,0); >>>>return 0; >>} >>>>I get an error like: >>undefined reference to `llvm::APInt::initSlowCase(unsigned int, unsigned long long, bool) >>did you link with -lLLVMSupport (see the output of `llvm-config --libs >support`)? What link command did you use? >>Ciao, Duncan. >>>>>(this function is called by the inline APInt constructor) >>>>The library seems to be found correctly; it doesn't give any other errors. Using nm I can see the mangled function initSlowCase exactly where I expect it to be. > I'm out of ideas of that could be wrong. >>>>I'm using kubuntu 12.04. Same error occurs with both clang++ and g++. LLVM libraries are 3.1 >>Any ideas on what might be the problem? >>>>>>_______________________________________________ >>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 >>>_______________________________________________ >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
That did it. I got it to work with this line (cpp flags was still needed): clang++ -o clangtest clangtest.cpp `llvm-config --cppflags --ldflags --libs core` Thank you, --Eugene ________________________________ From: NAKAMURA Takumi <geek4civic at gmail.com> To: Eugene <code_ep at yahoo.com> Cc: "llvmdev at cs.uiuc.edu" <llvmdev at cs.uiuc.edu> Sent: Tuesday, July 17, 2012 11:56 AM Subject: Re: [LLVMdev] llvm library linking issues Eugene, how about below? $ clang clangtest.cpp `llvm-config --ldflags --libs core` (I guess linking order would be) 2012/7/18 Eugene <code_ep at yahoo.com>:> The output of `llvm-config --cppflags --ldflags --libs core support` and > `llvm-config --cppflags --ldflags --libs core` is the same. I've also tried specifying -lLLVMSupport manually. Same result. > > --Eugene > > ----- Original Message ----- > Hi Eugene, >I do this, and I've tried a few variations of on it: >clang++ `llvm-config --cppflags --ldflags --libs core` -o clangtest clangtest.cpp the missing routine is defined in the support library, not the core library, try > --libs core support Ciao, Duncan. >>I've also tried removing the library and the include file in turn, which in both cases succefully made the compiler not find the files needed. >>----- Original Message ----- >Hi Eugene, >>On 17/07/12 03:46, Eugene wrote: >>I'm trying to make use of the llvm compiler libraries, but I can't get them to link to my program correctly. >>>>#include <llvm/Constants.h> >>#include <llvm/DerivedTypes.h> >>>>>>int main(){ >>>>llvm::APInt(1,0); >>>>return 0; >>} >>>>I get an error like: >>undefined reference to `llvm::APInt::initSlowCase(unsigned int, unsigned long long, bool) >>did you link with -lLLVMSupport (see the output of `llvm-config --libs >support`)? What link command did you use? >>Ciao, Duncan. >>>>>(this function is called by the inline APInt constructor) >>>>The library seems to be found correctly; it doesn't give any other errors. Using nm I can see the mangled function initSlowCase exactly where I expect it tobe.> I'm out of ideas of that could be wrong. >>>>I'm using kubuntu 12.04. Same error occurs with both clang++ and g++. LLVM libraries are 3.1 >>Any ideas on what might be the problem? >>>>>>_______________________________________________ >>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 >>>_______________________________________________ >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-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120717/1d89c16e/attachment.html>