Garfield++ arm64 architecture problem

Hello everyone,

I am trying to install Garfield++ on my M1 MacBook Air running MacOS version Sonoma 14.4.1.
I followed the Cern guide and, after the download, when the terminal processes the command ’ make -j 4 ’ in the Garfield build directory I eventually get a very long warning which can be summarized with the lines:

[ 59%] Linking CXX shared library libGarfield.dylib

ld: warning: ignoring file ‘/Users/Elisa/Applications/Garfield/build/Magboltz/libmagboltz.11.dylib’: found architecture ‘arm64’, required architecture ‘x86_64’

ld: warning: ignoring file ‘/Users/Elisa/Applications/Garfield/build/Degrade/libdegrade.3.dylib’: found architecture ‘arm64’, required architecture ‘x86_64’

Undefined symbols for architecture x86_64:

[…]

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make[2]: *** [libGarfield.0.3.0.dylib] Error 1

make[1]: *** [CMakeFiles/Garfield.dir/all] Error 2

make: *** [all] Error 2

Am I doing something wrong? How can I fix this?

Thank you.

Adding @hschindl in the loop.

Hi,
not sure… What compiler are you using and from where/how did you get ROOT?

For the compiler, the clang version is clang-1500.3.9.4.
I am not sure about ROOT but I can find it in the homebrew directory so I guess I used homebrew.

Hm, no idea why the linker expects x86. @mato do you have any idea?

In the end I managed to solve the problem. It was related to the gfortran compiler: it was trying to use a compiler compatible with the architecture arm64 while all root libraries are built for x86-64 architecture. So I just had to use the correct fortran compiler.

Thank you anyway!

Great! Out of curiosity: from where did you get gfortran? Homebrew?

I am not sure, since my computer happened to actually have three different gfortran compiler and only one of those was of the correct architecture. It is called x86_64-apple-darwin23-gfortran-13 don’t know if this can help