global variables within library __thread

Joël Krähemann weedlight@gmail.com
Fri Oct 16 22:31:00 GMT 2015


Hi

I'm not sure if global variables not static are per process created
within a library.
And what about __thread attribute therefor. As building static
application I get compile
errors.

I have a declaration like:

AgsMutexManager *ags_mutex_manager = NULL;
pthread_mutex_t ags_application_mutex = PTHREAD_MUTEX_INITIALIZER;

The other is declared as following:

__thread AgsThread *ags_thread_self = NULL;


/usr/bin/ld: ags_thread_self: TLS definition in
/home/joelkraehemann/gsequencer/.libs/libags_thread.a(libags_thread_la-ags_thread-posix.o)
section .tbss mismatches non-TLS reference in .libs/gsequencerS.o
/home/joelkraehemann/gsequencer/.libs/libags_thread.a: error adding
symbols: Bad value
collect2: error: ld returned 1 exit status
libtool: link: rm -f ".libs/gsequencerS.o"
Makefile:2010: recipe for target 'gsequencer' failed
make[1]: *** [gsequencer] Error 1
make[1]: Leaving directory '/home/joelkraehemann/gsequencer'
Makefile:1854: recipe for target 'all' failed
make: *** [all] Error 2

https://github.com/gsequencer/gsequencer
http://gsequencer.org/downloads/gsequencer-0.7.0.tar.gz

For now I read "21st Century C" - O'Reilly, may be I get the answer of it.

thank you,
Joël



More information about the Libc-help mailing list