Closed Bug 343975 Opened 18 years ago Closed 7 years ago

Build system shouldn't use uname

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: glandium, Unassigned)

References

Details

In several places, the build system uses uname to determine os type, cpu, etc.

This disallows to build x86 binaries on amd64, or s390 on s390x.

While this can be fixed cleanly in nsprpub and the main configure script, which all use autotools, it would require some hacking for libnss...
Can you be more specific?  Autoconf uses uname.  Building x86 binaries on 64bit machines is technically a cross-compile and we support that (for certain configurations).  NSS is a known problem child in this area but we have code in place to work around it (for certain configurations).
autoconf uses config.guess, which uses uname *and other logic* to decide what is going on. cross compiling is when the host system is different from the target system (--host and --target options ; host being autodetected with config.guess if not given).

Building x86 binaries on an amd64 host with the x86 toolchain is *not* cross compiling. Since you are using the x86 toolchain (and not an amd64 toolchain able to cross compile for x86, which is a different situation), host and target are identical.

In such a case, your uname detection will make the build use the amd64 assembly files, which will obviously fail, while the config.guess detection will make the build use the x86 assembly files.

I have a patch that we use on debian to build firefox and xulrunner, but it doesn't remove all the uname occurences, and may even break non GNU toolchain builds... (where uname and other logic is used to whatever it is used for in the configure.in)
Depends on: 372428
Shouldn't the dependency be in the opposite direction ?
This bug describes a general problem and the other bug provides a specific (partial) fix to the general problem.  Therefore, the general bug is dependent upon the specific bug. In essence, this is a meta bug since no one appears to be working on it and I would expect more dependencies to pop up over time.
(In reply to comment #4)
> This bug describes a general problem and the other bug provides a specific
> (partial) fix to the general problem.  Therefore, the general bug is dependent
> upon the specific bug. In essence, this is a meta bug since no one appears to
> be working on it and I would expect more dependencies to pop up over time.
> 

the fix in bug 372428 is sufficient to build x86 binaries on amd64.  I have no idea about s390 on s390x.
A workaround was suggested by syp_ on #developers@irc.mozilla.org using which I was able to build the x86 binaries on my amd64 machine: using setarch to force the arch detection to i686. The bug, however, is still valid because the root of the problem lies in config.guess which is guessing the architecture wrongly.
(In reply to comment #6)
> A workaround was suggested by syp_ on #developers@irc.mozilla.org using which I
> was able to build the x86 binaries on my amd64 machine: using setarch to force
> the arch detection to i686. The bug, however, is still valid because the root
> of the problem lies in config.guess which is guessing the architecture wrongly.

No, config.guess guesses the architecture right. But mozilla's configure doesn't use what config.guess returns everywhere, and relies on uname in some places where it really shouldn't.
(In reply to comment #7)
> No, config.guess guesses the architecture right. But mozilla's configure
> doesn't use what config.guess returns everywhere, and relies on uname in some
> places where it really shouldn't.

Ah, I see. Yes, my config.guess returns x86_64-unknown-linux-gnu while my uname returns 2.6.29-2-amd64. So somewhere, the value from uname is being used instead of the value from config.guess
Mass bug cleanup for Core:Build Config.

If you feel this bug has been closed in error, please re-open with new details.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.