Red Hat Bugzilla – Bug 51883
static linking of C/C++ & glibc fails with looping error message
Last modified: 2007-04-18 12:35:58 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.78 [en] (X11; U; Linux 2.4.6-3.1smp i686; Nav)
Description of problem:
I have a relatively large C/C++/X/Motif application. linking it
dynamically works fine. linking it statically yields the following
ld failure message:
/usr/bin/ld: /lib/ld-linux.so.2: indirect symbol `__libc_internal_tsd_set'
to `__libc_internal_tsd_set@@GLIBC_2.0' is a loop
/lib/ld-linux.so.2: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. have not tried w/ smaller test cases. If necessary I will try
to generate one.
Actual Results: failed link
Expected Results: successful link (or at least a list of missing symbols,
a common situation with static links)
This defect is considered SHOULD-FIX for Fairfax.
This probably means you're passing explicit shared library filename
in the link command.
Can you please check if that's true?
By explicit shared library filename I mean something like
/usr/lib/libfoo.so, ie. not -lfoo (the latter would just moan
that it could not find the library if only .so existed and not .a).
no explicit libraries referenced. The attached file has the link line, and the
output error message.
Created attachment 28215 [details]
output of make
Yeah, but you have -lComboBox -lXmt before -Wl,-Bstatic, which means
that those libs (if they are shared) will be linked in shared, while the rest
will be linked in statically.
I don't know what all you'd like to link in statically, if all X libs too or not,
in any case it would be good to add -Wl,-Bdynamic at the end of the command line.
adding -Wl,-Bdynamic at the end of the command line resolves the static link