Qt installation (Qt5OpenGL.dll was not found)

Hi. I am looking for help with the Geant4 installation using Qt5 as the visualization driver.

Following the instruction, I was able to build and install Geant4 using Win32 OpenGL without any problem.I could also run the B1 exercise.

However, when I install Geant4 with Qt5.15 and run the B1 exercise, error messages pop up saying the following dll files are missing.

Qt5OpenGL.dll
Qt5Widgets.dll
Qt5Gui.dll
Qt5Core.dll

I am using VS2019 (community) on Windows 10 and geant4_10_06_p02. I doublechecked the OpenGL driver is installed (version 4.6.0). and I was able to locate those dll files in the Qt5 directory (C:\Qt\5.15.0\msvc2019\bin). I believe I set the DCMAKE_PREFIX_PATH correctly:

cmake -DCMAKE_INSTALL_PREFIX=/path/to/geant4.10.06-install -DCMAKE_PREFIX_PATH=“C:\Qt\5.15.0\msvc2019\lib\cmake” -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_QT=ON -DGEANT4_BUILD_MSVC_MP=ON /path/to/geant4.10.06

Some postings on the internet suggest to check the bitness. I tried all different versions of Qt5 (msvc2019, msvc2019_64, winrt_x86_msvc2019, winrt_x64_msvc2019). I also tried different versions (e.g., x64 Native Tools Command Prompt) of command prompt for VS2019. None of them worked. I still feel the bitness may be the source of the problem, but I do not know what else I can try.

Can you please help? Thank you.

Is the directory holding Qt5OpenGL.dll etc in the PATH environment variable? That’s needed so that the application can find these DLLs.

Thank you for the suggestion. Indeed the directory is not included in the PATH, but I wonder why it has not been added by the Qt5 installer…

I am stuck with another problem, which I think may be related to the original problem. The thing is that I cannot even install the geant4 now.

Following the installation instruction, here are the 3 steps that I made:

  1. cmake -DCMAKE_INSTALL_PREFIX=/path/to/geant4.10.06-install -DCMAKE_PREFIX_PATH=“C:\Qt\5.15.0\msvc2019\lib\cmake” -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_QT=ON -DGEANT4_BUILD_MSVC_MP=ON /path/to/geant4.10.06
    -> OK.

  2. cmake --build . --config Release
    -> This runs without any error message.

  3. cmake --build . --config Release --target install
    -> This stops with the following error message:

Qt5Widgets.lib(Qt5Widgets.dll) : fatal error LNK1112: module machine type ‘x86’ conflicts with target machine type ‘x64’

I assume the error occurs because the program tries to link 64-bit Qt5. However, I am not sure why it does so. The directory I gave is for 32-bit Qt5 (-DCMAKE_PREFIX_PATH=“C:\Qt\5.15.0\msvc2019\lib\cmake”)…

Additional description of the problem…
After running ‘cmake --build . --config Release’ in the build directory, the ‘Release’ directory is made under ‘x64’. I guess the problem is that it tries to install a 64-bit version of Geant4 using a 32-bit Qt.

Is there a way to enforce the 32-bit version of Geant4 to be installed? I have tried x86 Native Tools Command Prompt, but the result is the same (Release under x64).

I also tried to link the 64-bit Qt by using -DCMAKE_PREFIX_PATH=“C:\Qt\5.15.0\msvc2019_64\lib\cmake”, but this didn’t work.

Adding the directory holding Qt5OpenGL.dll in the Path environment variable didn’t work either.

Is there anyone who installed the Geant4 and Qt5 on Windows10 using Visual Studio 2019? This is one of the platforms suggested in the installation guide, but it doesn’t look to work…

If you ran this after the previous invocation, it’s likely that CMake cached the previously found 32bit Qt. It should be possible to remove the CMakeCache.txt file in the build directory, then rerun CMake with the new CMAKE_PREFIX_PATH argument to pick up and use the 64bit Qt. Visual Studio should be smart enough here not to require rebuilding everything, just what’s changed.

The other option is to set the target architecture with the -A argument to CMake. See for example: https://cmake.org/cmake/help/v3.14/generator/Visual%20Studio%2016%202019.html

I tried the Windows version of Cmake and everything works OK; I can install Geant4 and run examples.
Thanks much!