How do you Build LLVM Statically Linked?

Everyone,

I would like to build the LLVM toolchain and the GCC front end as
statically linked executables, but I do not see a configure
option to set this. A quick check of the FAQ and build documents
comes up empty. Is there a linker switch setting or environment
variable for the Makefile?

Dave Koogler

Hi,

I think there is a

./configure --enable-static

switch - have you tried that?

Anders Johnsen

David J.A. Koogler wrote:

Everyone,

I would like to build the LLVM toolchain and the GCC front end as
statically linked executables, but I do not see a configure
option to set this. A quick check of the FAQ and build documents
comes up empty. Is there a linker switch setting or environment
variable for the Makefile?
  

The --disable-shared option to configure should work (like it does for most configure-scripted projects).

Kenneth Boyd

Anders Johnsen wrote:

I think there is a

./configure --enable-static

switch - have you tried that?

Yes, but that only seems to force building static libraries, not
statically linked tools.

Kenneth Boyd wrote:

> The --disable-shared option to configure should work (like it does for
> most configure-scripted projects).

No, I tried that and still got dynamically linked tools. It did not work
for GCC either. I got the GCC tools statically linked by defining
LD_FLAGS on the make invocation:

     make LD_FLAGS = \"-static\"

Searching through the LLVM makefiles, I saw a make variable called LD.Flags but alas trying to set that externally like I did for GCC
did not have the desired affect. All of the tools were still linked
dynamically.

So at least I have statically linked GCC front ends which makes it
easier to run the compiler on some of my target processors which do
no have dynamic libraries, but I would like to be able to run the
whole LLVM suite.

Dave Koogler

David J.A. Koogler wrote:

Anders Johnsen wrote:

I think there is a

./configure --enable-static

switch - have you tried that?
    
Yes, but that only seems to force building static libraries, not
statically linked tools.
  

./configure --help documents that --enable-static is on by default. Is that actually correct for LLVM?

Kenneth Boyd wrote:

> The --disable-shared option to configure should work (like it does for
> most configure-scripted projects).

No, I tried that and still got dynamically linked tools.

Ok. This is how I force statically linked tools on the MingW32 platform.

Kenneth Boyd