qtCore.framework

I installed geant4 11.2.2 on MacOS (M chips) following the instructions Installation on macOS (M-series)

MacOS: Sonoma 14.7

gcc: Apple clang version 16.0.0 (clang-1600.0.26.4)

Target: arm64-apple-darwin23.6.0

qt@5 5.15.15_2

cmake 3.31.0

I install Geant4 with GUI

    1. cmake -DGEANT4_USE_QT=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_GDML=ON -DCMAKE_INSTALL_PREFIX=/Users/xxx/Documents/Geant4-install /Users/xxx/Downloads/geant4
    1. make -j10
    1. make install
    1. define PKG_CONFIG_PATH environment variable for Qt 5 by typing in the terminal:
    1. export PKG_CONFIG_PATH=/opt/homebrew/Cellar/qt@5/5.15.15_2/lib/pkgconfig/
      export PATH=/opt/homebrew/Cellar/qt@5/5.15.15_2/bin:$PATH
    1. source /Users/liling/Documents/Geant4-install/bin/geant4.sh

Everything goes smoothly without any errors.

But when I ran geant4 example B1, there is a problem related qt5. See the following error messages:

……

[ 12%] Building CXX object CMakeFiles/exampleB1.dir/exampleB1.cc.o

In file included from /Users/xxx/Desktop/Geant4-project/B1/exampleB1.cc:38:

….

In file included from /opt/homebrew/Cellar/qt@5/5.15.15_2/lib/QtCore.framework/Headers/QtGlobal:1:

/opt/homebrew/Cellar/qt@5/5.15.15_2/lib/QtCore.framework/Headers/qglobal.h:399:11: error: ‘maybe_unused’ attribute cannot be applied to types

….

If I install Geant4 without Gui. Do cmake without the option “-DGEANT4_USE_QT=ON”.

I can install geant4 and run B1 example successfully

Problem solved.

I found qt and qt@5 installed in my laptop.
I do “brew unlink qt” before doing cmake for geant4.

Now I can run geant4 example with GUI without any problems.