Groups
Groups

[LLVMdev] Unable to do even basic Clang tutorial

829 views
Skip to first unread message

NY Knicks Fan

unread,
Jul 9, 2012, 10:50:47 AM7/9/12
to llv...@cs.uiuc.edu
I'm trying to do the tutorials at:

https://github.com/loarabia/Clang-tu...i/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.

Duncan Sands

unread,
Jul 9, 2012, 1:07:31 PM7/9/12
to llv...@cs.uiuc.edu
Hi,

On 09/07/12 16:50, 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

the tutorial seems to use LLVM 3.0 and probably hasn't been updated to LLVM 3.1
yet.

Ciao, Duncan.

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.
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>


_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

NY Knicks Fan

unread,
Jul 9, 2012, 2:33:57 PM7/9/12
to llv...@cs.uiuc.edu
and I can't even do the first tutorial. I installed LLVM 3.1 and Clang 3.1 and when I do:

Chad Rosier

unread,
Jul 9, 2012, 4:42:28 PM7/9/12
to NY Knicks Fan, llv...@cs.uiuc.edu

 Chad


Ashok Nalkund

unread,
Jul 9, 2012, 5:39:54 PM7/9/12
to NY Knicks Fan, llv...@cs.uiuc.edu
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.

NY Knicks Fan

unread,
Jul 9, 2012, 6:15:42 PM7/9/12
to llv...@cs.uiuc.edu
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 of  clang/llvm headers directories in your include path"?

Thanks!



From: Ashok Nalkund <ash...@qualcomm.com>
To: NY Knicks Fan <nyknicks...@yahoo.com>
Cc: Chad Rosier <mcro...@apple.com>; "llv...@cs.uiuc.edu" <llv...@cs.uiuc.edu>
Sent: Monday, July 9, 2012 2:39 PM
Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial

Ashok Nalkund

unread,
Jul 9, 2012, 6:30:51 PM7/9/12
to NY Knicks Fan, llv...@cs.uiuc.edu
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 <ash...@qualcomm.com>
> *To:* NY Knicks Fan <nyknicks...@yahoo.com>
> *Cc:* Chad Rosier <mcro...@apple.com>; "llv...@cs.uiuc.edu"
> <llv...@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.
>
>
>
>
>
>

NY Knicks Fan

unread,
Jul 9, 2012, 6:52:23 PM7/9/12
to Ashok Nalkund, llv...@cs.uiuc.edu
Hi Ashok,

The documentation suggests that I put clang inside of llvm/tools and so I have two separate include directories.  I tried both of them and neither worked:

$ clang++ -I llvm/include tutorial1.cpp 
In file included from tutorial1.cpp:5:
In file included from llvm/include/llvm/Support/raw_ostream.h:17:
In file included from llvm/include/llvm/ADT/StringRef.h:13:
llvm/include/llvm/Support/type_traits.h:20:10: fatal error: 'llvm/Support/DataTypes.h' file not found
#include "llvm/Support/DataTypes.h"
         ^
1 error generated.

$ clang++ -I llvm/tools/clang/include/ tutorial1.cpp 
tutorial1.cpp:5:10: fatal error: 'llvm/Support/raw_ostream.h' file not found
#include "llvm/Support/raw_ostream.h"
         ^
1 error generated.

Any help you can provide is very much appreciated.


From: Ashok Nalkund <ash...@qualcomm.com>
To: NY Knicks Fan <nyknicks...@yahoo.com>; "llv...@cs.uiuc.edu" <llv...@cs.uiuc.edu>
Sent: Monday, July 9, 2012 3:30 PM
Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial

Ashok Nalkund

unread,
Jul 9, 2012, 7:00:08 PM7/9/12
to NY Knicks Fan, llv...@cs.uiuc.edu
The "make install" should collect everything into your <install path>.
The <install path> will then have bin, lib and include dirs.

