help with llvm make system

Hi,

I'm working on a compiler for a small toy language and I'm using the
llvm sample project layout, i.e. the llvm make system.
I've got one library (lomo-core) which contains my parser and all that
stuff and one tool (lomoc) which is my compiler executable.
The tool declares the library as dependency using:
USEDLIBS = lomo-core

Now that I've started to add IR generation I declared the following
dependencies in the library makefile:
LINK_COMPONENTS := support system engine

This compiles and links the library without problems.

Unfortunately no matter what I do to the makefile of the compiler tool it won't compile. I always get errors in llvm/Support/Annotation.h that look like some type declarations are missing. Unfortunately my experience building C/C++ programs, especially with autoconf etc., is very limited if not to say non-existent. I would very much appreciate any hint on what I'm doing wrong.

Both makefiles also change the compiler and linker flags after including
the Makefile.common if that's of any relevance:
CXXFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib -lantlr3c

I'm using llvm 2.5 and building with gcc 3.4.5, gnu make 3.81 on, may
Stallman forgive me, windows xp using mingw/msys.
LLVM itself compiled without problems though so I'm quite sure it's
just me doing something wrong rather than my setup.

thanks,

Stefan

Stefan Oestreicher <stefan.oestreicher@deluxe-design.at> writes:

[snip]

Unfortunately no matter what I do to the makefile of the compiler tool
it won't compile. I always get errors in llvm/Support/Annotation.h that
look like some type declarations are missing. Unfortunately my
experience building C/C++ programs, especially with autoconf etc., is
very limited if not to say non-existent. I would very much appreciate
any hint on what I'm doing wrong.

It would be useful to see the first error messages and the compile
command (do make VERBOSE=1 in case it is hidden)

[snip]

Hi,

thank you for your response.

Óscar Fuentes schrieb:

It would be useful to see the first error messages and the compile
command (do make VERBOSE=1 in case it is hidden

the first few errors are:
f:/dev/projects/llvm-2.5/include/llvm/Support/Annotation.h:42: error: expected unqualified-id before numeric constant
f:/dev/projects/llvm-2.5/include/llvm/Support/Annotation.h: In constructor `llvm::AnnotationID::AnnotationID(unsigned int)':
f:/dev/projects/llvm-2.5/include/llvm/Support/Annotation.h:47: error: expected identifier before numeric constant
f:/dev/projects/llvm-2.5/include/llvm/Support/Annotation.h:47: error: expected `(' before numeric constant
f:/dev/projects/llvm-2.5/include/llvm/Support/Annotation.h:47: error: expected `{' before numeric constant
f:/dev/projects/llvm-2.5/include/llvm/Support/Annotation.h: In copy constructor `llvm::AnnotationID::AnnotationID(const llvm::AnnotationID&)':

and this is the compile command:

if g++ -I/f/dev/projects/llvm-2.5/include -I/f/dev/projects/lomo-antlr/include -I/f/dev/projects/lomo-antlr/tools/lomoc -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -g -fno-exceptions -I/usr/local/include -Woverloaded-virtual -pedantic -Wall -W -Wwrite-strings -Wno-long-long -Wunused -Wno-unused-parameter -c -MMD -MP -MF "/f/dev/projects/lomo-antlr/tools/lomoc/Debug/main.d.tmp" -MT "/f/dev/projects/lomo-antlr/tools/lomoc/Debug/main.lo" -MT "/f/dev/projects/lomo-antlr/tools/lomoc/Debug/main.o" -MT "/f/dev/projects/lomo-antlr/tools/lomoc/Debug/main.d" main.cc -o /f/dev/projects/lomo-antlr/tools/lomoc/Debug/main.o ; \
            then /bin/mv -f "/f/dev/projects/lomo-antlr/tools/lomoc/Debug/main.d.tmp" "/f/dev/projects/lomo-antlr/tools/lomoc/Debug/main.d"; else /bin/rm "/f/dev/projects/lomo-antlr/tools/lomoc/Debug/main.d.tmp"; exit 1; fi

Thanks,

Stefan

Hi,

I still have this problem. I now removed the library so the project just
consists of one tool but still no joy. The makefile looks like this:

--- snip ---
LEVEL=../..

TOOLNAME=lomoc
LINK_COMPONENTS := support system

include $(LEVEL)/Makefile.common

CFLAGS += -I/usr/local/include -x c++
CXXFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib -lantlr3c
--- /snip ---

I don't get why it compiles a library without problems but chokes at the
tool. I also tried to set the LLVMLIBS variable in all kinds of
variations but this didn't seem to have any effect at all.

I also tried to compile manually with
g++ -g tools/lomoc/main.cc `llvm-config --cxxflags --ldflags --libs
core` -o lomoc.exe
but this generates the same errors.

I'd very much appreciate it if someone could point me into the right
direction as I'm stumped and don't know what else to try.

thanks,

Stefan