Errors while building geant4 with qt5

Dear all,
I am trying to install geant4 v11.0.0 in my 2019 MacBook Pro (macOS Monterey) with qt enabled. But I have been getting the following errors

/usr/local/Cellar/qt@5/5.15.2_1/lib/QtGui.framework/Headers/qpixmap.h:134:31: error: unknown type name ‘QMatrix’
QPixmap transformed(const QMatrix &, Qt::TransformationMode mode = Qt::FastTransformation) const;
^
/usr/local/Cellar/qt@5/5.15.2_1/lib/QtGui.framework/Headers/qpixmap.h:136:12: error: unknown type name ‘QMatrix’
static QMatrix trueMatrix(const QMatrix &m, int w, int h);
^
/usr/local/Cellar/qt@5/5.15.2_1/lib/QtGui.framework/Headers/qpixmap.h:136:37: error: unknown type name ‘QMatrix’
static QMatrix trueMatrix(const QMatrix &m, int w, int h);
^

output.txt (14.8 KB)

I used the following cmake command to build geant4

cmake -DGEANT4_INSTALL_DATA=ON
-DGEANT4_INSTALL_DATADIR="/Users/nibir/Physics/Software/geant4-v11.0.0/G4_data"
-DCMAKE_INSTALL_PREFIX=/Users/nibir/Physics/Software/geant4-v11.0.0/G4_install
-DCMAKE_PREFIX_PATH="/usr/local/Cellar/xerces-c/3.2.3"
-DXERCESC_ROOT_DIR="/usr/local/Cellar/xerces-c/3.2.3"
-DXERCESC_LIBRARY=/usr/local/Cellar/xerces-c/3.2.3/lib/libxerces-c-3.2.dylib
-DGEANT4_USE_OPENGL_X11=ON
-DGEANT4_USE_GDML=ON
-DGEANT4_BUILD_MULTITHREADED=ON
-DGEANT4_USE_QT=ON
-DCMAKE_PREFIX_PATH="/usr/local/Cellar/qt@5/5.15.2_1/lib/cmake"
-DQT_QMAKE_EXECUTABLE=/usr/local/opt/qt@5/bin/qmake
/Users/nibir/Physics/Software/geant4-v11.0.0

I have been trying to resolve this since quite a long time, but I didn’t get any success till now. It would be really nice if someone could help me with it.

Hi

I see you have CMAKE_PREFIX_PATH twice. Not sure that’s OK - the second supersedes the first, I suspect. I would put
-DCMAKE_PREFIX_PATH="/usr/local/Cellar/xerces-c/3.2.3;/usr/local/Cellar/qt@5/5.15.2_1/lib/cmake"

John

Do you have any other Qt installs on the system, such as Homebrew’s main qt package, which is Qt6, or any Anaconda/Conda installs?

Hi, I have brew qt6 installed.
One more information, if I build geant4 with gcc and g++ then I don’t get this error(qt). However I get an error message while running basic example B1.

In the install guide for version 11, it says the QT6 is not supported.

It’s possible that having the main qt (6) Formula installed is causing the build to pick up headers from this ahead of the qt@5 “keg only” that CMake found. Might be that /usr/local is appearing earlier in the include path.

I would try brew unlink qt and then try rebuilding Geant4 (you shouldn’t need to reconfigure, just rebuild). That should diagnose whether this is the case or not.

Note that we don’t test or support building/using Geant4 with GCC on macOS at the moment, so I’d go back to using the system Clang.

2 Likes

Hi Richard,
I am having cmake pointing to qt5.
But as morgan mentioned qt5 and qt6 are probably “mixing” up.
Nibir

hi Morgan,
Thank you so much for the reply. Unlinking qt worked and I could build geant4 with qt enabled using clang.
Now I can run the examples smoothly

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.