# Errors while building geant4 with qt5

**URL:** <https://geant4-forum.web.cern.ch/t/errors-while-building-geant4-with-qt5/7031>\
**Category:** Getting Started\
**Created:** [January 27, 2022, 10:19pm UTC](https://geant4-forum.web.cern.ch/t/errors-while-building-geant4-with-qt5/7031 "2022-01-27T22:19:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nibir](https://geant4-forum.web.cern.ch/letter_avatar_proxy/v4/letter/n/51bf81/32.png) [@Nibir](https://geant4-forum.web.cern.ch/u/Nibir)\
**Post date:** [January 27, 2022, 10:19pm UTC](https://geant4-forum.web.cern.ch/t/errors-while-building-geant4-with-qt5/7031/1 "2022-01-27T22:19:47Z")

</div>

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](https://geant4-forum.web.cern.ch/uploads/short-url/aykDHurPjliuQCLKMUvrGlN298I.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.

---

<div class="post-metadata">

**Author:** ![allison](https://geant4-forum.web.cern.ch/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@allison](https://geant4-forum.web.cern.ch/u/allison)\
**Post date:** [January 31, 2022, 8:47am UTC](https://geant4-forum.web.cern.ch/t/errors-while-building-geant4-with-qt5/7031/2 "2022-01-31T08:47:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bmorgan](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/bmorgan/32/7_2.png) [@bmorgan](https://geant4-forum.web.cern.ch/u/bmorgan)\
**Post date:** [February 1, 2022, 7:52pm UTC](https://geant4-forum.web.cern.ch/t/errors-while-building-geant4-with-qt5/7031/3 "2022-02-01T19:52:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Nibir](https://geant4-forum.web.cern.ch/letter_avatar_proxy/v4/letter/n/51bf81/32.png) [@Nibir](https://geant4-forum.web.cern.ch/u/Nibir)\
**Post date:** [February 1, 2022, 8:12pm UTC](https://geant4-forum.web.cern.ch/t/errors-while-building-geant4-with-qt5/7031/4 "2022-02-01T20:12:55Z")

</div>

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.

 ![Screen Shot 2022-02-01 at 3.12.29 PM](https://geant4-forum.web.cern.ch/uploads/default/original/2X/2/279d42cb5a5c4a2fd1d4c3802e83c69e74f0ec13.jpeg)

---

<div class="post-metadata">

**Author:** ![Richard\_Foster](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/richard_foster/32/785_2.png) [@Richard\_Foster](https://geant4-forum.web.cern.ch/u/Richard_Foster)\
**Post date:** [February 2, 2022, 5:44pm UTC](https://geant4-forum.web.cern.ch/t/errors-while-building-geant4-with-qt5/7031/5 "2022-02-02T17:44:38Z")

</div>

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

 ![image](https://geant4-forum.web.cern.ch/uploads/default/original/2X/3/3a727645cf1c39fed29653c564e9af0438371aa2.png)

---

<div class="post-metadata">

**Author:** ![bmorgan](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/bmorgan/32/7_2.png) [@bmorgan](https://geant4-forum.web.cern.ch/u/bmorgan)\
**Post date:** [February 2, 2022, 7:21pm UTC](https://geant4-forum.web.cern.ch/t/errors-while-building-geant4-with-qt5/7031/6 "2022-02-02T19:21:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Nibir](https://geant4-forum.web.cern.ch/letter_avatar_proxy/v4/letter/n/51bf81/32.png) [@Nibir](https://geant4-forum.web.cern.ch/u/Nibir)\
**Post date:** [February 2, 2022, 10:15pm UTC](https://geant4-forum.web.cern.ch/t/errors-while-building-geant4-with-qt5/7031/7 "2022-02-02T22:15:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nibir](https://geant4-forum.web.cern.ch/letter_avatar_proxy/v4/letter/n/51bf81/32.png) [@Nibir](https://geant4-forum.web.cern.ch/u/Nibir)\
**Post date:** [February 4, 2022, 9:11pm UTC](https://geant4-forum.web.cern.ch/t/errors-while-building-geant4-with-qt5/7031/8 "2022-02-04T21:11:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://geant4-forum.web.cern.ch/uploads/default/original/1X/ce519a43ebdf7ac48a98a03c6ad6eea013b68c46.png) [@system](https://geant4-forum.web.cern.ch/u/system)\
**Post date:** [February 11, 2022, 9:11pm UTC](https://geant4-forum.web.cern.ch/t/errors-while-building-geant4-with-qt5/7031/9 "2022-02-11T21:11:58Z")

</div>

Closed on February 11, 2022, 9:11pm UTC

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