On 7/9/2012 3:52 PM, NY Knicks Fan wrote:
> Hi Ashok,
>
> The documentation suggests that I put clang inside of llvm/tools and so
> I have two separate include directories. I tried both of them and
> neither worked:
>
> $ clang++ -I llvm/include tutorial1.cpp
> In file included from tutorial1.cpp:5:
> In file included from llvm/include/llvm/Support/raw_ostream.h:17:
> In file included from llvm/include/llvm/ADT/StringRef.h:13:
> llvm/include/llvm/Support/type_traits.h:20:10: fatal error:
> 'llvm/Support/DataTypes.h' file not found
> #include "llvm/Support/DataTypes.h"
> ^
> 1 error generated.
>
> $ clang++ -I llvm/tools/clang/include/ tutorial1.cpp
> tutorial1.cpp:5:10: fatal error: 'llvm/Support/raw_ostream.h' file not found
> #include "llvm/Support/raw_ostream.h"
> ^
> 1 error generated.
>
> Any help you can provide is very much appreciated.
>
> ------------------------------------------------------------------------
> *From:* Ashok Nalkund <ash...@qualcomm.com>
> *To:* NY Knicks Fan <nyknicks...@yahoo.com>; "llv...@cs.uiuc.edu"
> <llv...@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 <ash...@qualcomm.com
> <mailto:ash...@qualcomm.com>>
> > *To:* NY Knicks Fan <nyknicks...@yahoo.com
> <mailto:nyknicks...@yahoo.com>>
> > *Cc:* Chad Rosier <mcro...@apple.com <mailto:mcro...@apple.com>>;
> "llv...@cs.uiuc.edu <mailto:llv...@cs.uiuc.edu>"
> > <llv...@cs.uiuc.edu <mailto:llv...@cs.uiuc.edu>>
> > LLV...@cs.uiuc.edu <mailto:LLV...@cs.uiuc.edu>
> http://llvm.cs.uiuc.edu <http://llvm.cs.uiuc.edu/>
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Chad Rosier

unread,
Jul 9, 2012, 7:09:35 PM7/9/12
to NY Knicks Fan, llv...@cs.uiuc.edu

On Jul 9, 2012, at 4:00 PM, Ashok Nalkund wrote:

> The "make install" should collect everything into your <install path>.
> The <install path> will then have bin, lib and include dirs.

And you should be able to specify the install path with the --prefix option when configuring. I believe the default is /usr/local (see: configure --help to verify).

Chad

NY Knicks Fan

unread,
Jul 9, 2012, 7:16:12 PM7/9/12
to Ashok Nalkund, llv...@cs.uiuc.edu
I followed the directions at http://clang.llvm.org/get_started.html and after make, I did make install.

The only thing I didn't do though was make at the clang directory as the directions said clang would automatically get built.

When I do make in the clang directory, I get:

~/llvm/tools/clang$ make
../../Makefile.common:61: ../../Makefile.config: No such file or directory
../../Makefile.common:69: /Makefile.rules: No such file or directory
make: *** No rule to make target `/Makefile.rules'.  Stop.

Do you think that the problem is with the distro I chose?  I'm using Ubuntu 12.04.


From: Ashok Nalkund <ash...@qualcomm.com>
To: NY Knicks Fan <nyknicks...@yahoo.com>
Cc: "llv...@cs.uiuc.edu" <llv...@cs.uiuc.edu>
Sent: Monday, July 9, 2012 4:00 PM
Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial

NY Knicks Fan

unread,
Jul 9, 2012, 7:19:50 PM7/9/12
to Chad Rosier, llv...@cs.uiuc.edu
$ ls /usr/local/include/
llvm  llvm-c

Does this mean Clang wasn't installed properly on my Ubuntu machine?

I did a make install in my ~/build directory and I thought this would install Clang.  At least there is a /usr/bin/clang.

When I do make in my ~/build/tools/clang directory, I get:

~/build/tools/clang$ make
make[1]: Entering directory `/home/username/build/tools/clang/utils/TableGen'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/username/build/tools/clang/utils/TableGen'
make: *** [all] Error 1



From: Chad Rosier <mcro...@apple.com>

To: NY Knicks Fan <nyknicks...@yahoo.com>
Cc: Ashok Nalkund <ash...@qualcomm.com>; llv...@cs.uiuc.edu
Sent: Monday, July 9, 2012 4:09 PM
Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial

NY Knicks Fan

unread,
Jul 9, 2012, 8:32:28 PM7/9/12
to Ashok Nalkund, llv...@cs.uiuc.edu
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 <ash...@qualcomm.com>
To: NY Knicks Fan <nyknicks...@yahoo.com>; "llv...@cs.uiuc.edu" <llv...@cs.uiuc.edu>
Sent: Monday, July 9, 2012 3:30 PM
Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial

NY Knicks Fan

unread,
Jul 9, 2012, 6:09:12 PM7/9/12
to Ashok Nalkund, llv...@cs.uiuc.edu
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 of  clang/llvm headers directories in your include path"?

Thanks!



From: Ashok Nalkund <ash...@qualcomm.com>
To: NY Knicks Fan <nyknicks...@yahoo.com>
Cc: Chad Rosier <mcro...@apple.com>; "llv...@cs.uiuc.edu" <llv...@cs.uiuc.edu>
Sent: Monday, July 9, 2012 2:39 PM

Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial

Ashok Nalkund

