Using --disable-shared to build non-apple gcc on darwin
Andrew Pinski
apinski@apple.com
Tue Sep 7 19:28:00 GMT 2004
On Sep 7, 2004, at 5:59 AM, Peter O'Gorman wrote:
> Hi,
> 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.
Thanks,
Andrew Pinski
More information about the Gcc
mailing list