GEANT4 installation breaks on MacOS Mojave 10.14

Hello,

I am trying to install Geant4 (geant4.10.04) on my MAC laptop, which has Mojave 10.14, and Xcode 9.4.1
gcc.exec (GCC) 9.2.0

I am using the following command to build -

“cmake -DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt/5.14.0/ -DCMAKE_INSTALL_PREFIX=/Users/mansisaxena/geant4_10.04/geant4.10.04-install/ -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_QT=ON …/geant4.10.04.p03/”

the build fails with the following error -

In file included from /Users/mansisaxena/geant4_10.04/geant4.10.04.p03/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh:45:
In file included from /usr/local/opt/qt@5/lib/QtCore.framework/Headers/qobject.h:54:
In file included from /usr/local/lib/QtCore.framework/Headers/qmetatype.h:49:
In file included from /usr/local/lib/QtCore.framework/Headers/qdatastream.h:46:
/usr/local/lib/QtCore.framework/Headers/qiodevice.h:168:5: error: use of undeclared identifier ‘d_ptr’
/usr/local/lib/QtCore.framework/Headers/qglobal.h:2584:113: note: expanded from macro ‘Q_DECLARE_PRIVATE’
inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr)); }
^
In file included from /Users/mansisaxena/geant4_10.04/geant4.10.04.p03/source/visualization/OpenGL/src/G4OpenGLImmediateQt.cc:39:
In file included from /Users/mansisaxena/geant4_10.04/geant4.10.04.p03/source/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh:39:
In file included from /Users/mansisaxena/geant4_10.04/geant4.10.04.p03/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh:45:
/usr/local/opt/qt@5/lib/QtCore.framework/Headers/qobject.h:56:10: fatal error: ‘QtCore/qobject_impl.h’ file not found
#include <QtCore/qobject_impl.h>
^~~~~~~~~~~~~~~~~~~~~~~
4 errors generated.
make[2]: *** [source/visualization/OpenGL/CMakeFiles/G4OpenGL.dir/src/G4OpenGLImmediateQt.cc.o] Error 1
make[1]: *** [source/visualization/OpenGL/CMakeFiles/G4OpenGL.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs…
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/lists/src/QBBC.cc.o
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/lists/src/G4PhysListRegistry.cc.o
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/lists/src/G4PhysListFactoryAlt.cc.o
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/util/src/G4PhysListUtil.cc.o
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/util/src/G4WarnPLStatus.cc.o
[100%] Linking CXX shared library …/…/BuildProducts/lib/libG4physicslists.dylib
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
[100%] Built target G4physicslists
make: *** [all] Error 2

Prior, to this I had started with installing the Version 10.06.03 on my Mac machine, I could it successfully, but I could not execute the examples. There was a error.

Any help ???

Thanks
Mansi

Hi Mansi,

does it help to specify the path to qmake with
-DQT_QMAKE_EXECUTABLE=/wherever/that/may/be
instead of using
-DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt/5.14.0/?

I guess you have tested your Qt5 installation that you can compile and run the Qt5 test programs?

Cheers,
–U.

thanks !

I changed in my ~/.profile to have the line -
(Earlier I had the one in comments.)

#export PATH=“/usr/local/opt/qt@5/bin:$PATH”
export PATH=“/usr/local/Cellar/qt/5.14.0/lib/cmake:$PATH”

Opened a new terminal and did the re-build.

But, again the same error -

/usr/local/lib/QtCore.framework/Headers/qglobal.h:2583:95: note: expanded from macro ‘Q_DECLARE_PRIVATE’
inline Class##Private* d_func() { return reinterpret_cast<Class##Private >(qGetPtrHelper(d_ptr)); }
^
In file included from /Users/mansisaxena/geant4_10.04/geant4.10.04.p03/source/visualization/OpenGL/src/G4OpenGLImmediateQt.cc:39:
In file included from /Users/mansisaxena/geant4_10.04/geant4.10.04.p03/source/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh:39:
In file included from /Users/mansisaxena/geant4_10.04/geant4.10.04.p03/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh:45:
In file included from /usr/local/opt/qt@5/lib/QtCore.framework/Headers/qobject.h:54:
In file included from /usr/local/lib/QtCore.framework/Headers/qmetatype.h:49:
In file included from /usr/local/lib/QtCore.framework/Headers/qdatastream.h:46:
/usr/local/lib/QtCore.framework/Headers/qiodevice.h:168:5: error: use of undeclared identifier ‘d_ptr’
/usr/local/lib/QtCore.framework/Headers/qglobal.h:2584:113: note: expanded from macro ‘Q_DECLARE_PRIVATE’
inline const Class##Private
d_func() const { return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr)); }
^
In file included from /Users/mansisaxena/geant4_10.04/geant4.10.04.p03/source/visualization/OpenGL/src/G4OpenGLImmediateQt.cc:39:
In file included from /Users/mansisaxena/geant4_10.04/geant4.10.04.p03/source/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh:39:
In file included from /Users/mansisaxena/geant4_10.04/geant4.10.04.p03/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh:45:
/usr/local/opt/qt@5/lib/QtCore.framework/Headers/qobject.h:56:10: fatal error: ‘QtCore/qobject_impl.h’ file not found
#include <QtCore/qobject_impl.h>
^~~~~~~~~~~~~~~~~~~~~~~
4 errors generated.
make[2]: *** [source/visualization/OpenGL/CMakeFiles/G4OpenGL.dir/src/G4OpenGLImmediateQt.cc.o] Error 1
make[1]: *** [source/visualization/OpenGL/CMakeFiles/G4OpenGL.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs…
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/lists/src/G4PhysListFactory.cc.o
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/lists/src/G4PhysListFactoryMessenger.cc.o
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/lists/src/QBBC.cc.o
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/lists/src/G4PhysListRegistry.cc.o
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/lists/src/G4PhysListFactoryAlt.cc.o
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/util/src/G4PhysListUtil.cc.o
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/util/src/G4WarnPLStatus.cc.o
[100%] Linking CXX shared library …/…/BuildProducts/lib/libG4physicslists.dylib
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
[100%] Built target G4physicslists
make: *** [all] Error 2

But I guess it takes the old path.
Not sure of it.
To have the executable - will it be the same path - export PATH=“/usr/local/Cellar/qt/5.14.0/lib/cmake:$PATH” ???

Thanks

I have had Qt5 ‘installations’ where qmake was missing. I never managed to compile/link against such QT5 installations successfully. Empirically I found that if I have qmake available (and know where it is), things improve considerably. For me, all went well once I provided the qmake location (on linux and MacOS). I guess that providing qmake might be not exactly identical to having the PATH more or less correct.

I don’t know where your qmake would be. If your qmake is properly installed and the PATH is correct, then which qmake should give you the location. Else you may have more luck with locate qmake. If not, then another Qt5 installation would be in order, imvho. In my limited experience, building QT5 from source was where I ended up (brew and other approaches did not lead to success in my attempts, but this is probably not brew’s fault, I just did not manage).

Cheers,
–U.

HI,

Thanks.

So it seems I have multiple, qt installation in my system.

Mansis-MacBook-Air:~ mansisaxena$ which qmake

/usr/local/bin/qmake

Mansis-MacBook-Air:~ mansisaxena$

I am uploading the output of locate qmake also.

which path should be used now ?

thanks
a.txt (44.2 KB)

I would guess that your /usr/local/bin/qmake is a link to somewhere. If that qmake is a good choice (i.e. qmake --version works and it is not QT4), then I would start trying with that, i.e. invoking cmake with (among other options)

-DQT_QMAKE_EXECUTABLE=/usr/local/bin/qmake

Cheers,
–U.

thanks for the reply.

Mansis-MacBook-Air:~ mansisaxena$ qmake --version

QMake version 2.01a

Using Qt version 4.8.7 in /usr/local/lib

Mansis-MacBook-Air:~ mansisaxena$

so this points to Qt4.

So, I have now unlinked the this older version and linked it to Qt5

Mansis-MacBook-Air:~ mansisaxena$ qmake --version

QMake version 3.1

Using Qt version 5.15.2 in /usr/local/Cellar/qt@5/5.15.2/lib

Mansis-MacBook-Air:~ mansisaxena$

is this a good choice now,

-DQT_QMAKE_EXECUTABLE=/usr/local/Cellar/qt@5/5.15.2/lib

wishes,
M

not quite, QMAKE_EXECUTABLE should point to the qmake executable. fill the results of which qmake
which presumably (

) again gives you /usr/local/bin/qmake,
hence

-DQT_QMAKE_EXECUTABLE=/usr/local/bin/qmake

Ok Thanks.
Using this, I did a successful build of Geant4.
Next, I am trying to run the example given in /basic folder.

Mansis-MacBook-Air:B1example mansisaxena$ mkdir build

Mansis-MacBook-Air:B1example mansisaxena$ cd build/

Mansis-MacBook-Air:build mansisaxena$ cmake …

CMake Deprecation Warning at CMakeLists.txt:5 (cmake_minimum_required):

Compatibility with CMake < 2.8.12 will be removed from a future version of

CMake.

Update the VERSION argument value or use a … suffix to tell

CMake that the project does not need compatibility with older versions.

– The C compiler identification is AppleClang 9.1.0.9020039

– The CXX compiler identification is AppleClang 9.1.0.9020039

– Detecting C compiler ABI info

– Detecting C compiler ABI info - done

– Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped

– Detecting C compile features

– Detecting C compile features - done

– Detecting CXX compiler ABI info

– Detecting CXX compiler ABI info - done

– Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped

– Detecting CXX compile features

– Detecting CXX compile features - done

– Configuring done

– Generating done

– Build files have been written to: /Users/mansisaxena/geant4_10.04/geant4.10.04-install/share/Geant4-10.4.3/examples/basic/B1example/build

Mansis-MacBook-Air:build mansisaxena$ make

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

[ 25%] Building CXX object CMakeFiles/exampleB1.dir/src/B1ActionInitialization.cc.o

[ 37%] Building CXX object CMakeFiles/exampleB1.dir/src/B1DetectorConstruction.cc.o

[ 50%] Building CXX object CMakeFiles/exampleB1.dir/src/B1EventAction.cc.o

[ 62%] Building CXX object CMakeFiles/exampleB1.dir/src/B1PrimaryGeneratorAction.cc.o

[ 75%] Building CXX object CMakeFiles/exampleB1.dir/src/B1RunAction.cc.o

[ 87%] Building CXX object CMakeFiles/exampleB1.dir/src/B1SteppingAction.cc.o

[100%] Linking CXX executable exampleB1

ld: warning: URGENT: building for OSX, but linking against dylib (/System/Library/Frameworks//OpenGL.framework/OpenGL) built for (unknown). Note: This will be an error in the future.

ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.

ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.

[100%] Built target exampleB1

Mansis-MacBook-Air:build mansisaxena$ ./exampleB1

objc[10336]: Class QMacAutoReleasePoolTracker is implemented in both /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore (0x10389d978) and /usr/local/opt/qt@5/lib/QtCore.framework/Versions/5/QtCore (0x1023b9b00). One of the two will be used. Which one is undefined.

objc[10336]: Class QT_ROOT_LEVEL_POOL__THESE_OBJECTS_WILL_BE_RELEASED_WHEN_QAPP_GOES_OUT_OF_SCOPE is implemented in both /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore (0x10389d9f0) and /usr/local/opt/qt@5/lib/QtCore.framework/Versions/5/QtCore (0x1023b9b78). One of the two will be used. Which one is undefined.

objc[10336]: Class KeyValueObserver is implemented in both /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore (0x10389da18) and /usr/local/opt/qt@5/lib/QtCore.framework/Versions/5/QtCore (0x1023b9ba0). One of the two will be used. Which one is undefined.

objc[10336]: Class RunLoopModeTracker is implemented in both /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore (0x10389da68) and /usr/local/opt/qt@5/lib/QtCore.framework/Versions/5/QtCore (0x1023b9bf0). One of the two will be used. Which one is undefined.

objc[10336]: Class QCocoaPageLayoutDelegate is implemented in both /usr/local/opt/qt@5/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (0x105c34470) and /usr/local/opt/qt/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (0x1027813a8). One of the two will be used. Which one is undefined.

objc[10336]: Class QCocoaPrintPanelDelegate is implemented in both /usr/local/opt/qt@5/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (0x105c344e8) and /usr/local/opt/qt/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (0x102781420). One of the two will be used. Which one is undefined.

Available UI session types: [ Qt, GAG, tcsh, csh ]

A visual graphical screen does pop up. But all these warning which I get while running the example, how to avoid these ?

Thanks,
M

If things work fine, why bother?

otherwise: read the warnings very carefully and try to understand what they mean. Most likely it is not geant4 related, so maintainers here will kindly point that out to you :smiley:

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