An example kde3.2.3
Note Kde usually uses libtool with the --silent flag, I have re-run it by hand
in the relevant subdir so we can see what goes on
/bin/bash ../libtool --mode=link --tag=CXX g++ -Wnon-virtual-dtor
-Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -O2
-fno-exceptions -fno-check-new -fno-common -DQT_CLEAN_NAMESPACE
-DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -o
libkdeinit_dcopserver.la -rpath /usr/local/kde323/lib -no-undefined
-avoid-version -L/usr/X11R6/lib -L/usr/local/qt/lib -L/usr/local/kde323/lib
-L/opt/sfw/cups/lib/ -L/opt/sfw/lib -L/opt/cfw/lib -L/usr/local/lib
-L/usr/X11R6/lib dcopserver.lo dcopsignals.lo libDCOP.la
libtool: link: warning: `/usr/local/lib/libstdc++.la' seems to be moved
g++ -shared -nostdlib
/opt/cfw/gcc333/bin/../lib/gcc-lib/i386-pc-solaris2.9/3.3.3/crti.o
/usr/ccs/lib/values-Xa.o
/opt/cfw/gcc333/bin/../lib/gcc-lib/i386-pc-solaris2.9/3.3.3/crtbegin.o
.libs/dcopserver.o .libs/dcopsignals.o -Wl,-R -Wl,/usr/local/kde323/lib -Wl,-R
-Wl,/usr2/robert/sources/qt-x11-free-3.3.0/lib -Wl,-R -Wl,/usr/local/lib -Wl,-R
-Wl,/opt/cfw/gcc333//lib/. -Wl,-R -Wl,/usr/local/qt/lib -Wl,-R
-Wl,/usr/X11R6/lib -Wl,-R -Wl,/opt/sfw/cups/lib/ -Wl,-R -Wl,/usr/lib -Wl,-R
-Wl,/usr/openwin/lib -Wl,-R -Wl,/usr/local/ssl/lib
-L/alt/src/sources/gcc-3.3.3/gcc
-L/alt/src/sources/gcc-3.3.3/i386-pc-solaris2.9/libstdc++-v3/src/.libs
-L/alt/src/sources/gcc-3.3.3/i386-pc-solaris2.9/libstdc++-v3/src
-L/usr/local/ssl/lib -L/usr/lib -L/usr/openwin/lib -L/usr/X11R6/lib
-L/usr/local/qt/lib -L/usr/local/kde323/lib -L/opt/sfw/cups/lib/ -L/opt/sfw/lib
-L/opt/cfw/lib -L/usr/local/lib ./.libs/libDCOP.so
/usr2/robert/sources/qt-x11-free-3.3.0/lib/libqt-mt.so -lfreetype -lfontconfig
-lXrender -lXrandr -lXcursor -lXinerama -lXft /usr/local/lib/libfontconfig.so
/usr/local/lib/libfreetype.so /usr/local/lib/libexpat.so -lresolv -ldl -lrt
-lpng -lz -lXext -lX11 -lsocket -lnsl -lSM -lICE -lpthread
-L/opt/cfw/gcc333/bin/../lib/gcc-lib/i386-pc-solaris2.9/3.3.3
-L/opt/cfw/gcc333/bin/../lib/gcc-lib
-L/opt/cfw/gcc333//lib/gcc-lib/i386-pc-solaris2.9/3.3.3 -L/usr/ccs/bin
-L/usr/ccs/lib
-L/opt/cfw/gcc333/bin/../lib/gcc-lib/i386-pc-solaris2.9/3.3.3/../../..
-L/opt/cfw/gcc333//lib/gcc-lib/i386-pc-solaris2.9/3.3.3/../../..
/opt/cfw/gcc333//lib/./libstdc++.so -lm -lgcc_s
/opt/cfw/gcc333/bin/../lib/gcc-lib/i386-pc-solaris2.9/3.3.3/crtend.o
/opt/cfw/gcc333/bin/../lib/gcc-lib/i386-pc-solaris2.9/3.3.3/crtn.o
-Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith
-Wwrite-strings -O2 -fno-exceptions -fno-check-new -fno-common
-DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT
-DQT_NO_TRANSLATION -Wl,-h -Wl,libkdeinit_dcopserver.so -o
.libs/libkdeinit_dcopserver.so
Text relocation remains referenced
against symbol offset in file
ft_square_roots 0x3e3
/usr/X11R6/lib/libfreetype.a(ftbase.o)
destroy_size 0x112d
/usr/X11R6/lib/libfreetype.a(ftbase.o)
destroy_face 0x11c7
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x1cfd
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x1d48
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x2c76
/usr/X11R6/lib/libfreetype.a(ftbase.o)
null_outline 0x3320
/usr/X11R6/lib/libfreetype.a(ftbase.o)
null_outline 0x34bf
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0xc8
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
ft_io_stream 0x114
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
ft_close_stream 0x11b
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
ft_alloc 0x151
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
ft_realloc 0x158
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
ft_free 0x15f
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
<unknown> 0x110
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x114
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x118
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x11c
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x120
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x124
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x128
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x12c
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x130
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x134
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x138
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x13c
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x140
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x144
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x148
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x14c
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x150
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x154
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x158
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x15c
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x160
/usr/X11R6/lib/libfreetype.a(ftbase.o)
<unknown> 0x164
/usr/X11R6/lib/libfreetype.a(ftbase.o)
fseek 0x8f
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
fseek 0xe4
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
fseek 0x100
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
realloc 0x24
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
ftell 0xed
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
FT_New_Stream 0x5ca
/usr/X11R6/lib/libfreetype.a(ftbase.o)
fread 0x99
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
memset 0x498
/usr/X11R6/lib/libfreetype.a(ftbase.o)
memcpy 0xa98
/usr/X11R6/lib/libfreetype.a(ftbase.o)
memcpy 0xaa7
/usr/X11R6/lib/libfreetype.a(ftbase.o)
memcpy 0xabe
/usr/X11R6/lib/libfreetype.a(ftbase.o)
memcpy 0xaeb
/usr/X11R6/lib/libfreetype.a(ftbase.o)
memcpy 0x26a8
/usr/X11R6/lib/libfreetype.a(ftbase.o)
memcpy 0x2cd0
/usr/X11R6/lib/libfreetype.a(ftbase.o)
memcpy 0x3432
/usr/X11R6/lib/libfreetype.a(ftbase.o)
memcpy 0x3445
/usr/X11R6/lib/libfreetype.a(ftbase.o)
memcpy 0x345c
/usr/X11R6/lib/libfreetype.a(ftbase.o)
fopen 0xce
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
malloc 0xd
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
malloc 0x140
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
fclose 0x51
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
free 0x39
/usr/X11R6/lib/libfreetype.a(ftsystem.o)
strcmp 0x21ee
/usr/X11R6/lib/libfreetype.a(ftbase.o)
strcmp 0x2397
/usr/X11R6/lib/libfreetype.a(ftbase.o)
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: ld returned 1 exit status
Now if I re-run the g++ part without the -shared flag and we add a -G flag for
the linker the expected behaviour is seen ie we emit a dynamically linked
shared object and ignore undefined symbols (To be resolvewd at load time)
bash-2.05$ g++ -Wl,-G -nostdlib
/opt/cfw/gcc333/bin/../lib/gcc-lib/i386-pc-solaris2.9/3.3.3/crti.o
/usr/ccs/lib/values-Xa.o
/opt/cfw/gcc333/bin/../lib/gcc-lib/i386-pc-solaris2.9/3.3.3/crtbegin.o
.libs/dcopserver.o .libs/dcopsignals.o -Wl,-R
-Wl,/usr/local/kde323/lib -Wl,-R
-Wl,/usr2/robert/sources/qt-x11-free-3.3.0/lib -Wl,-R
-Wl,/usr/local/lib -Wl,-R -Wl,/opt/cfw/gcc333//lib/. -Wl,-R
-Wl,/usr/local/qt/lib -Wl,-R -Wl,/usr/X11R6/lib -Wl,-R
-Wl,/opt/sfw/cups/lib/ -Wl,-R -Wl,/usr/lib -Wl,-R
-Wl,/usr/openwin/lib -Wl,-R -Wl,/usr/local/ssl/lib
-L/alt/src/sources/gcc-3.3.3/gcc
-L/alt/src/sources/gcc-3.3.3/i386-pc-solaris2.9/libstdc++-v3/src/.libs
-L/alt/src/sources/gcc-3.3.3/i386-pc-solaris2.9/libstdc++-v3/src
-L/usr/local/ssl/lib -L/usr/lib -L/usr/openwin/lib -L/usr/X11R6/lib
-L/usr/local/qt/lib -L/usr/local/kde323/lib -L/opt/sfw/cups/lib/
-L/opt/sfw/lib -L/opt/cfw/lib -L/usr/local/lib ./.libs/libDCOP.so
/usr2/robert/sources/qt-x11-free-3.3.0/lib/libqt-mt.so -lfreetype
-lfontconfig -lXrender -lXrandr -lXcursor -lXinerama -lXft
/usr/local/lib/libfontconfig.so /usr/local/lib/libfreetype.so
/usr/local/lib/libexpat.so -lresolv -ldl -lrt -lpng -lz -lXext -lX11
-lsocket -lnsl -lSM -lICE -lpthread
-L/opt/cfw/gcc333/bin/../lib/gcc-lib/i386-pc-solaris2.9/3.3.3
-L/opt/cfw/gcc333/bin/../lib/gcc-lib
-L/opt/cfw/gcc333//lib/gcc-lib/i386-pc-solaris2.9/3.3.3
-L/usr/ccs/bin -L/usr/ccs/lib
-L/opt/cfw/gcc333/bin/../lib/gcc-lib/i386-pc-solaris2.9/3.3.3/../../..
-L/opt/cfw/gcc333//lib/gcc-lib/i386-pc-solaris2.9/3.3.3/../../..
/opt/cfw/gcc333//lib/./libstdc++.so -lm -lgcc_s
/opt/cfw/gcc333/bin/../lib/gcc-lib/i386-pc-solaris2.9/3.3.3/crtend.o
/opt/cfw/gcc333/bin/../lib/gcc-lib/i386-pc-solaris2.9/3.3.3/crtn.o
-Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith
-Wwrite-strings -O2 -fno-exceptions -fno-check-new -fno-common
-DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT
-DQT_NO_TRANSLATION -Wl,-h -Wl,libkdeinit_dcopserver.so -o
.libs/libkdeinit_dcopserver.so bash-2.05$
On Sun, 4 Jul 2004 07:16 am, Bob Friesenhahn wrote:
I have always used Sun's ld under Solaris (since 1992) and have not
seen GCC's -shared option fail to work due to using it.
Certain patch versions of Sun's ld have had bugs when used with GCC,
but I believe that this was specific to Solaris 8 and was fixed with a
later ld patch.
Bob
On Sat, 3 Jul 2004, Gary V.Vaughan wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Begin forwarded message:
From: Robert Lunnon <address@hidden>
Date: 3 July 2004 09:42:10 BST
To: address@hidden
Subject: Libtool 1.5 Solaris 9 with GCC3.3
Reply-To: address@hidden
I keep noticing that libtool tries to link shared objects using -shared
to gcc. This doesn't work when gcc is configured to use Sun LD (It might
or might not work with gnu ld).
From my recollection from GCC 3.0 Up it was neccessary to compile with
-shared
but link without -shared otherwise the linker will complain about
unresolved
references.