Help setting up a llvm project

First I'd like to let you know I've started working on porting gcjx to llvm.
Some other intrested people may help but I've just started the project.

My first question is I'm porting gcjx over to use the llvm build
system I've successfully created a number of libraries but gcjx uses a
number of sub directories for its source and I'd like the .o files for
all of them to become one library.

I can't seem to find a way to do that llvm seems to want all sources
in one directory.

If I do something like

SOURCES += aot/aotclass.cc aot/aotfactory.cc aot/mangle.cc

I get the follwing error
GC heuristics: --param ggc-min-expand=81 --param ggc-min-heapsize=95905
aot/aotclass.cc:301: fatal error: opening dependency file
/media/WDC_Combo/home/memmel/GTK2.7/Qspin/Developer/Source/Languages/Core/Source/core/lib/compiler/gcjx/Debug/aot/aotclass.CXXd:
No such file or directory
compilation terminated.

and trying to get them to had via LIBS as one big object file seems to
fail also.

Mike

Hi Mike,

Sounds like an interesting project. Here's some ideas for you on the LLVM Makefile System.

If you haven't, I *strongly* suggest you read the makefile and project documentation (docs/MakefileGuide.html and docs/Projects.html). There is much information there that you need to understand.

LLVM is set up so that a single directory builds a single result. Since your source code is fairly large, I would suggest that you allow LLVM to recurse into subdirectories and build archive libraries for each of those directories. You can then use libtool to assemble a finale archive, object or shared object from the compiled archives. I don't believe LLVM has this capability built into its rules, but we could add it once you've figured out the details.

Note that libtool can automatically rip apart archives and recombine them into larger libraries. Read up on libtool for further information.

Reid.

Mike Emmel wrote:

First I'd like to let you know I've started working on porting gcjx to llvm.
Some other intrested people may help but I've just started the project.

My first question is I'm porting gcjx over to use the llvm build
system I've successfully created a number of libraries but gcjx uses a
number of sub directories for its source and I'd like the .o files for
all of them to become one library.

I can't seem to find a way to do that llvm seems to want all sources
in one directory.

If I do something like

SOURCES += aot/aotclass.cc aot/aotfactory.cc aot/mangle.cc

I get the follwing error
GC heuristics: --param ggc-min-expand=81 --param ggc-min-heapsize=95905
aot/aotclass.cc:301: fatal error: opening dependency file
/media/WDC_Combo/home/memmel/GTK2.7/Qspin/Developer/Source/Languages/Core/Source/core/lib/compiler/gcjx/Debug/aot/aotclass.CXXd:
No such file or directory
compilation terminated.

This is telling you that it couldn't find the dependency file for C++. That's because there's no "aot" directory in the Debug directory (where the dependency files are normally placed). That's probably a bug in the makefiles, but your usage is a little unusual too (i.e. the design parameters of the makefile system didn't presume your usage scenario).

and trying to get them to had via LIBS as one big object file seems to
fail also.

I don't understand "trying to get them to had via LIBS". As I said earlier, your best bet is to just build each sub-directory individually and then reassemble a larger library from the component archives built in other directories.

Hi Mike,

Sounds like an interesting project. Here's some ideas for you on the LLVM
Makefile System.

If you haven't, I *strongly* suggest you read the makefile and project
documentation (docs/MakefileGuide.html and docs/Projects.html). There is much
information there that you need to understand.

Yes I read it and looked with intrest at modifying the read only variables :slight_smile:

LLVM is set up so that a single directory builds a single result. Since your
source code is fairly large, I would suggest that you allow LLVM to recurse
into subdirectories and build archive libraries for each of those directories.
You can then use libtool to assemble a finale archive, object or shared object
from the compiled archives. I don't believe LLVM has this capability built into
its rules, but we could add it once you've figured out the details.

Note that libtool can automatically rip apart archives and recombine them into
larger libraries. Read up on libtool for further information.

Okay I understand I need to add one more rule. Also I'd like the
intermediate object files to not be but in the main build but I can
fix that. Seems I need one more libtool rule to do the collection.

Reid.

Mike Emmel wrote:
> First I'd like to let you know I've started working on porting gcjx to llvm.
> Some other intrested people may help but I've just started the project.
>
> My first question is I'm porting gcjx over to use the llvm build
> system I've successfully created a number of libraries but gcjx uses a
> number of sub directories for its source and I'd like the .o files for
> all of them to become one library.
>
> I can't seem to find a way to do that llvm seems to want all sources
> in one directory.
>
> If I do something like
>
> SOURCES += aot/aotclass.cc aot/aotfactory.cc aot/mangle.cc
>
> I get the follwing error
> GC heuristics: --param ggc-min-expand=81 --param ggc-min-heapsize=95905
> aot/aotclass.cc:301: fatal error: opening dependency file
> /media/WDC_Combo/home/memmel/GTK2.7/Qspin/Developer/Source/Languages/Core/Source/core/lib/compiler/gcjx/Debug/aot/aotclass.CXXd:
> No such file or directory
> compilation terminated.

This is telling you that it couldn't find the dependency file for C++. That's
because there's no "aot" directory in the Debug directory (where the dependency
files are normally placed). That's probably a bug in the makefiles, but your
usage is a little unusual too (i.e. the design parameters of the makefile
system didn't presume your usage scenario).

Let me see about adding a rule this was probably misuse of the build system.
I'm fine with one object file per directory.

> and trying to get them to had via LIBS as one big object file seems to
> fail also.

I don't understand "trying to get them to had via LIBS". As I said earlier,
your best bet is to just build each sub-directory individually and then
reassemble a larger library from the component archives built in other directories.

A bit of a mushed sentence you answered it already I want one archive
from several directories.

Looks like I need two things to import larger projects.

A rule to collect the object files from several directories into one main file
potentially a rule to keep any intermediate libraries out of the main
library build area.

Thanks for your help.

Mike