Macos 11.6.6 conda installation + GUI

Possibly related to this issue in the geant4-feedstock.

Setup

OS: macos Big Sur 11.6.6
conda: 4.12.0
Geant4: 11.0.1
qt: 5.12.9

Steps to reproduce

Create a conda environment, try to compile and run example B1,

conda create --name test-g4-tutorial geant4 compilers cmake make
conda activate test-g4-tutorial
mkdir test-g4-tutorial
cd test-g4-tutorial
cmake $CONDA_PREFIX/share/Geant4-11.0.1/examples/basic/B1
make -j4
./exampleB1 run2.mac

Expected output

No crashes, some GUI stuff

Actual output

Cutting stdout for brevity, it get stuck after last line

[.....]
# "Envelope" is transparent blue to represent water
/vis/geometry/set/colour Envelope 0 0 0 1 .3
/vis/scene/notifyHandlers
/vis/viewer/set/style surface
/vis/viewer/set/hiddenMarker true
/vis/viewer/set/viewpointThetaPhi 120 150
#
# Re-establish auto refreshing and verbosity:
/vis/viewer/set/autoRefresh true
/vis/viewer/refresh
/vis/verbose warnings
Visualization verbosity changed to warnings (3)
#
# For file-based drivers, use this to create an empty detector view:
#/vis/viewer/flush
 Changing export format to "jpg"

Further information

From output of geant4-config -h I can see,

Known Features:
 staticlibs[no]
 multithreading[yes]
 smartstack[no]
 php_as_hp[no]
 clhep[no]
 expat[no]
 zlib[no]
 gdml[yes]
 ptl[yes]
 usolids[no]
 freetype[yes]
 hdf5[no]
 g3tog4[no]
 qt[yes]
 motif[no]
 raytracer-x11[no]
 opengl-x11[no]
 openinventor[no]

Hi Michele

I’m not familiar with conda, but what’s strange about the above is that run2.mac does not use visualisation, so it looks like you are not picking it up. It looks like you are running exampleB1 without arguments, in which case it executes vis/mac. But why it should get stuck is probably due to some other issue.

John

I tried also

./exampleB1

which does the same

./exampleB1 run1.mac

which seems to conclude “fine” (but being a noob, I have no idea what I should see, if anything, given that the documentation is not very clear to me)

It seems clear from there that by running ./exampleB1 I should get the Idle> command line, but it doesn’t happen.

Should I just open an issue here or do you know some expert in this forum?

OK maybe I found what the problem is.

On Ubuntu 20.04 LTS the same conda package works with OpenGL.

On macos 11.6.6 it doesn’t work because the environment ships Qt 5.12 which supported up to macos 10.14

As far as I can see here the conda package for macos >=11 must use Qt6

Perhaps I will open an issue on the repository for that package

Hi Michele

I’m afraid Geant4 is not Qt6-ready. (Hopefully the next release.) I’m running fine with Qt 5.15.2 on Mac 10.15.7. Also I believe my colleagues are running with Qt5 on MacOS 11 (can anyone verify that?). But if you are on MacOS 11 and conda requires Qt6, you will not be able to run with Qt.

However, as you probably know, you can run without Qt and get plain non-interactive windows with GEANT4_USE_OPENGL_X11 (you need XQuartz on Mac). To zoom, rotate, etc., you can use G4 built-in commands such as /vis/viewer/zoom - use ls or help to see commands and their guidance. You can get a window with some limited interactivity by installing motif (e.g., OpenMotif) and setting GEANT4_USE_XM.

Hope this helps
John

Yes, this sounds right

You are the seond person to tell me that, I would also like to know how this is possible :slight_smile:

the problem is more Qt than conda, conda is really installing the latest available Qt for macos, so it’s doing the right thing

as far as I know OpenGL was deprecated in macOS 10.14 from which the Metal framework is instead used

also wouldn’t this solution require to compile Geant4 within the environment, instead of installing the conda package?

Thanks

Dear all,

apparently export QT_MAC_WANTS_LAYER=1 solves the problem!
I think this also fixes this thread.

Thanks for doing the research and reporting this, Michele. Very good to know.

John