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.

1 Like

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: Visual Studio 16 2019 ā€” CMake 3.14.7 Documentation

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