[LLVMdev] Unable to do even basic Clang tutorial

Ashok Nalkund ashoknn at qualcomm.com
Tue Jul 10 11:28:27 PDT 2012


Add -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS 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/raw_ostream.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/type_traits.h:20:
> /home/ubuntu/bin/include/llvm/Support/DataTypes.h:48:3: error: "Must
> #define __STDC_LIMIT_MACROS before #including
>        Support/DataTypes.h"
> # error "Must #define __STDC_LIMIT_MACROS before #including
> Support/DataTypes.h"
>    ^
> /home/ubuntu/bin/include/llvm/Support/DataTypes.h:52:3: error: "Must
> #define __STDC_CONSTANT_MACROS before "
>    "#including Support/DataTypes.h"
> # error "Must #define __STDC_CONSTANT_MACROS 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:18:
> In file included from /home/ubuntu/bin/include/llvm/Support/Allocator.h:18:
> /home/ubuntu/bin/include/llvm/Support/MathExtras.h:38:24: error: use of
> undeclared identifier 'INT64_C'
>    return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));
>                         ^
> /home/ubuntu/bin/include/llvm/Support/MathExtras.h:38:56: error: use of
> undeclared identifier 'INT64_C'
>    return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));
>                                                         ^
> /home/ubuntu/bin/include/llvm/Support/MathExtras.h:64:26: error: use of
> undeclared identifier 'UINT64_C'
>    return N >= 64 || x < (UINT64_C(1)<<N);
>                           ^
> /home/ubuntu/bin/include/llvm/Support/MathExtras.h:96:24: error: use of
> undeclared identifier 'INT64_C'
>    return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));
>                         ^
> /home/ubuntu/bin/include/llvm/Support/MathExtras.h:96:56: error: use of
> undeclared identifier 'INT64_C'
>    return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));
>                                                         ^
> 7 errors generated.
>
>
> ------------------------------------------------------------------------
> *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: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" -DLLVM_TARGETS_TO_BUILD="X86"
> -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="../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>>
>  > *To:* NY Knicks Fan <nyknicksfan92009 at yahoo.com
> <mailto:nyknicksfan92009 at yahoo.com>>; "llvmdev at cs.uiuc.edu
> <mailto:llvmdev at cs.uiuc.edu>"
>  > <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<install path>/include .
>  >
>  > This directory <install path>/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/get_started.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>>>
>  >  > *To:* NY Knicks Fan <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>>>;
>  > "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 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/get_started.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/raw_ostream.h:17:
>  >  >  >> ./llvm/Support/llvm/ADT/StringRef.h:13:10: fatal error:
>  >  >  >> 'llvm/Support/type_traits.h' file not found
>  >  >  >>
>  >  >  >> include "llvm/Support/type_traits.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>>
>  > http://llvm.cs.uiuc.edu <http://llvm.cs.uiuc.edu/>
>  >  > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>  >  >
>  >
>  >
>  >
>
>
>




More information about the llvm-dev mailing list