compiling os x 64bit on 32bit cpu fails

RESOLVED WONTFIX

Status

()

Core
Build Config
RESOLVED WONTFIX
7 years ago
7 years ago

People

(Reporter: Jan Gerber, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
User-Agent:       Mozilla/5.0 (X11; Linux i686; rv:2.0b8pre) Gecko/20101205 Firefox/4.0b8pre
Build Identifier: 

.mozconfig:
. $topsrcdir/browser/config/mozconfig
. $topsrcdir/build/macosx/universal/mozconfig

CC=gcc-4.2
CXX=g++-4.2
CROSS_COMPILE=1

ac_add_options --enable-application=browser
mk_add_options MOZ_CO_PROJECT=browser

ac_add_options --enable-optimize
ac_add_options --disable-crashreporter

fails to compile like this:
g++-4.2 -o jsatom.o -c  -fvisibility=hidden -DOSTYPE=\"Darwin\" -DOSARCH=Darwin -DEXPORT_JS_API -D__STDC_LIMIT_MACROS -DJS_HAS_CTYPES -DDLL_PREFIX=\"lib\" -DDLL_SUFFIX=\".dylib\" -Ictypes/libffi/include -I.  -Imozilla-central/js/src -I. -I./../../dist/include -I./../../dist/include/nsprpub  -Imozilla-central/obj-ff-release/x86_64/dist/include/nspr   -Imozilla-central/js/src -Imozilla-central/js/src/assembler -Imozilla-central/js/src/yarr  -fPIC  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -isysroot /Developer/SDKs/MacOSX10.6.sdk -fno-strict-aliasing -fpascal-strings -fno-common -pthread  -DNDEBUG -DTRIMMED -O3 -fstrict-aliasing -fomit-frame-pointer -DUSE_SYSTEM_MALLOC=1 -DENABLE_ASSEMBLER=1 -DENABLE_JIT=1   -DMOZILLA_CLIENT -include ./js-confdefs.h -MD -MF .deps/jsatom.pp mozilla-central/js/src/jsatom.cpp
In file included from mozilla-central/js/src/nanojit/nanojit.h:372,
                 from mozilla-central/js/src/jsbuiltins.h:45,
                 from mozilla-central/js/src/jsapi.cpp:59:
mozilla-central/js/src/nanojit/Containers.h:164: error: integer constant is too large for 'long' typeIn file included from mozilla-central/js/src/nanojit/nanojit.h:372,
                 from mozilla-central/js/src/jsbuiltins.h:45,
                 from mozilla-central/js/src/jstracer.h:48,
                 from mozilla-central/js/src/jsarray.cpp:88:
mozilla-central/js/src/nanojit/Containers.h:164: error: integer constant is too large for 'long' type

jsbool.cpp
g++-4.2 -o jsbool.o -c  -fvisibility=hidden -DOSTYPE=\"Darwin\" -DOSARCH=Darwin -DEXPORT_JS_API -D__STDC_LIMIT_MACROS -DJS_HAS_CTYPES -DDLL_PREFIX=\"lib\" -DDLL_SUFFIX=\".dylib\" -Ictypes/libffi/include -I.  -Imozilla-central/js/src -I. -I./../../dist/include -I./../../dist/include/nsprpub  -Imozilla-central/obj-ff-release/x86_64/dist/include/nspr   -Imozilla-central/js/src -Imozilla-central/js/src/assembler -Imozilla-central/js/src/yarr  -fPIC  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -isysroot /Developer/SDKs/MacOSX10.6.sdk -fno-strict-aliasing -fpascal-strings -fno-common -pthread  -DNDEBUG -DTRIMMED -O3 -fstrict-aliasing -fomit-frame-pointer -DUSE_SYSTEM_MALLOC=1 -DENABLE_ASSEMBLER=1 -DENABLE_JIT=1   -DMOZILLA_CLIENT -include ./js-confdefs.h -MD -MF .deps/jsbool.pp mozilla-central/js/src/jsbool.cpp
mozilla-central/js/src/nanojit/NativeX64.h:346: warning: 'nanojit::SavedRegs' defined but not used
mozilla-central/js/src/nanojit/NativeX64.h:354: warning: 'nanojit::SingleByteStoreRegs' defined but not used
make[5]: *** [jsarray.o] Error 1
make[5]: *** Waiting for unfinished jobs....
mozilla-central/js/src/nanojit/NativeX64.h:346: warning: 'nanojit::SavedRegs' defined but not used
mozilla-central/js/src/nanojit/NativeX64.h:354: warning: 'nanojit::SingleByteStoreRegs' defined but not used
make[5]: *** [jsapi.o] Error 1
make[4]: *** [libs_tier_js] Error 2
make[3]: *** [tier_js] Error 2
make[2]: *** [default] Error 2
make[1]: *** [build] Error 2
make: *** [build] Error 2


Reproducible: Always

Comment 1

7 years ago
I think you have an error in your mozconfig file (the whole cross-compile thing is a mess right now, barely held together with string, so it's hardly your fault). I _think_ you're trying for a universal build, but possibly you're trying to do a straight cross-compile?

I'm pretty sure overwriting CC and CXX is the problem here. gcc-4.2 will build x86_64 by default, which confuses the parts of the build which rely on CROSS_COMPILE. So if you're trying for a universal build, I think you'll be OK by just removing them.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INVALID
(Reporter)

Comment 2

7 years ago
Sorry for not providing enough information about my intentions.
I am trying to build mozilla-central the way current nightlies are build so i am able to build c++ xpcom extensions for it.

so removing all special crosscompile/cpp/cxx lines(those
.mozconfig:
. $topsrcdir/browser/config/mozconfig
. $topsrcdir/build/macosx/universal/mozconfig

ac_add_options --enable-optimize
ac_add_options --disable-tests

Also gcc is 4.2 by default here:
$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)

$ gcc-4.2 --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)

$ uname -a
Darwin box 10.5.0 Darwin Kernel Version 10.5.0: Fri Nov  5 23:20:39 PDT 2010; root:xnu-1504.9.17~1/RELEASE_I386 i386

building this sample c program:
#include <stdio.h>
int main() { printf("test\n"); }

$ gcc -o test test.c
$ file test
test: Mach-O executable i386

i get a 32bit executable by default.

OS X on 32bit cpus is not able to execute 64bit binaries:
$ gcc -o test test.c -arch x86_64
$ file test
test: Mach-O 64-bit executable x86_64
./test
bash: ./test: Bad CPU type in executable

Comment 3

7 years ago
> I am trying to build mozilla-central the way current nightlies are build so i
am able to build c++ xpcom extensions for it.

Nightlies are built on 10.6 as a universal (i386/x86_64) build, so you won't be able to reproduce this on a 10.5/i386 machine.

If you just want i386, which I think is the only option you have on that machine, I think a straight build should work.
(Reporter)

Comment 4

7 years ago
This is a 10.6 machine with XCode 3.2.4, its has an older cpu (Intel Core Duo).
uname lists 10.5.0 as kernel version;
About This Mac lists OS X version 10.6.5

Comment 5

7 years ago
My bad, I misread this:

$ uname -a
Darwin box 10.5.0 Darwin Kernel Version 10.5.0: Fri Nov  5 23:20:39 PDT 2010;
root:xnu-1504.9.17~1/RELEASE_I386 i386


So what happens when you build after removing the CC and CXX flags?
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---

Comment 6

7 years ago
(In reply to comment #2)
> OS X on 32bit cpus is not able to execute 64bit binaries:
> $ gcc -o test test.c -arch x86_64
> $ file test
> test: Mach-O 64-bit executable x86_64
> ./test
> bash: ./test: Bad CPU type in executable

I missed this. So you do have an i386 CPU. This means you won't be able to build the universal build.

Does a normal build work for you?
(Reporter)

Comment 7

7 years ago
I can compile 64bit binaries, i can just not run them.
Why does the universal build depend on a 64bit cpu?

building 32bit mozilla-central works fine, but is useless to build add-ons that should work for other people.

cross compiling 64bit binaries should also be possible, given that apples tool chain supports building 64bit binaries, its just that the universal build hack in mozilla-central somewhere assumes that all 10.6 os x boxes build 64bit binaries by default and its would thous not be required to add -arch x86_64 to build 64bit binaries.

Comment 8

7 years ago
(In reply to comment #7)
> I can compile 64bit binaries, i can just not run them.
> Why does the universal build depend on a 64bit cpu?

You're right, of course.


> cross compiling 64bit binaries should also be possible, given that apples tool
> chain supports building 64bit binaries, its just that the universal build hack
> in mozilla-central somewhere assumes that all 10.6 os x boxes build 64bit
> binaries by default and its would thous not be required to add -arch x86_64 to
> build 64bit binaries.


That makes sense. I think you still haven't posted the error you get when you don't set CC and CXX and CROSS_COMPILE?
Assignee: general → nobody
Component: JavaScript Engine → Build Config
QA Contact: general → build-config
OS: Linux → Mac OS X
(Reporter)

Comment 9

7 years ago
its the same error, will make a new checkout and try again to verify:

g++-4.2 -o jsatom.o -c  -fvisibility=hidden -DOSTYPE=\"Darwin\" -DOSARCH=Darwin -DEXPORT_JS_API -D__STDC_LIMIT_MACROS -DJS_HAS_CTYPES -DDLL_PREFIX=\"lib\" -DDLL_SUFFIX=\".dylib\" -Ictypes/libffi/include -I.  -Imozilla-central/js/src -I. -I./../../dist/include -I./../../dist/include/nsprpub  -Imozilla-central/obj-i386-apple-darwin10.5.0/x86_64/dist/include/nspr   -Imozilla-central/js/src -Imozilla-central/js/src/assembler -Imozilla-central/js/src/yarr  -fPIC  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -isysroot /Developer/SDKs/MacOSX10.6.sdk -fno-strict-aliasing -fpascal-strings -fno-common -pthread  -DNDEBUG -DTRIMMED -O3 -fstrict-aliasing -fomit-frame-pointer -DUSE_SYSTEM_MALLOC=1 -DENABLE_ASSEMBLER=1 -DENABLE_JIT=1   -DMOZILLA_CLIENT -include ./js-confdefs.h -MD -MF .deps/jsatom.pp mozilla-central/js/src/jsatom.cpp
In file included from mozilla-central/js/src/nanojit/nanojit.h:372,
                 from mozilla-central/js/src/jsbuiltins.h:45,
                 from mozilla-central/js/src/jsapi.cpp:59:
mozilla-central/js/src/nanojit/Containers.h:164: error: integer constant is too large for 'long' type
In file included from mozilla-central/js/src/nanojit/nanojit.h:372,
                 from mozilla-central/js/src/jsbuiltins.h:45,
                 from mozilla-central/js/src/jstracer.h:48,
                 from mozilla-central/js/src/jsarray.cpp:88:
mozilla-central/js/src/nanojit/Containers.h:164: error: integer constant is too large for 'long' type
jsbool.cpp
g++-4.2 -o jsbool.o -c  -fvisibility=hidden -DOSTYPE=\"Darwin\" -DOSARCH=Darwin -DEXPORT_JS_API -D__STDC_LIMIT_MACROS -DJS_HAS_CTYPES -DDLL_PREFIX=\"lib\" -DDLL_SUFFIX=\".dylib\" -Ictypes/libffi/include -I.  -Imozilla-central/js/src -I. -I./../../dist/include -I./../../dist/include/nsprpub  -Imozilla-central/obj-i386-apple-darwin10.5.0/x86_64/dist/include/nspr   -Imozilla-central/js/src -Imozilla-central/js/src/assembler -Imozilla-central/js/src/yarr  -fPIC  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -isysroot /Developer/SDKs/MacOSX10.6.sdk -fno-strict-aliasing -fpascal-strings -fno-common -pthread  -DNDEBUG -DTRIMMED -O3 -fstrict-aliasing -fomit-frame-pointer -DUSE_SYSTEM_MALLOC=1 -DENABLE_ASSEMBLER=1 -DENABLE_JIT=1   -DMOZILLA_CLIENT -include ./js-confdefs.h -MD -MF .deps/jsbool.pp mozilla-central/js/src/jsbool.cpp
mozilla-central/js/src/nanojit/NativeX64.h:346: warning: 'nanojit::SavedRegs' defined but not used
mozilla-central/js/src/nanojit/NativeX64.h:354: warning: 'nanojit::SingleByteStoreRegs' defined but not used
make[5]: *** [jsarray.o] Error 1
make[5]: *** Waiting for unfinished jobs....
mozilla-central/js/src/nanojit/NativeX64.h:346: warning: 'nanojit::SavedRegs' defined but not used
mozilla-central/js/src/nanojit/NativeX64.h:354: warning: 'nanojit::SingleByteStoreRegs' defined but not used
make[5]: *** [jsapi.o] Error 1
make[4]: *** [libs_tier_js] Error 2
make[3]: *** [tier_js] Error 2
make[2]: *** [default] Error 2
make[1]: *** [build] Error 2
make: *** [build] Error 2
Sorry, I don't care about supporting alternate configurations for our universal build setup. It's kind of a hack, and if you want it to work on a nonstandard setup then you're on your own.
Status: REOPENED → RESOLVED
Last Resolved: 7 years ago7 years ago
Resolution: --- → WONTFIX
(Reporter)

Comment 11

7 years ago
so can someone update https://developer.mozilla.org/en/Mac_OS_X_Universal_Binaries to document what the current standard setup is? like what os/cpu/.mozconfig is used for official builds?

testing with new checkout with this .mozconfig:
. $topsrcdir/browser/config/mozconfig
. $topsrcdir/build/macosx/universal/mozconfig

ac_add_options --disable-tests
ac_add_options --enable-optimize
ac_add_options --disable-crashreporter

fails like this now:

g++-4.2 -arch x86_64 -o jsapi.o -c  -fvisibility=hidden -DOSTYPE=\"Darwin\" -DOSARCH=Darwin -DEXPORT_JS_API -D__STDC_LIMIT_MACROS -DJS_HAS_CTYPES -DDLL_PREFIX=\"lib\" -DDLL_SUFFIX=\".dylib\" -Ictypes/libffi/include -I.  -Imozilla-central/js/src -I. -I./../../dist/include -I./../../dist/include/nsprpub  -Imozilla-central/obj-i386-apple-darwin10.5.0/x86_64/dist/include/nspr   -Imozilla-central/js/src -Imozilla-central/js/src/assembler -Imozilla-central/js/src/yarr  -fPIC  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -isysroot /Developer/SDKs/MacOSX10.6.sdk -fno-strict-aliasing -fpascal-strings -fno-common -pthread  -DNDEBUG -DTRIMMED -O3 -fstrict-aliasing -fomit-frame-pointer -DUSE_SYSTEM_MALLOC=1 -DENABLE_ASSEMBLER=1 -DENABLE_JIT=1   -DMOZILLA_CLIENT -include ./js-confdefs.h -MD -MF .deps/jsapi.pp mozilla-central/js/src/jsapi.cpp
mozilla-central/js/src/jsapi.cpp: In function 'JSBool JS_ConvertArgumentsVA(JSContext*, uintN, jsval*, const char*, __va_list_tag*)':
mozilla-central/js/src/jsapi.cpp:337: error: cannot convert '__va_list_tag**' to '__va_list_tag (*)[1]' for argument '5' to 'JSBool TryArgumentFormatter(JSContext*, const char**, JSBool, jsval**, __va_list_tag (*)[1])'
mozilla-central/js/src/nanojit/NativeX64.h: At global scope:
mozilla-central/js/src/nanojit/NativeX64.h:346: warning: 'nanojit::SavedRegs' defined but not used
mozilla-central/js/src/nanojit/NativeX64.h:354: warning: 'nanojit::SingleByteStoreRegs' defined but not used
make[5]: *** [jsapi.o] Error 1
make[4]: *** [libs_tier_js] Error 2
make[3]: *** [tier_js] Error 2
make[2]: *** [default] Error 2
make[1]: *** [build] Error 2
make: *** [build] Error 2
http://hg.mozilla.org/build/buildbot-configs/file/c83e37f72f41/mozilla2/macosx64/mozilla-central/release/mozconfig is the exact mozconfig we use in production
You need to log in before you can comment on or make changes to this bug.