This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: problems building shared lib with 1.0.3a on Solaris


These problems seems to be related to building the shared lib with g++ 
instead of gcc.  Symbols are defined in both libgcc.a and in
libstdc++.a or .so and this creates the linking conflict.

This doesn't seem to happen on linux (...because the linux loader is
smarter...?)

>>>>> Steinar Bang <sb@metis.no>:

> Platform: egcs-1.0.3a, Solaris 2.5
> When attempting to build a shared library, I get the error messages
> reported below.

> Egcs configured with: ./configure --prefix=~sb/apps --enable-shared
> Compiled with: gmake bootstrap LANGUAGES="c c++"
> Installed with: gmake install LANGUAGES="c c++"

> % env | grep LD
> LD_LIBRARY_PATH=/giga/sb/gcc/2x/lib:/giga/sb/apps/lib:/giga/mws/apps/qt/lib:/usr/dt/lib:/usr/openwin/lib:/opt/ODI/OS4.0.2/sunpro/lib:/opt/pub/lib:/opt/orbplus/lib:/opt/jdk1.1.1/lib/sparc/green_threads

> I had the same results with 1.0.2 configured with --enable-shared, and 
> 1.0.2 not configured with --enable-shared.  

> The problems looks like something to do with the standard exceptions,
> and I guessed at the problems being related to me trying to include
> files compiled without -fPIC into a shared library.  That's why I
> tried recompiling 1.0.2 with --enable-shared, and then tried the same
> thing with 1.0.3a before reporting it.

> The library builds with the same command on linux (RH5.0) with
> egcs-1.0.1.

> All hints and tips appreciated!

> Thanx!


> - Steinar

> linking error follows:

> gmake[2]: Entering directory `/real.giga/sb/gcc/2x/src/mmlparser'
> rm -f libmmlparser.so.1.0 libmmlparser.so libmmlparser.so.1
> g++ -shared -o libmmlparser.so.1.0 .obj/debug/mmlAst.o .obj/debug/mmlcallback.o .obj/debug/mmlparser.o .obj/debug/mmlreader.o .obj/debug/AParser.o .obj/debug/DLexerBase.o .obj/debug/ATokenBuffer.o .obj/debug/PCCTSAST.o .obj/debug/ASTBase.o .obj/debug/mmlbase.o .obj/debug/MmlBaseP.o .obj/debug/mmlbaseLexer.o
> ld: fatal: symbol `__default_unexpected(void)' is multiply defined:
>         (file /opt/pub/lib/libstdc++.a(exceptioni.o) and file /giga/sb/apps/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.29/libgcc.a(exception.o));
> ld: fatal: symbol `terminate(void)' is multiply defined:
>         (file /opt/pub/lib/libstdc++.a(exceptioni.o) and file /giga/sb/apps/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.29/libgcc.a(exception.o));
> ld: fatal: symbol `set_terminate(void (*)(void))' is multiply defined:
>         (file /opt/pub/lib/libstdc++.a(exceptioni.o) and file /giga/sb/apps/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.29/libgcc.a(exception.o));
> ld: fatal: symbol `set_unexpected(void (*)(void))' is multiply defined:
>         (file /opt/pub/lib/libstdc++.a(exceptioni.o) and file /giga/sb/apps/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.29/libgcc.a(exception.o));
> ld: fatal: symbol `unexpected(void)' is multiply defined:
>         (file /opt/pub/lib/libstdc++.a(exceptioni.o) and file /giga/sb/apps/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.29/libgcc.a(exception.o));
> ld: fatal: File processing errors.  No output written to libmmlparser.so.1.0
> collect2: ld returned 1 exit status
> gmake[2]: *** [/giga/sb/gcc/2x/lib/libmmlparser.so.1.0] Error 1
> gmake[2]: Leaving directory `/real.giga/sb/gcc/2x/src/mmlparser'


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]