unread,
Jul 10, 2012, 3:44:42 AM7/10/12
to NY Knicks Fan, llv...@cs.uiuc.edu
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 <ash...@qualcomm.com>
> *To:* NY Knicks Fan <nyknicks...@yahoo.com>; "llv...@cs.uiuc.edu"
> <llv...@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 <ash...@qualcomm.com
> <mailto:ash...@qualcomm.com>>
> > *To:* NY Knicks Fan <nyknicks...@yahoo.com
> <mailto:nyknicks...@yahoo.com>>
> > *Cc:* Chad Rosier <mcro...@apple.com <mailto:mcro...@apple.com>>;
> "llv...@cs.uiuc.edu <mailto:llv...@cs.uiuc.edu>"
> > <llv...@cs.uiuc.edu <mailto:llv...@cs.uiuc.edu>>

NY Knicks Fan

unread,
Jul 10, 2012, 2:23:21 PM7/10/12
to Ashok Nalkund, llv...@cs.uiuc.edu
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 <ash...@qualcomm.com>
To: NY Knicks Fan <nyknicks...@yahoo.com>
Cc: "llv...@cs.uiuc.edu" <llv...@cs.uiuc.edu>
Sent: Tuesday, July 10, 2012 12:44 AM
Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial

Ashok Nalkund

unread,
Jul 10, 2012, 2:28:27 PM7/10/12
to NY Knicks Fan, llv...@cs.uiuc.edu
Add -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS to your compilation flag.
> ------------------------------------------------------------------------
> *From:* Ashok Nalkund <ash...@qualcomm.com>
> *To:* NY Knicks Fan <nyknicks...@yahoo.com>
> *Cc:* "llv...@cs.uiuc.edu" <llv...@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 <ash...@qualcomm.com
> <mailto:ash...@qualcomm.com>>
> > *To:* NY Knicks Fan <nyknicks...@yahoo.com
> <mailto:nyknicks...@yahoo.com>>; "llv...@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 <ash...@qualcomm.com
> <mailto:ash...@qualcomm.com>
> > <mailto:ash...@qualcomm.com <mailto:ash...@qualcomm.com>>>
> > > *To:* NY Knicks Fan <nyknicks...@yahoo.com
> <mailto:nyknicks...@yahoo.com>
> > <mailto:nyknicks...@yahoo.com <mailto:nyknicks...@yahoo.com>>>
> > > *Cc:* Chad Rosier <mcro...@apple.com <mailto:mcro...@apple.com>
> <mailto:mcro...@apple.com <mailto:mcro...@apple.com>>>;
> > "llv...@cs.uiuc.edu <mailto:llv...@cs.uiuc.edu>
> <mailto:llv...@cs.uiuc.edu <mailto:llv...@cs.uiuc.edu>>"
> > > <llv...@cs.uiuc.edu <mailto:llv...@cs.uiuc.edu>
> <mailto:llv...@cs.uiuc.edu <mailto:llv...@cs.uiuc.edu>>>
> <mailto:LLV...@cs.uiuc.edu <mailto:LLV...@cs.uiuc.edu>>
> > http://llvm.cs.uiuc.edu <http://llvm.cs.uiuc.edu/>
> > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> > >
> >
> >
> >
>
>
>

_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

NY Knicks Fan

unread,
Jul 10, 2012, 2:35:31 PM7/10/12
to Ashok Nalkund, llv...@cs.uiuc.edu
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__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS tutorial1.cpp/tmp/tutorial1-LQ71fW.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::IntrusiveRefCntPtr<clang::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-LQ71fW.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 <ash...@qualcomm.com>
To: NY Knicks Fan <nyknicks...@yahoo.com>
Cc: "llv...@cs.uiuc.edu" <llv...@cs.uiuc.edu>
Sent: Tuesday, July 10, 2012 11:28 AM
Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial

Óscar Fuentes

unread,
Jul 10, 2012, 2:58:57 PM7/10/12
to llv...@cs.uiuc.edu
NY Knicks Fan <nyknicks...@yahoo.com> writes:

> OK.  Thanks.  I now get the following error (which appears to be a
> problem w/ the tutorial itself?):

Uhmmm... sorry if I sound blunt, but you are trying to use a C++
framework for doing a complex task when it is obvious that you are not
familiar enough with the usage of a C++ toolkit (compiler+linker).

In my humble opinion, you should learn well how C++ development works
(and learn C++ well too). Then you can start using the Clang libraries
fixing yourself all those problems you found so far in no time.

_______________________________________________
LLVM Developers mailing list

LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Ashok Nalkund

