This is the mail archive of the
mailing list for the GCC project.
Re: Using --disable-shared to build non-apple gcc on darwin
- From: Andrew Pinski <apinski at apple dot com>
- To: "Peter O'Gorman" <pogma at opendarwin dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 7 Sep 2004 12:28:41 -0700
- Subject: Re: Using --disable-shared to build non-apple gcc on darwin
- References: <413DB0CC.email@example.com>
On Sep 7, 2004, at 5:59 AM, Peter O'Gorman wrote:
First, I'd like to apologize if this is a silly question, sorry...
When gcc is built having been configured --disable-shared, it builds
libgcc, libstdc++ etc without any pic flags, so on darwin, the fortran
libraries, for example, contain common symbols (gcc-3.4.1) and cannot
be used as input to ld when building a shared library (.dylib). Also,
in the FSF gcc (not the apple branch), there's no comcept of private
external symbols, so generating multiple shared libraries (obviously
not fortran ones :-p) and then using these to create a program will
likely give you errors about multiple definitions of symbols (these
symbols having made their way into many shared libs by virtue of being
global symbols in libgcc).
First -fPIC is not needed on Darwin to produce shared libraries as it
is PIC by default. Second yes we do have the concept of private
external for Darwin too. Look at the attribute visibility for how
to use "private external" symbols, I cannot remember if this made it
into 3.4.0 or not. But really you should not be using --disable-shared
without using --with-pic if you want to use shared libraries.
Also you should not be using --diable-shared at all because it is not
the tested way of compiling the compiler.
My questions is, is this by design? Should we not expect to be able to
build working shared libraries with a compiler built --disable-shared?
Yes this is by design, see above about --with-pic but I think that only
works with libtool based projects.