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]
Other format: [Raw text]

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


"yang xiaoxin" <yang.xiaoxin@gmail.com> writes:

> 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?

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.

So you get an error.

Hope this helps.

Ian


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