[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
static linking if needed
From: |
Philipp Kraus |
Subject: |
static linking if needed |
Date: |
Sat, 9 Jun 2012 19:29:54 +0200 |
User-agent: |
Unison/2.1.7 |
Hello,
I'm using g++ on Linux and OSX to compile & link my program with libraries.
Within my build scripts I would create a "static" and "dynamic" linking option,
so I have got some problems with the correct linker flags on g++.
The dynamic linking works perfekt, I setup the libs with -l flag and
the library pathes,
but can I add a flag that all libs, that are referenced with -l flag
are linked static if the *.a
file exists? Something like "if the library with -l exists as a static
lib, use them, otherwise
use the dynamic *.so / *.dylib"?
I have try to use the --static and --as-needed option in a little example:
g++ --static --as-needed -O2 -pipe -Wall -o programm programm.o
and get the error
ld: library not found for -lcrt0.o
Thanks
Phil
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- static linking if needed,
Philipp Kraus <=