libsupc++.a(eh_globals.o): In function `__gnu_internal::get_global()': undefined reference to `___tls_get_addr'

2006-06-12 Thread yang xiaoxin

Hi,
I've tried to build openoffice using gcc-4.1.0, but failed with the
following message:


Building project store
=
/usr/src/rpm/BUILD/OOB680_m5/store/source
-
/usr/src/rpm/BUILD/OOB680_m5/store/util
--
Making: ../unxlngi6.pro/lib/libstore.so.3
g++ -Wl,-z,combreloc -Wl,-z,defs -Wl,-rpath,'$ORIGIN'
"-Wl,-hlibstore.so.3" -shared -Wl,-O1 -Wl,--version-script
../unxlngi6.pro/misc/store_store.map -L../unxlngi6.pro/lib -L../lib
-L/usr/src/rpm/BUILD/OOB680_m5/solenv/unxlngi6/lib
-L/usr/src/rpm/BUILD/OOB680_m5/solver/680/unxlngi6.pro/lib
-L/usr/src/rpm/BUILD/OOB680_m5/solenv/unxlngi6/lib -L/usr/lib
-L/usr/jre/lib/i386 -L/usr/jre/lib/i386/client
-L/usr/jre/lib/i386/native_threads -L/usr/X11R6/lib
-L/usr/lib/firefox-1.5.0.1 ../unxlngi6.pro/slo/store_version.o
../unxlngi6.pro/slo/store_description.o -o
../unxlngi6.pro/lib/libstore.so.3 ../unxlngi6.pro/slo/object.o
../unxlngi6.pro/slo/memlckb.o ../unxlngi6.pro/slo/filelckb.o
../unxlngi6.pro/slo/storbase.o ../unxlngi6.pro/slo/storcach.o
../unxlngi6.pro/slo/stordata.o ../unxlngi6.pro/slo/storlckb.o
../unxlngi6.pro/slo/stortree.o ../unxlngi6.pro/slo/storpage.o
../unxlngi6.pro/slo/store.o -luno_sal -lsupc++ -lgcc_s -ldl -lpthread
-lm
/usr/lib/libsupc++.a(eh_globals.o): In function `__gnu_internal::get_global()':
: undefined reference to `___tls_get_addr'
collect2: ld 返回 1
dmake:  Error code 1, while making '../unxlngi6.pro/lib/libstore.so.3'
'---* tg_merge.mk *---'

ERROR: Error 65280 occurred while making /usr/src/rpm/BUILD/OOB680_m5/store/util
dmake:  Error code 1, while making 'build_instsetoo_native'


What's the problem?
Thanks


yxx


Re: libsupc++.a(eh_globals.o): In function `__gnu_internal::get_global()': undefined reference to `___tls_get_addr'

2006-06-15 Thread yang xiaoxin

I add AS_NEEDED directive in /usr/lib/libc.so and then anything is ok.

Thanks to Ian and Jakub!
yxx


2006/6/13, Jakub Jelinek <[EMAIL PROTECTED]>:

On Tue, Jun 13, 2006 at 08:35:17AM -0700, Ian Lance Taylor wrote:
> Well, your libstdc++ was configured for a system which supports TLS
> (Thread Local Storage).  That causes it to call __tls_get_addr in some
> cases.  And you are explicitly linking against -lsupc++, which is an
> archive, not a shared library.  This means that your program has a
> direct reference to __tls_get_addr which needs to be satisfied.
>
> Normally __tls_get_addr is defined by the dynamic linker itself.  When
> linking an executable, one normally links against the dynamic linker,
> so the symbol reference is satisfied.  When linking a shared library,
> one normally does not link against the dynamic linker, but that's OK
> because shared libraries are permitted to have undefined references.
>
> However, you are linking with -z defs, which directs the linker to
> prohibit undefined references even though it is linking a shared
> library.

If you have sufficiently recent glibc, you have something like:
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( 
/lib64/ld-linux-x86-64.so.2 ) )
in /usr/lib64/libc.so (and similarly for other arches).
If you have old glibc (approx. 16 months old or older), you either
need to stop using -Wl,-z,defs in this case, or add the dynamic
linker on the command line explicitly.

Jakub