[LLVMdev] Unable to do even basic Clang tutorial (original) (raw)
NY Knicks Fan nyknicksfan92009 at yahoo.com
Tue Jul 10 13:22:20 PDT 2012
- Previous message: [LLVMdev] Unable to do even basic Clang tutorial
- Next message: [LLVMdev] Unable to do even basic Clang tutorial
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Ashok,
$ cd bin/bin
$ ./llvm-config --ldflags --libs -L/home/ubuntu/bin/lib -ldl -lpthread -lLLVMAsmParser -lLLVMTableGen -lLLVMDebugInfo -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMJIT -lLLVMMCDisassembler -lLLVMMCParser -lLLVMInstrumentation -lLLVMInterpreter -lLLVMCodeGen -lLLVMipo -lLLVMVectorize -lLLVMScalarOpts -lLLVMInstCombine -lLLVMLinker -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMArchive -lLLVMBitReader -lLLVMBitWriter -lLLVMMCJIT -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport
Now clang++ still can't find llvm/clang: (any help is very much appreciated)
$ /home/ubuntu/bin/bin/clang++ -I /home/ubuntu/bin/include/ -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -L/home/ubuntu/bin/lib -ldl -lpthread -lLLVMAsmParser -lLLVMTableGen -lLLVMDebugInfo -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMJIT -lLLVMMCDisassembler -lLLVMMCParser -lLLVMInstrumentation -lLLVMInterpreter -lLLVMCodeGen -lLLVMipo -lLLVMVectorize -lLLVMScalarOpts -lLLVMInstCombine -lLLVMLinker -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMArchive -lLLVMBitReader -lLLVMBitWriter -lLLVMMCJIT -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport tutorial1.cpp
/tmp/tutorial1-oP8CUT.o: In function main': tutorial1.cpp:(.text+0x42): undefined reference to
llvm::outs()'
tutorial1.cpp:(.text+0x72): undefined reference to clang::TextDiagnosticPrinter::TextDiagnosticPrinter(llvm::raw_ostream&, clang::DiagnosticOptions const&, bool)' tutorial1.cpp:(.text+0xd7): undefined reference to
clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtrclang::DiagnosticIDs const&, clang::DiagnosticConsumer*, bool)'
tutorial1.cpp:(.text+0xf4): undefined reference to clang::LangOptions::LangOptions()' tutorial1.cpp:(.text+0x125): undefined reference to
clang::FileManager::FileManager(clang::FileSystemOptions const&)'
tutorial1.cpp:(.text+0x148): undefined reference to clang::SourceManager::SourceManager(clang::DiagnosticsEngine&, clang::FileManager&)' tutorial1.cpp:(.text+0x17c): undefined reference to
llvm::sys::getDefaultTargetTriple()'
tutorial1.cpp:(.text+0x1d0): undefined reference to clang::TargetInfo::CreateTargetInfo(clang::DiagnosticsEngine&, clang::TargetOptions&)' tutorial1.cpp:(.text+0x211): undefined reference to
clang::HeaderSearch::HeaderSearch(clang::FileManager&, clang::DiagnosticsEngine&, clang::LangOptions const&, clang::TargetInfo const*)'
tutorial1.cpp:(.text+0x225): undefined reference to clang::CompilerInstance::CompilerInstance()' tutorial1.cpp:(.text+0x288): undefined reference to
clang::Preprocessor::Preprocessor(clang::DiagnosticsEngine&, clang::LangOptions&, clang::TargetInfo const*, clang::SourceManager&, clang::HeaderSearch&, clang::ModuleLoader&, clang::IdentifierInfoLookup*, bool, bool, bool)'
tutorial1.cpp:(.text+0x2ad): undefined reference to clang::Preprocessor::~Preprocessor()' tutorial1.cpp:(.text+0x370): undefined reference to
clang::CompilerInstance::CompilerInstance()'
tutorial1.cpp:(.text+0x384): undefined reference to `clang::CompilerInstance::CompilerInstance()'
tutorial1.cpp:(.text+0x398): undefined reference to clang::HeaderSearch::~HeaderSearch()' tutorial1.cpp:(.text+0x3c5): undefined reference to
clang::HeaderSearch::HeaderSearch()'
tutorial1.cpp:(.text+0x3de): undefined reference to `clang::SourceManager::SourceManager()'
tutorial1.cpp:(.text+0x40b): undefined reference to clang::FileManager::~FileManager()' tutorial1.cpp:(.text+0x41f): undefined reference to
clang::SourceManager::SourceManager()'
tutorial1.cpp:(.text+0x44c): undefined reference to `clang::FileManager::FileManager()'
/tmp/tutorial1-oP8CUT.o: In function llvm::RefCountedBase<clang::DiagnosticIDs>::Release() const': tutorial1.cpp:(.text._ZNK4llvm14RefCountedBaseIN5clang13DiagnosticIDsEE7ReleaseEv[_ZNK4llvm14RefCountedBaseIN5clang13DiagnosticIDsEE7ReleaseEv]+0x88): undefined reference to
clang::DiagnosticIDs::~DiagnosticIDs()'
clang-3: error: linker command failed with exit code 1 (use -v to see invocation)
From: Ashok Nalkund <ashoknn at qualcomm.com> To: NY Knicks Fan <nyknicksfan92009 at yahoo.com> Cc: "llvmdev at cs.uiuc.edu" <llvmdev at cs.uiuc.edu> Sent: Tuesday, July 10, 2012 12:11 PM Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial
You will need to link to the LLVM/clang libraries. To get the correct flags, you can run: ./llvm-config --ldflags --libs
and use the flags reported.
On 7/10/2012 11:35 AM, NY Knicks Fan wrote:
OK. Thanks. I now get the following error (which appears to be a problem w/ the tutorial itself?):
$ /home/ubuntu/bin/bin/clang++ -I /home/ubuntu/bin/include/ -D_STDCLIMITMACROS -D_STDCCONSTANTMACROS tutorial1.cpp/tmp/tutorial1-LQ71fW.o: In function
main':_ _tutorial1.cpp:(.text+0x42): undefined reference to
llvm::outs()' tutorial1.cpp:(.text+0x72): undefined reference toclang::TextDiagnosticPrinter::TextDiagnosticPrinter(llvm::rawostream&,_ _clang::DiagnosticOptions const&, bool)'_ _tutorial1.cpp:(.text+0xd7): undefined reference to_ _
clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtrclang::DiagnosticIDs const&, clang::DiagnosticConsumer*, bool)' tutorial1.cpp:(.text+0xf4): undefined reference toclang::LangOptions::LangOptions()'_ _tutorial1.cpp:(.text+0x125): undefined reference to_ _
clang::FileManager::FileManager(clang::FileSystemOptions const&)' tutorial1.cpp:(.text+0x148): undefined reference toclang::SourceManager::SourceManager(clang::DiagnosticsEngine&,_ _clang::FileManager&)'_ _tutorial1.cpp:(.text+0x17c): undefined reference to_ _
llvm::sys::getDefaultTargetTriple()' tutorial1.cpp:(.text+0x1d0): undefined reference toclang::TargetInfo::CreateTargetInfo(clang::DiagnosticsEngine&,_ _clang::TargetOptions&)'_ _tutorial1.cpp:(.text+0x211): undefined reference to_ _
clang::HeaderSearch::HeaderSearch(clang::FileManager&, clang::DiagnosticsEngine&, clang::LangOptions const&, clang::TargetInfo const*)' tutorial1.cpp:(.text+0x225): undefined reference toclang::CompilerInstance::CompilerInstance()'_ _tutorial1.cpp:(.text+0x288): undefined reference to_ _
clang::Preprocessor::Preprocessor(clang::DiagnosticsEngine&, clang::LangOptions&, clang::TargetInfo const*, clang::SourceManager&, clang::HeaderSearch&, clang::ModuleLoader&, clang::IdentifierInfoLookup*, bool, bool, bool)' tutorial1.cpp:(.text+0x2ad): undefined reference toclang::Preprocessor::~Preprocessor()'_ _tutorial1.cpp:(.text+0x370): undefined reference to_ _
clang::CompilerInstance::~CompilerInstance()' tutorial1.cpp:(.text+0x384): undefined reference toclang::CompilerInstance::~CompilerInstance()'_ _tutorial1.cpp:(.text+0x398): undefined reference to_ _
clang::HeaderSearch::~HeaderSearch()' tutorial1.cpp:(.text+0x3c5): undefined reference toclang::HeaderSearch::~HeaderSearch()'_ _tutorial1.cpp:(.text+0x3de): undefined reference to_ _
clang::SourceManager::~SourceManager()' tutorial1.cpp:(.text+0x40b): undefined reference toclang::FileManager::~FileManager()'_ _tutorial1.cpp:(.text+0x41f): undefined reference to_ _
clang::SourceManager::~SourceManager()' tutorial1.cpp:(.text+0x44c): undefined reference toclang::FileManager::~FileManager()'_ _/tmp/tutorial1-LQ71fW.o: In function_ _
llvm::RefCountedBaseclang::DiagnosticIDs::Release() const': tutorial1.cpp:(.text.ZNK4llvm14RefCountedBaseIN5clang13DiagnosticIDsEE7ReleaseEv[ZNK4llvm14RefCountedBaseIN5clang13DiagnosticIDsEE7ReleaseEv]+0x88): undefined reference to `clang::DiagnosticIDs::~DiagnosticIDs()' clang-3: error: linker command failed with exit code 1 (use -v to see invocation)------------------------------------------------------------------------ From: Ashok Nalkund <ashoknn at qualcomm.com> To: NY Knicks Fan <nyknicksfan92009 at yahoo.com> Cc: "llvmdev at cs.uiuc.edu" <llvmdev at cs.uiuc.edu> Sent: Tuesday, July 10, 2012 11:28 AM Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial Add -D_STDCLIMITMACROS -D_STDCCONSTANTMACROS to your compilation flag. On 7/10/2012 11:23 AM, NY Knicks Fan wrote: > Hi Ashok, > > I created a new Ubuntu 12.04 virtual machine and followed directions > except that I know use your cmake command instead of configure, and I > got the error below. > > Any help is very much appreciated. > > > $ /home/ubuntu/bin/bin/clang++ -I /home/ubuntu/bin/include/ tutorial1.cpp > In file included from tutorial1.cpp:5: > In file included from > /home/ubuntu/bin/include/llvm/Support/rawostream.h:17: > In file included from /home/ubuntu/bin/include/llvm/ADT/StringRef.h:13: > In file included from > /home/ubuntu/bin/include/llvm/Support/typetraits.h:20: > /home/ubuntu/bin/include/llvm/Support/DataTypes.h:48:3: error: "Must _> #define STDCLIMITMACROS before #including > Support/DataTypes.h" _> # error "Must #define STDCLIMITMACROS before #including > Support/DataTypes.h" > ^ > /home/ubuntu/bin/include/llvm/Support/DataTypes.h:52:3: error: "Must _> #define STDCCONSTANTMACROS before " > "#including Support/DataTypes.h" _> # error "Must #define _STDCCONSTANTMACROS before " _ > ^ > In file included from tutorial1.cpp:6: > In file included from /home/ubuntu/bin/include/llvm/Support/Host.h:17: > In file included from /home/ubuntu/bin/include/llvm/ADT/StringMap.h🔞 > In file included from /home/ubuntu/bin/include/llvm/Support/Allocator.h🔞 > /home/ubuntu/bin/include/llvm/Support/MathExtras.h:38:24: error: use of > undeclared identifier 'INT64C' > return N >= 64 || (-(INT64C(1)<<(N-1)) <= x && x <_ _(INT64C(1)<<(N-1)));_ _> ^ > /home/ubuntu/bin/include/llvm/Support/MathExtras.h:38:56: error: use of > undeclared identifier 'INT64C' > return N >= 64 || (-(INT64C(1)<<(N-1)) <= x && x <_ _(INT64C(1)<<(N-1)));_ _> ^ > /home/ubuntu/bin/include/llvm/Support/MathExtras.h:64:26: error: use of > undeclared identifier 'UINT64C' > return N >= 64 || x < (UINT64C(1)<<N);_ _> ^ > /home/ubuntu/bin/include/llvm/Support/MathExtras.h:96:24: error: use of > undeclared identifier 'INT64C' > return N >= 64 || (-(INT64C(1)<<(N-1)) <= x && x <_ _(INT64C(1)<<(N-1)));_ _> ^ > /home/ubuntu/bin/include/llvm/Support/MathExtras.h:96:56: error: use of > undeclared identifier 'INT64C' > return N >= 64 || (-(INT64C(1)<<(N-1)) <= x && x <_ _(INT64C(1)<<(N-1)));_ _> ^ > 7 errors generated. > > > ------------------------------------------------------------------------ > From: Ashok Nalkund <ashoknn at qualcomm.com_ _<mailto:ashoknn at qualcomm.com>> > To: NY Knicks Fan <nyknicksfan92009 at yahoo.com_ _<mailto:nyknicksfan92009 at yahoo.com>> > Cc: "llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>" <llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>> > Sent: Tuesday, July 10, 2012 12:44 AM > Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial > > Looks like your make/install is incomplete wrt clang. I follow the > instuctions for checking out the sources but build using cmake instead > of configure: > > > cmake -G ""Unix Makefiles" -DLLVMTARGETSTOBUILD="X86" > -DCMAKEBUILDTYPE="Release" -DCMAKEINSTALLPREFIX="../bin" ../llvm > > make install > > This builds and installs llvm+clang in the bin directory one level above > llvm. I tried using configure earlier but had some problems. > > ashok > > > On 7/9/2012 5:32 PM, NY Knicks Fan wrote: > > Hi Ashok, > > > > As I mentioned in my earlier e-mail, my /usr/local/include does not have > > clang/ or clang-c/. > > > > I'm unable to do a make or make install in the Clang build directory. > > How do I fix this? > > > > Thanks! > > > > ------------------------------------------------------------------------ > > From: Ashok Nalkund <ashoknn at qualcomm.com_ _<mailto:ashoknn at qualcomm.com> > <mailto:ashoknn at qualcomm.com <mailto:ashoknn at qualcomm.com>>> > > To: NY Knicks Fan <nyknicksfan92009 at yahoo.com_ _<mailto:nyknicksfan92009 at yahoo.com> > <mailto:nyknicksfan92009 at yahoo.com_ _<mailto:nyknicksfan92009 at yahoo.com>>>; "llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu> > <mailto:llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>>" > > <llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu> <mailto:llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>>> > > Sent: Monday, July 9, 2012 3:30 PM > > Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial > > > > Use the -I/include . > > > > This directory /include should look something like: > > > > clang/ clang-c/ llvm/ llvm-c/ > > > > HTH > > ashok > > > > On 7/9/2012 3:15 PM, NY Knicks Fan wrote: > > > I downloaded the 3.1 LLVM and Clang sources. > > > > > > I followed the directions at: http://clang.llvm.org/getstarted.html > > > > > > I am able to use Clang to compile stuff, but I could already do that > > > with GCC. > > > > > > I'm trying to use Clang for parsing code, but I can't even get > started. > > > > > > Can you tell me how to "include the installed location ofclang/llvm > > > headers directories in your include path"? > > > > > > Thanks! > > > > > > > > > > ------------------------------------------------------------------------ > > > From: Ashok Nalkund <ashoknn at qualcomm.com_ _<mailto:ashoknn at qualcomm.com> > <mailto:ashoknn at qualcomm.com <mailto:ashoknn at qualcomm.com>> > > <mailto:ashoknn at qualcomm.com <mailto:ashoknn at qualcomm.com> <mailto:ashoknn at qualcomm.com <mailto:ashoknn at qualcomm.com>>>> > > > To: NY Knicks Fan <nyknicksfan92009 at yahoo.com_ _<mailto:nyknicksfan92009 at yahoo.com> > <mailto:nyknicksfan92009 at yahoo.com <mailto:nyknicksfan92009 at yahoo.com>> > > <mailto:nyknicksfan92009 at yahoo.com_ _<mailto:nyknicksfan92009 at yahoo.com> <mailto:nyknicksfan92009 at yahoo.com_ _<mailto:nyknicksfan92009 at yahoo.com>>>> > > > Cc: Chad Rosier <mcrosier at apple.com_ _<mailto:mcrosier at apple.com> <mailto:mcrosier at apple.com_ _<mailto:mcrosier at apple.com>> > <mailto:mcrosier at apple.com <mailto:mcrosier at apple.com> <mailto:mcrosier at apple.com <mailto:mcrosier at apple.com>>>>; > > "llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu> <mailto:llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>> > <mailto:llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu> <mailto:llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>>>" > > > <llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu> <mailto:llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>> > <mailto:llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu> <mailto:llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>>>> > > > Sent: Monday, July 9, 2012 2:39 PM > > > Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial > > > > > > On 7/9/2012 1:42 PM, Chad Rosier wrote: > > > > Have you looked here: http://clang.llvm.org/getstarted.html > > > > > > > > Chad > > > > > > > > > > > > On Jul 9, 2012, at 11:33 AM, NY Knicks Fan wrote: > > > > > > > >> I'm trying to do the tutorials at: > > > >> > > > >> https://github.com/loarabia/Clang-tu...i/TutorialOrig > > > >> <https://github.com/loarabia/Clang-tutorial/wiki/TutorialOrig> > > > >> > > > >> and I can't even do the first tutorial. I installed LLVM 3.1 and > > Clang > > > >> 3.1 and when I do: > > > >> > > > >> ~/loarabia-Clang-tutorial-3d79443$ clang++ tutorial1.cpp In file > > > >> included from tutorial1.cpp:5: In file included from > > > >> ./llvm/Support/rawostream.h:17: > > > >> ./llvm/Support/llvm/ADT/StringRef.h:13:10: fatal error: > > > >> 'llvm/Support/typetraits.h' file not found > > > >> > > > >> include "llvm/Support/typetraits.h" > > > >> ^ > > > >> 1 error generated. > > > >> > > > >> Do you know what I am doing wrong? I'm not sure what is the > best way > > > >> to handle this header file problem. > > > >> > > > >> I'm running Ubuntu 12.04. > > > >> > > > >> Thank you. > > > > > > Did you build it or "install" it from a package? If you build it, then > > > you need do a 'make install' and include the installed location of > > > clang/llvm headers directories in your include path. > > > > > > > > > > > > > > > > > > _> > > ________________________ > > > LLVM Developers mailing list > > > LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> <mailto:LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu>> > <mailto:LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> <mailto:LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu>>> > > http://llvm.cs.uiuc.edu <http://llvm.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/20120710/c61326f1/attachment.html>
- Previous message: [LLVMdev] Unable to do even basic Clang tutorial
- Next message: [LLVMdev] Unable to do even basic Clang tutorial
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]