Closed Bug 72766 Opened 19 years ago Closed 18 years ago

Shared libraries must be explicitly linked against libc

Categories

(SeaMonkey :: Build Config, defect, P2)

x86
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.2alpha

People

(Reporter: jes, Assigned: netscape)

Details

Attachments

(2 files)

Hi

The current build system does not link shared libraries against libc when
building under Linux. Instead it relies on the other shared objects to pull in
libc.

The problem is that on some architectures functions such as fstat() and
fstat64() are inline functions which are only available in libc_nonshared.a.
Hence in order to be able to get a real function version included it is
necessary to explicitly link against libc which will also include
libc_nonshared.a.

Please change the Makefiles to explicitly link against libc `-lc' when linking
any of the shared libraries.

Thanks
Jes
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P2
Target Milestone: --- → mozilla0.9
Hello I am having a simular if not the same problem.
I have edited the Makefile, with no luck.
Love to look at another Makefile.
The patch in the attachment seems to solve the problem for me.
The patch worked for me too, took me a little while, had to do a clobber after.
:)
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Patch has been checked in.  Marking fixed.
verified.
Status: RESOLVED → VERIFIED
The fix is actually wrong and may break binary backwards compatibility (seen on Linux/PPC).  On Linux there are 2 possibilities to correctly link against libc:    1. Use gcc/g++ for linking (that's what mozilla does) which will autoadd the  correct -l options for ld 2. Use ld for linking and add -lgcc -lc -lgcc for C and g++2, or add -lgcc_s -lc -lgcc_s for g++3  The bug Jes was reporting is probably some Makefile using ld directly instead of linking with gcc/g++.   
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
.
Assignee: cls → seawood
Status: REOPENED → NEW
Target Milestone: mozilla0.9 → mozilla1.2alpha
Comment on attachment 91271 [details] [diff] [review]
Fixup wrong -lc uses

r=wtc.	This patch looks correct to me.  What do you think, cls?
Attachment #91271 - Flags: review+
Looks fine to me.  Looking back, when jes reported this bug, we were using $(LD)
to link shared libs on NSPR so adding -lc was correct then.  The weird glibc/gcc
interaction makes me glad that we switched to using $(CC) to link. :)
Status: NEW → ASSIGNED
This patch has been checked into the NSPR trunk, the
NSPRPUB_PRE_4_2_CLIENT_BRANCH branch & the mozilla trunk.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago18 years ago
Resolution: --- → FIXED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.