How to compile ROOT on Snow Leopard for 32 bit

Dear ROOTers

On my MacBook Pro I have installed Snow Leopard 10.6.3 and the new Xcode 3.2.2 from Apple.

Then I have compiled root_v5.24/00 for 32 bit using:

./configure macosx

However, for some reason the effect is the same as using “macosx64”, i.e. root is compiled for 64 bit, see:

MacBookPro:~ rabbitus$ file /Volumes/CoreData/ROOT/root/lib/ 
/Volumes/CoreData/ROOT/root/lib/ Mach-O 64-bit dynamically linked shared library x86_64

To force compilation for 32 bit I used the following configuration:

./configure macosx --with-cxx="/usr/bin/g++-4.2 -arch i386" --with-f77="/usr/bin/gfortran-4.2 -arch i386"

However trying to compile root resulted in the following error:

cp proof/proofx/inc/TXSocketHandler.h include/TXSocketHandler.h
cp proof/proofx/inc/TXUnixSocket.h include/TXUnixSocket.h
gcc -O2 -pipe -W -Wall -fsigned-char -fno-common -Iinclude   -D__DARWIN_UNIX03=1 -D_REENTRANT -pthread -DINCLUDEDIR=\"/usr/include\" -DOBJSUFFIX=\".o\" -o build/rmkdepend/cppsetup.o -c build/rmkdepend/cppsetup.c
gcc -O2 -pipe -W -Wall -fsigned-char -fno-common -Iinclude   -D__DARWIN_UNIX03=1 -D_REENTRANT -pthread -DINCLUDEDIR=\"/usr/include\" -DOBJSUFFIX=\".o\" -o build/rmkdepend/ifparser.o -c build/rmkdepend/ifparser.c
gcc -O2 -pipe -W -Wall -fsigned-char -fno-common -Iinclude   -D__DARWIN_UNIX03=1 -D_REENTRANT -pthread -DINCLUDEDIR=\"/usr/include\" -DOBJSUFFIX=\".o\" -o build/rmkdepend/include.o -c build/rmkdepend/include.c
gcc -O2 -pipe -W -Wall -fsigned-char -fno-common -Iinclude   -D__DARWIN_UNIX03=1 -D_REENTRANT -pthread -DINCLUDEDIR=\"/usr/include\" -DOBJSUFFIX=\".o\" -o build/rmkdepend/main.o -c build/rmkdepend/main.c
gcc -O2 -pipe -W -Wall -fsigned-char -fno-common -Iinclude   -D__DARWIN_UNIX03=1 -D_REENTRANT -pthread -DINCLUDEDIR=\"/usr/include\" -DOBJSUFFIX=\".o\" -o build/rmkdepend/parse.o -c build/rmkdepend/parse.c
gcc -O2 -pipe -W -Wall -fsigned-char -fno-common -Iinclude   -D__DARWIN_UNIX03=1 -D_REENTRANT -pthread -DINCLUDEDIR=\"/usr/include\" -DOBJSUFFIX=\".o\" -o build/rmkdepend/pr.o -c build/rmkdepend/pr.c
/usr/bin/g++-4.2 -arch i386 -O2 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Iinclude   -D__DARWIN_UNIX03=1 -D_REENTRANT -pthread -DINCLUDEDIR=\"/usr/include\" -DOBJSUFFIX=\".o\" -o build/rmkdepend/mainroot.o -c build/rmkdepend/mainroot.cxx
g++ -O2 -o bin/rmkdepend build/rmkdepend/cppsetup.o build/rmkdepend/ifparser.o build/rmkdepend/include.o build/rmkdepend/main.o build/rmkdepend/parse.o build/rmkdepend/pr.o build/rmkdepend/mainroot.o
ld: warning: in build/rmkdepend/mainroot.o, file was built for i386 which is not the architecture being linked (x86_64)
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.6.o
     (maybe you meant: _main_orig, _maininclist )
  "_ROOT_newFile", referenced from:
      _pr in pr.o
  "_rootBuild", referenced from:
      _warning1 in main.o
      _warning in main.o
      _redirect in main.o
      _main_orig in main.o
      _pr in pr.o
      _pr in pr.o
  "_ROOT_adddep", referenced from:
      _pr in pr.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Running build/unix/
Making include/compiledata.h
bin/rmkdepend -R -fcint/cint/src/g__cfunc.d -Y -w 1000 -- -pipe -W -Wall -fsigned-char -fno-common -Iinclude   -DG__REGEXP -DG__UNIX -DG__SHAREDLIB -DG__ROOT -DG__REDIRECTIO -DG__OSFDLL -DG__STD_EXCEPTION -D__DARWIN_UNIX03=1 -DG__HAVE_CONFIG -DG__NOMAKEINFO -DG__CINTBODY -Icint/cint/inc -Icint/cint/src -Icint/cint/src/dict -D_REENTRANT -pthread -I. -- cint/cint/src/g__cfunc.c
make: bin/rmkdepend: No such file or directory
make: *** [cint/cint/src/g__cfunc.o] Error 1

What do I need to do to compile ROOT for 32 bit on Snow Leopard?

Best regards


version v5-24.00 does not support “cross” compiling, i.e. compiling 32 bit version on a 64 machine. Please take v5-26-00 which supports cross compiling.

Cheers, Fons.

Dear Fons,

Thank you for this information, however I need to use root_v5.27/02 since the patched version root_v5.26/00c is not yet available.

Best regards

V5-27-02 is of course also fine. Version v5-24-00 is kind of orphaned so don’t use it.

Cheers, Fons.