unread,
Jul 10, 2012, 3:11:06 PM7/10/12
to NY Knicks Fan, llv...@cs.uiuc.edu
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.
> ------------------------------------------------------------------------
> *From:* Ashok Nalkund <ash...@qualcomm.com>
> *To:* NY Knicks Fan <nyknicks...@yahoo.com>
> *Cc:* "llv...@cs.uiuc.edu" <llv...@cs.uiuc.edu>
> *Sent:* Tuesday, July 10, 2012 11:28 AM
> *Subject:* Re: [LLVMdev] Unable to do even basic Clang tutorial
>
> <mailto:ash...@qualcomm.com>>
> > *To:* NY Knicks Fan <nyknicks...@yahoo.com
> <mailto:nyknicks...@yahoo.com>>
> > *Cc:* "llv...@cs.uiuc.edu <mailto:llv...@cs.uiuc.edu>"
> <llv...@cs.uiuc.edu <mailto:llv...@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 <ash...@qualcomm.com
> <mailto:ash...@qualcomm.com>
> > <mailto:ash...@qualcomm.com <mailto:ash...@qualcomm.com>>>
> > > *To:* NY Knicks Fan <nyknicks...@yahoo.com
> <mailto:nyknicks...@yahoo.com>
> > <mailto:nyknicks...@yahoo.com
> <mailto:nyknicks...@yahoo.com>>>; "llv...@cs.uiuc.edu
> <http://llvm.cs.uiuc.edu/>
> > > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> > > >
> > >
> > >
> > >
> >
> >
> >
>
>
>

_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

NY Knicks Fan

unread,
Jul 10, 2012, 4:22:20 PM7/10/12
to Ashok Nalkund, llv...@cs.uiuc.edu
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::IntrusiveRefCntPtr<clang::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 <ash...@qualcomm.com>
To: NY Knicks Fan <nyknicks...@yahoo.com>
Cc: "llv...@cs.uiuc.edu" <llv...@cs.uiuc.edu>
Sent: Tuesday, July 10, 2012 12:11 PM
Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial

Ashok Nalkund

unread,
Jul 10, 2012, 4:25:41 PM7/10/12
to NY Knicks Fan, llv...@cs.uiuc.edu
You need to link in the libclang* as well.

On 7/10/2012 1:22 PM, NY Knicks Fan wrote:
> Hi Ashok,
>
> ------------------------------------------------------------------------
> *From:* Ashok Nalkund <ash...@qualcomm.com>
> *To:* NY Knicks Fan <nyknicks...@yahoo.com>
> *Cc:* "llv...@cs.uiuc.edu" <llv...@cs.uiuc.edu>
> *Sent:* Tuesday, July 10, 2012 12:11 PM
> *Subject:* Re: [LLVMdev] Unable to do even basic Clang tutorial
>
> > <mailto:ash...@qualcomm.com <mailto:ash...@qualcomm.com>>>
> > > *To:* NY Knicks Fan <nyknicks...@yahoo.com
> <mailto:nyknicks...@yahoo.com>
> > <mailto:nyknicks...@yahoo.com <mailto:nyknicks...@yahoo.com>>>
> > > *Cc:* "llv...@cs.uiuc.edu <mailto:llv...@cs.uiuc.edu>
> > > <mailto:ash...@qualcomm.com <mailto:ash...@qualcomm.com>
> <mailto:ash...@qualcomm.com <mailto:ash...@qualcomm.com>>>>
> > > > *To:* NY Knicks Fan <nyknicks...@yahoo.com
> <mailto:nyknicks...@yahoo.com>
> > <mailto:nyknicks...@yahoo.com <mailto:nyknicks...@yahoo.com>>
> > > <mailto:nyknicks...@yahoo.com <mailto:nyknicks...@yahoo.com>
> > <mailto:nyknicks...@yahoo.com
> <mailto:nyknicks...@yahoo.com>>>>; "llv...@cs.uiuc.edu
> > <http://llvm.cs.uiuc.edu/>
> > > > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
>
>
>

_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

NY Knicks Fan

unread,
Jul 10, 2012, 5:03:44 PM7/10/12
to Ashok Nalkund, llv...@cs.uiuc.edu
Thanks a lot Ashok for all your help!

I finally got it to work and successfully used Clang to parse a small program.

I've been able to do the first two tutorial programs and I can't believe how long it took for me to do this.

I am hoping that dealing with Clang AST will be easier than dealing with GCC generic trees.

Thanks again.



From: Ashok Nalkund <ash...@qualcomm.com>
To: NY Knicks Fan <nyknicks...@yahoo.com>
Cc: "llv...@cs.uiuc.edu" <llv...@cs.uiuc.edu>
Sent: Tuesday, July 10, 2012 1:25 PM
Subject: Re: [LLVMdev] Unable to do even basic Clang tutorial

Sean Silva

unread,
Jul 10, 2012, 5:16:46 PM7/10/12
to Ashok Nalkund, llv...@cs.uiuc.edu
Ugh, we direly need a `clang-config`...

--Sean Silva
Reply all
Reply to author
Forward
0 new messages
Search
Clear search
Close search
Google apps
Main menu