Closed Bug 330628 Opened 18 years ago Closed 16 years ago

coreconf/Linux.mk should _not_ default to x86 but result in an error if host is not recognized

Categories

(NSS :: Build, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
3.12.1

People

(Reporter: tbm, Assigned: glandium)

References

Details

Attachments

(1 file, 2 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Firefox/1.0.7 (Debian package 1.0.7-1)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Firefox/1.0.7 (Debian package 1.0.7-1)

At the moment, the host detection script coreconf/Linux.mk falls back to x86 when it doesn't know about the host.  This is a really, really bad idea.  I just tried to compiler mozilla-thunderboard and xulrunner on mips64 (which coreconf/Linux.mk doesn't recognize at the moment; see bug 330626).  With mozilla-thunderbird, I got an error during linking because it couldn't find ssl3.  Looking at previous bug reports of mozilla-thunderbird in our (Debian) bug tracking system showed that someone else reported the same bug on AMD64 several months ago.  It was closed as unreproducible... only after I looked at the logs in full detail I figured out what was going on (i.e. that it was trying to compile for x86).

Assuming x86 as default is really harmful since it leads to really odd compilation errors.  Can you please make your build system more robust and simply generate an error when you cannot guess the type?  Then it's obvious what's wrong and people can submit a patch to add host detection for their target.



Reproducible: Always

Steps to Reproduce:
Compile any mozilla app on an architecture mozilla/security/coreconf/Linux.mk doesn't know about...
Actual Results:  
It will fail with really bizarre errors.


Expected Results:  
It should simply produce an error saying that the host is not recognized.


Debian Bug #356973: build system not robust, assumes x86 when arch unknown
http://bugs.debian.org/356973
Compilation of mozilla-thunderbird on mips64 fails wil a ssl3 not found linking error.

Debian Bug #302657: missing dependency: ssl3
http://bugs.debian.org/302657
Closed as unreproducible: turns out now that it is because at that time AMD64 was not detected as a host arch.

Debian Bug #357035: build system not robust, assumes x86 when arch unknown
http://bugs.debian.org/357035
Compilation of xulrunner on mips64 fails when trying to compile an x86 assembler file...
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch patch for the issue (obsolete) — Splinter Review
It seems that not providing the CPU_ARCH value is just fine, the freebl/mpi part just builds its C counterpart then. I haven't tested if the lib still works correctly, but it builds fine, without using x86 asm ; at least for freebl/mpi. For other directories, that would need some more testing with unsupported architecture.
Attachment #215258 - Flags: review?(wtchang)
Comment on attachment 215258 [details] [diff] [review]
patch for the issue

>+ifeq (,$(filter-out i686 i586 i486 i386,$(OS_TEST)))

The filter and filter-out functions actually accept
patterns as input, so you can replace
i686 i586 i486 i386 by i%86.

I am out of the office for two weeks.  Please ask
my colleague rrelyea@redhat.com to review patches.
Attachment #215258 - Flags: review?(wtchang) → review?(rrelyea)
(In reply to comment #2)
> (From update of attachment 215258 [details] [diff] [review] [edit])
> >+ifeq (,$(filter-out i686 i586 i486 i386,$(OS_TEST)))
> 
> The filter and filter-out functions actually accept
> patterns as input, so you can replace
> i686 i586 i486 i386 by i%86.

I actually did that intentionally, just to be sure no impossible4286 would match.

In the default case:

I would like to see the patch do something like set CPU_ARCH to $(shell uname -m) for sanity sake.

We should also set OS_REL_CFLAGS to "-DLINUX1_2 -D_XOPEN_SOURCE", though I suspect NSS doesn't really care (I think they are hold overs from other coreconf products).

Other than that, I think the patch is fine.

bob
(In reply to comment #4)
> In the default case:
> 
> I would like to see the patch do something like set CPU_ARCH to $(shell uname
> -m) for sanity sake.

OS_TEST is already set to $(shell uname -m), so we could just assign CPU_ARCH to OS_TEST.

> We should also set OS_REL_CFLAGS to "-DLINUX1_2 -D_XOPEN_SOURCE", though I
> suspect NSS doesn't really care (I think they are hold overs from other
> coreconf products).

Will attach updated patch soon.
Attached patch New patch (obsolete) — Splinter Review
Here it is
Attachment #215258 - Attachment is obsolete: true
Attachment #215288 - Flags: review?(rrelyea)
Attachment #215258 - Flags: review?(rrelyea)
Comment on attachment 215288 [details] [diff] [review]
New patch

r+= relyea
Attachment #215288 - Flags: review?(rrelyea) → review+
Assignee: wtchang → nobody
QA Contact: wtchang → build
perhaps this could be checked in?
Assignee: nobody → rrelyea
I don't know the approval requirements for NSS.

Bob, can you check this in?
Assignee: rrelyea → mh+mozilla
This patch has a better-than-average chance of breaking Tinderbox and nightly
builds on Linux.  

So, Before this is checked in, notice should be sent to Christophe and Slavo, 
so they can watch those, and make any necessary adjustments.  I suggest doing 
a checkin on Monday through Thursday, not Friday, Saturday or Sunday, 
so that if Tinderbox breaks, it won't be broken all weekend.
Nelson, neither Gavin nor I have access to the restricted NSS partition to land this... So, you can either land it yourself or add us as members in the partition so we can land this on behalf of glandium.
Reed, thanks for your reply.
I put that there as a reminder to my fellow NSS developers who have the 
principal responsibility for NSS on Linux.

I find that reviewed NSS patches sometimes fall off the radar without being
committed.  That's what happened to this patch.  And it's now so old that
I think it may need to be brought forward to the tip of the trunk and be
re-reviewed.  But whoever goes to check it in will discover that. :)
wtc, think you could land this patch, too? It's been waiting for somebody to commit it for a very long time. Thanks!
http://hg.mozilla.org/index.cgi/mozilla-central/rev/abfdc2e8da35
Status: NEW → RESOLVED
Closed: 16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
The primary "master" source of NSPR is still on cvs.  
If that "fix" was committed to hg and not CVS, then you've forked the tree.
Is that really your plan?
backed out.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
I'm testing it locally on my Linux machine and if it build, I will check it in.

In comment 10 had suggested we should give Christophe and Slavo a chance for comment, but they didn't, so I conclude we should go ahead and try it.

Dao, Reed, thanks for your attempt to help, but this needs to be landed in "upstream" NSS (a separate repository). It will make its way to the Mozilla apps once an updated NSS snapshot gets delivered.
My local build completed fine.

I checked it in, but then backed myself out again. I forgot we're in a freeze towards NSS 3.12.1

We'll have to check this in next week, after the release is out.
Comment on attachment 215288 [details] [diff] [review]
New patch

>+ifeq (,$(filter-out i686 i586 i486 i386,$(OS_TEST)))

We should use the pattern "i%86" instead of the
"i686 i586 i486 i386" list.

The gmake pattern "i%86" matches the shell pattern "i*86"
used in Mozilla and NSPR's configure.in scripts.
Kai,

please check in this patch instead.

In comment 3, Mike Hommey said he intentionally listed i686,
i586, etc.  Here are the proofs that mozilla/nsprpub/configure.in
and mozilla/configure.in are already using the equivalent of i%86.

http://mxr.mozilla.org/nspr/source/nsprpub/configure.in#1471

1464     case "${target_cpu}" in
...
1471     i*86)
1472         AC_DEFINE(i386)
1473         PR_MD_ASFILES=os_Linux_x86.s
1474         ;;

http://mxr.mozilla.org/mozilla-central/source/configure.in#1844

1839     case "${target_cpu}" in
...
1844     i*86)
1845         USE_ELF_DYNSTR_GC=1
1846         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1847     ;;
Attachment #215288 - Attachment is obsolete: true
Attachment #333791 - Flags: review?(kaie)
Blocks: 448792
Comment on attachment 333791 [details] [diff] [review]
New patch v2: use i%86

r=kaie for Wan-Teh's change to the patch
Attachment #333791 - Flags: review?(kaie) → review+
We have decided to take this patch for 3.12.1
Checked in

Checking in Linux.mk;
/cvsroot/mozilla/security/coreconf/Linux.mk,v  <--  Linux.mk
new revision: 1.34; previous revision: 1.33
done
Status: REOPENED → RESOLVED
Closed: 16 years ago16 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.12.1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: