Closed Bug 297849 Opened 19 years ago Closed 19 years ago

Cannot build NSS and NSPR 32 bits on a 64-bit Linux OS

Categories

(NSS :: Build, defect, P1)

3.10
x86
Linux

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: julien.pierre, Assigned: wtc)

Details

Attachments

(1 file, 1 obsolete file)

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.
Priority: -- → P1
Target Milestone: --- → 3.11
Version: 3.10.1 → 3.10
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 .
Attachment #186631 - Flags: review?(wtchang)
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.
Attached patch updateSplinter Review
- 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.
Attachment #186631 - Attachment is obsolete: true
Attachment #188250 - Flags: review?(wtchang)
Attachment #186631 - Flags: review?(wtchang)
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).
Attachment #188250 - Flags: review?(wtchang) → review+
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 .
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: