User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Firefox/17.0 Build Identifier: libguile.so is evidently linked with libpthread.so.0 (as can be verified with ldd) However, pkg-config --libs guile-1.8 fails to provide the -lpthread in linker flags. (the -pthread CFLAG is there however). Any code relying on the information provided by pkg-config will fail, e.g. With any trivial test file test.c try: gcc -std=c11 -O3 -g -c -Wall test.c -o test.o $(pkg-config --cflags guile-1.8) gcc -std=c11 -O3 -g -Wall test.o -o test $(pkg-config --libs guile-1.8) /bin/ld: test.o: undefined reference to symbol 'pthread_getspecific@@GLIBC_2.2.5' /bin/ld: note: 'pthread_getspecific@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line /lib64/libpthread.so.0: could not read symbols: Invalid operation collect2: error: ld returned 1 exit status Reproducible: Always
Fedora's linker does not use indirect linking (https://fedoraproject.org/wiki/UnderstandingDSOLinkChange), so you have to provide -lpthread yourself. However, I'm not sure if this should be 'fixed' or not, I'm currently discussing it with upstream.
As stated before, you should provide the correct flags yourself, as indirect linking is not supported. Closing this bug.
Yep. I guess I just won't support Fedora then. This is inherently broken. If pkg-config can't tell me what to link with, who else can? Thanks for the effort though.
> If pkg-config can't tell me what to link with, who else can? pkg-config is telling you what you asked for - the guile linker flags. It won't tell you what you need to link from what you use in your source code. However, you can tell gcc to indirectly include NEEDED symbols from the Dynamic section, just add -Wl,--copy-dt-needed-entries.
That's wrong, pkg-config is supposed to tell me what *I* need to add to *my* linker line when I want to link to libguile. And it just doesn't do that. The upstream guile doesn't have that problem as it won't be linked with pthread support by default. That's just another Fedora patch. However, upstream makes the mistake of not mentioning -lpthread in their .pc when it was configured with pthread support and hence does need to be linked with -lpthread. I will take this to upstream directly. Adding more and more kludges to my linker lines is definitely not the way to go. I want to write lean and portable code.
I already started the discussion: http://lists.gnu.org/archive/html/guile-devel/2013-04/msg00165.html