FairMUonE installation on Macbook Air (4th Dec 2022)

Environment

MacOS 13.0.1, Apple M2 (ARM)

(clang --version)

Apple clang version 14.0.0 (clang-1400.0.29.202)

arm64-apple-darwin22.1.0

Command line tools: Xcode 14.1 (14B47b)

Prerequisite

https://github.com/FairRootGroup/FairSoft/blob/master/legacy/setup-macos.sh

Export the path

export SIMPATH=/Users/zhangce/Applications/FairSoft/install
#export FAIRROOTPATH=/Users/zhangce/Applications/FairRoot/install ## after installing FairRoot

Step-by-step commands: FairSoft

cd /Users/zhangce/Applications
git clone https://github.com/FairRootGroup/FairSoft
cmake -S FairSoft -B FairSoft /build/ -C FairSoft /FairSoftConfig.cmake
cmake --build FairSoft /build/

Step-by-step commands: FairRoot & FairMUonE

git clone -b master https://github.com/FairRootGroup/FairRoot.git
cd FairRoot
vi CMakeLists.txt ### add_subdirectory(MUonE)

copy MUonE from https://gitlab.cern.ch/mgoncerz/fairmuone/-/releases to the FairRoot directory

mkdir build
mkdir install
cd build
cmake -DCMAKE_INSTALL_PREFIX="/Users/zhangce/Applications/FairRoot/install" ../
make -k

I had three issues during the 'make':
  • Libraries missing: (in my case) go to each CMakeLists.txt following, make sure to add the libs: Core, fairlogger
    • MuonEDetector/Configuration/CMakeLists.txt
    • MuonEDigitization/Configuration/CMakeLists.txt
    • MUonEReconstruction/Configuration/CMakeLists.txt
    • MUonEGenerators/Configuration/CMakeLists.txt
    • MUonEEventFilter/Configuration/CMakeLists.txt
    • MUonEAnalysis/Configuration/CMakeLists.txt
    • MUonEAlignment/Configuration/CMakeLists.txt
  • For example, in the MUonEAlignment/Configuration/CMakeLists.txt
target_link_libraries(${target} PUBLIC
Core
fairlogger
Physics
MathCore
ED
yaml-cpp
)
  • Another issue in my case is the lib64 missing, just change lib64 to lib

    /lib64/libooptools --> lib/libooptools

  • Finally, I had a problem regarding linking the gfortran libraries. The MacOS clang does not include the fortran library. I installed it via homebrew.
  • brew install gfortran
  • In my case, the path is: /opt/homebrew/Cellar/gcc/12.2.0/bin
  • or directly download it and install it from: https://github.com/fxcoudert/gfortran-for-macOS/releases
  • the path would be:

    /usr/local/gfortran/lib/

vi VertexGenerators /Mesmer/CMakeFiles/Mesmer.dir/link.txt

/usr/bin/clang++ -O2 -g -Wshadow -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -dynamiclib -Wl,-headerpad_max_install_names -compatibility_version 18.6.0 -current_version 18.6.9 -o ../../../../lib/libMesmer.18.6.9.dylib -install_name @rpath/libMesmer.18.6.dylib "CMakeFiles/Mesmer.dir/__/__/__/__/_deps/mesmer_interface-src/code/MuEtree.cc.o" "CMakeFiles/Mesmer.dir/__/__/__/__/_deps/mesmer_interface-src/code/Utils.cc.o" CMakeFiles /Mesmer.dir/G__Mesmer.cxx.o -L/Users/zhangce/Applications/FairSoft/install/lib -Wl,-rpath,/Users/zhangce/Applications/FairSoft/install/lib /Users/zhangce/Applications/FairSoft/install/lib/libCore.so /Users/zhangce/Applications/FairSoft/install/lib/libPhysics.so /Users/zhangce/Applications/FairSoft/install/lib/libMathCore.so mesmer_build-prefix/src/mesmer_build/libmesmerfull.a /opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current/gcc/aarch64-apple-darwin22/12/libgcc.a -L/opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current/ /usr/local/gfortran/lib/libgfortran.a /usr/local/gfortran/lib/libquadmath.a /Users/zhangce/Applications/FairSoft/install/lib/libRIO.so

Basically, the principle is to manually add the missing libs (that can not be found somehow by FairRoot...)

similar operation done to:

- VertexGenerators/CMakeFiles/MUonEVertexGenerators.dir/link.txt

- MUonEGenerators.dir/link.txt

In those link.txt, I replaced the -lgfortran with /usr/local/gfortran/lib/libgfortran.a

Finally

make install 

Done!

-- CeZhang - 16 Dec 2022
Topic revision: r6 - 16 Feb 2023, CeZhang
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback