Error when building tutorial example

Hi all,

I'm a new user to LLVM. Not really sure if this is the correct place
to post, since there isn't really any other forums around. Anyway, the
issue I'm encountering is that, I was trying out the first tutorial
(http://llvm.org/docs/tutorial/JITTutorial1.html). I attempted to do
this in another folder that was copied from llvm/projects/sample. I
created a new folder called "tut1" in sample/tools/ folder, and the
following Makefile.

LEVEL=../..
TOOLNAME=tut1
LINK_COMPONENTS += --cxxflags
LINK_COMPONENTS += --ldflags
LINK_COMPONENTS += --libs
LINK_COMPONENTS += core
LINK_COMPONENTS += engine
include $(LEVEL)/Makefile.common

However, I'm getting the following error on gmake.
gmake[2]: *** No rule to make target `-I/usr/src/llvm/include', needed
by `/sample/Release/bin/tut1'. Stop.

I can get it to compile with the following command. But I want to make
sure I understand how the Makefiles integrate together.
g++ tut1.cpp `llvm-config --cxxflags --ldflags --libs core engine`

Really appreciate your help. Thank you.

-alex

Alexia Benington <alexbenington@gmail.com> writes:

Hi all,

I'm a new user to LLVM. Not really sure if this is the correct place
to post, since there isn't really any other forums around. Anyway, the
issue I'm encountering is that, I was trying out the first tutorial
(http://llvm.org/docs/tutorial/JITTutorial1.html). I attempted to do
this in another folder that was copied from llvm/projects/sample. I
created a new folder called "tut1" in sample/tools/ folder, and the
following Makefile.

LEVEL=../..
TOOLNAME=tut1
LINK_COMPONENTS += --cxxflags
LINK_COMPONENTS += --ldflags
LINK_COMPONENTS += --libs

Remove the previous three LINK_COMPONENTS lines. LINK_COMPONENTS is for
names of LLVM components (roughly equivalent to libraries) that should
be linked to your project. It is equivalent to the names you put after
--libs on your invocation of llvm-config below.

LINK_COMPONENTS += core
LINK_COMPONENTS += engine

you can fuse the previous two lines on a single one:

LINK_COMPONENTS += core engine

I've been sitting on a patch that adds all the kaleidoscope tests to
the llvm tree, instead of just chapter 7. I'll look into pushing it
out tomorrow.

Hi Alexia,

I just committed this patch, and now the C++ kaleidoscope examples
will be compiled with the rest of llvm. You can find them in
examples/Kaleidoscope, and the executables under
$BUILDMODE/examples/Kaleidoscope-Ch*.