Problems compiling ROOT

I have a problem compiling root on Apple Silicon. This is a clean installation and make fails with

[ 64%] Linking CXX shared library ../../lib/libGraf.so
ld: warning: ignoring file '../../FREETYPE-prefix/src/FREETYPE/objs/.libs/libfreetype.a(dlg.o)': found architecture 'x86_64', required architecture 'arm64'

What is crazy is the following:

$ cd FREETYPE-prefix/src/FREETYPE
$ file objs/ftbdf.*
objs/ftbdf.lo: libtool object file, ASCII text
objs/ftbdf.o:  Mach-O 64-bit object x86_64
$ rm  objs/ftbdf.*
$ make VERBOSE=1
./builds/unix/libtool --mode=compile /usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk -pedantic -std=c99 -I/usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/src/base -I/usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/objs -I./builds/unix -I/usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/include  -c -Wall -O -fvisibility=hidden -DDARWIN_NO_CARBON  -pthread -DFT_CONFIG_CONFIG_H="<ftconfig.h>" -DFT_CONFIG_MODULES_H="<ftmodule.h>" -DFT_CONFIG_OPTIONS_H="<ftoption.h>" -DFT2_BUILD_LIBRARY -o /usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/objs/ftbdf.lo /usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/src/base/ftbdf.c
libtool: compile:  /usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk -pedantic -std=c99 -I/usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/src/base -I/usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/objs -I./builds/unix -I/usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/include -c -Wall -O -fvisibility=hidden -DDARWIN_NO_CARBON -pthread "-DFT_CONFIG_CONFIG_H=<ftconfig.h>" "-DFT_CONFIG_MODULES_H=<ftmodule.h>" "-DFT_CONFIG_OPTIONS_H=<ftoption.h>" -DFT2_BUILD_LIBRARY /usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/src/base/ftbdf.c  -fno-common -DPIC -o /usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/objs/ftbdf.o
$ file objs/ftbdf.*
objs/ftbdf.lo: libtool object file, ASCII text
objs/ftbdf.o:  Mach-O 64-bit object x86_64

The file produced is x86_64 and the build fails. Now I take exactly the same line and I copy paste it and I execute it

$ rm  objs/ftbdf.*
$ ./builds/unix/libtool --mode=compile /usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk -pedantic -std=c99 -I/usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/src/base -I/usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/objs -I./builds/unix -I/usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/include  -c -Wall -O -fvisibility=hidden -DDARWIN_NO_CARBON  -pthread -DFT_CONFIG_CONFIG_H="<ftconfig.h>" -DFT_CONFIG_MODULES_H="<ftmodule.h>" -DFT_CONFIG_OPTIONS_H="<ftoption.h>" -DFT2_BUILD_LIBRARY -o /usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/objs/ftbdf.lo /usr/local/root-git/buildroot/FREETYPE-prefix/src/FREETYPE/src/base/ftbdf.c
$ file objs/ftbdf.*
objs/ftbdf.lo: libtool object file, ASCII text
objs/ftbdf.o:  Mach-O 64-bit object arm64

And now the file produced is arm!!!

HELP!

Please read tips for efficient and successful posting and posting code

Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

ROOT Version: v6-36-00-patches
Platform: Darwin MacBook-Air.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T8132 arm64
Compiler: Apple clang version 17.0.0 (clang-1700.0.13.5)


It “works for me” in a fresh build:

$ cmake -G ‘Unix Makefiles’ ~/root_working/code/master -Ddavix:BOOL=OFF
$ make -j4 Graf
$ file FREETYPE-prefix/src/FREETYPE/objs/*.o
FREETYPE-prefix/src/FREETYPE/objs/autofit.o:  Mach-O 64-bit object arm64
FREETYPE-prefix/src/FREETYPE/objs/bdf.o:      Mach-O 64-bit object arm64

So something on your system is interfering … do you homebrew or macport installed that could be ‘setting’ something to emulate and/or request x86_64 ?

I have homebrew. But I do not understand why in the makefile it compiles to x86_64 and at the command line it correctly compiles to arm64. Ciao

If I remember correctly this happens if you have an x86_64 make executable. It passes (I think implicitly via the equivalent of arch or by forgetting to do so) a request to build the product as x86_64 (I think mostly/just to the sub-make processes).

i.e. make sure you use a make (or ninja) build for arm64

m….

$ make -v
GNU Make 4.4.1
Built for x86_64-apple-darwin22.3.0

replacing with the native make. Thanks

Just to close this topic. The problem was that I was running a X86_64 make under rosetta. Somehow the make program or the rosetta environment force the architecture. Now all is fine, with 2 provisos:

  • Perhaps it would be better under Mac OS X add the architecture flag to the compilation just to avoid others this pain;
  • Still, when running cmake, I have the following lines
Compiler flags:
--
 - C:                          -m64 -pipe -W -Wall -fsigned-char -fno-common -Qunused-arguments -pthread
 - C (build type specific):   -O2 -g -DNDEBUG
 - C++:                        -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe 

Where -m64 appears. It seems to be harmless though, but it should perhaps be corrected.

Best,