On an Opteron machine running a 64-bit version of RedHat AS Linux 3, or Fedora core 3, there is no way to build NSS and NSPR in 32 bit mode. Both the NSS coreconf and the NSPR autoconf default to 64 bits. There should be a USE_32 environment variable to force the build to 32 bits. Some users have tried to force the CFLAGS to -m32, but we know that's not going to work since there are assembly files involved which differ and to which the CFLAGS don't apply. The Makefiles really need to know which target is being built, not just the compiler.
Created attachment 186631 [details] [diff] [review] patch to default to 32 bit on x86-64, and build 64-bit only if USE_64 is set I only modified Linux.2.4.mk because this is the one that applied to the OS I was running - RHAS 3.0 . The other versions of Linux2.x.mk would need to be changed as well to pass $(ARCHFLAG) to MKSHLIB .
I also included the NSPR patch that the coreconf patch depends on . This was accidental, I meant for the NSPR patch to be reviewed in bug 290725 .
Comment on attachment 186631 [details] [diff] [review] patch to default to 32 bit on x86-64, and build 64-bit only if USE_64 is set >Index: security/coreconf/Linux2.4.mk ... >-MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) >+MKSHLIB = $(CC) -shared $(ARCHFLAG) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) We should replace -shared $(ARCHFLAGS) by $(DSO_LDOPTS). Linux2.6.mk needs the same change.
Created attachment 188250 [details] [diff] [review] update - replace -shared $(ARCHFLAG) with $(DSO_LDOPTS) - fix Linux2.*.mk I only tested this on 2.4 . But -m32 should work with all versions of gcc, so this change should work on x86 boxes for older Linux versions as well . I'm not even sure if there was x86_64 support back then, so the change may never be triggered.
Comment on attachment 188250 [details] [diff] [review] update > ifeq ($(OS_TEST),x86_64) >+ifeq ($(USE_64),1) > OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE > CPU_ARCH = x86_64 > else >+ OS_REL_CFLAGS = -DLINUX1_2 -Di386 -D_XOPEN_SOURCE >+ CPU_ARCH = x86 >+ ARCHFLAG = -m32 >+endif >+else >-DSO_LDOPTS = -shared >+DSO_LDOPTS = -shared $(ARCHFLAG) > DSO_LDFLAGS = >+LDFLAGS += $(ARCHFLAG) Please use tabs so that the = and += are aligned with the = in existing lines. On second thought, I think we should move -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) into DSO_LDOPTS, too, and define MKSHLIB as just $(CC) $(DSO_LDOPTS).
Wan-Teh, Thanks for the review. I checked in the patch on the tip. Checking in Linux.mk; /cvsroot/mozilla/security/coreconf/Linux.mk,v <-- Linux.mk new revision: 1.19; previous revision: 1.18 done Checking in Linux2.1.mk; /cvsroot/mozilla/security/coreconf/Linux2.1.mk,v <-- Linux2.1.mk new revision: 1.4; previous revision: 1.3 done Checking in Linux2.2.mk; /cvsroot/mozilla/security/coreconf/Linux2.2.mk,v <-- Linux2.2.mk new revision: 1.4; previous revision: 1.3 done Checking in Linux2.4.mk; /cvsroot/mozilla/security/coreconf/Linux2.4.mk,v <-- Linux2.4.mk new revision: 1.4; previous revision: 1.3 done Checking in Linux2.5.mk; /cvsroot/mozilla/security/coreconf/Linux2.5.mk,v <-- Linux2.5.mk new revision: 1.3; previous revision: 1.2 done Checking in Linux2.6.mk; /cvsroot/mozilla/security/coreconf/Linux2.6.mk,v <-- Linux2.6.mk new revision: 1.3; previous revision: 1.2 done Regarding the MKSHLIB cleanup you suggested, there are some things I don't entirely understand about the Linux definitions, especially regarding the ones in Linux.mk for version 2.0 . Is any pre-2.0 version of Linux still supported ? I'll let you handle this in a separate bug. Ideally, there is probably no need for any mention of MKSHLIB in the Linux2.*.mk files. It could probably be all handled within Linux.mk .