jintonic/gears

Enable GDML in Windows

mahmoodeid opened this issue · 20 comments

Hi,

I have the same problem as previous issue:
/geometry/export gears.gdml
command not found error

Even though I have the GDML module installed (enabled while building Geant4). I tested the GDML reader in a Geant4 application and it worked.

Do you suggest something to make the GDML function works in gears excuatable?

Thanks

Have you recompiled gears after you enabled GDML in your Geant4 installation?

Yes, I recompiled gears multiple times after I enabled GDML during the installation of Geant4. Do I need to change anything in gears.cc to force picking up the gdml headers?

I see that you are in Windows. GEARS relies on CMake to grab information from Geant4. https://github.com/jintonic/gears/blob/master/CMakeLists.txt did not include gdml. This was indeed a issue for compiling GEARS in Windows. I just added the following lines in this file:

# if qt or gdml is compiled in Geant4, use it, otherwise, don't complain
find_package(Geant4 QUIET COMPONENTS qt gdml)

Please update your GEARS and try again. Thank you for identifying this issue!

Thank you very much for your help. I tried updating gears and the problem is still the same. Can I force CMake to to grab the information from Geant4 about the gdml?

Yes, you can. But you may want to run cmake GUI in Windows to check Geant4 CMake setups. You need to make sure that GDML module is available in the CMake system in Geant4.

image

I have this in the geant4/lib folder.

I'm configuring gears with CMake GUI as the following:

image

Should I add the path of the GDML header files?

Sorry for the inconvenience.

I see in your CMake window Qt related setups are recognized, which means the line I added to gears/CMakeLists.txt works:

find_package(Geant4 QUIET COMPONENTS qt gdml)

If it works for Qt, it must work for gdml as well. However, nothing related to gdml is shown in that window. Do you have to pass -DXERCESC_ROOT_DIR=... to your cmake as well?

Hi,

The Qt related setup was also recognized before adding the line to the gears/CMakeLists.txt I passed the DXERCESC_ROOT_DIR= but it is not working still.

I see. Could you please check the folder where your compiled Geant4 libraries are located to see if there is something like libG4gdml? Please also check if you can find something like libG4qt.

I share here the lib folder of my Geant4 installation:
image

I can not find something like libG4gdml or libG4qt

As i understood from Geant4 installation manual below, the GDML support is included in G4persistency

image

You are right. In Linux I can check whether gdml functions are included in libG4persistency using

nm -D libG4persistency.so|grep -i gdml

and I can see GDML related stuff in it.

Maybe there is a way to do that in Windows as well?

Hi, I tried with DUMPBIN command to see the GDML components in G4persistency.lib and I could see some traces of it but mostly about XERCESC.

I decided to build Geant4 again and see if building Gears after can pick up the GDML compinent. If not, I will have to switch to Linux probably.

Thanks,

Good to know. I am compiling Geant4 on Windows 10 as well to know more about this less popular option for running Geant4. I noticed that the output of the CMake GUI is very helpful to understand what kind of features are enabled. If you cannot solve the problem, could you please share with me the output of your Geant4 CMake output?

My Geant4 compilation in Windows finished. The command

dumpbin.exe /exports .\G4persistency.lib | findstr /i "gdml"

Returns nothing as I did not enable it. I will try to compile Geant4 with GDML and try this command again.

Hi,

Thank you very much for your help. I run the command you gave: dumpbin.exe /exports .\G4persistency.lib | findstr /i "gdml"

Here's the output I got:
dumpbin_gdml.txt

I can see error handlers but I don't understand the flushed output.

I attached the Cmake output in my build folder of the current installation of Geant4 (I did not yet build Geant4 again)

cmake_install.cmake.txt
Geant4Config.cmake.txt
Geant4LibraryDepends.cmake.txt
Geant4PackageCache.cmake.txt

I will wait until you finish your test on WIN10, then I will rebuild again XERCESC, Geant4, and Gears.

Thanks

It looks like that you have GDML included in G4persistency.lib. I will come back to you after I try everything on my side.

OK. Problem solved. Your Geant4 compilation should be fine since you can find GDML related things in your G4persistency.lib. I added the following code to the GEARS' CMakeLists.txt:

if(XercesC_INCLUDE_DIR)
  add_definitions(-DhasGDML)
endif()

to automatically enable compiling GDML related code in GEARS if "XercesC_INCLUDE_DIR" is found, which is a variable that can be found by both cmake-gui.exe and Visual Studio. I tried in both of them and both worked. Please update your GEARS and try on your side and let me know how it goes.

Thank you for identifying this problem in GEARS!

By the way, if you directly use make to compile GEARS without CMake in Linux or Mac, this problem will not appear. That's why I did not realize it earlier.

Dear Jing Liu,

It works now perfectly. Thank you very much for taking the time to help me. I really appreciate it. Keep up the good work.

Regards,
Mahmoud

I am glad that we got it fixed. Thank you for testing. I updated the CMakeLists.txt a bit further to set the default configuration from "Debug" to "Release"' and the default target from "ALL_BUILD" to "gears", which makes the configuration of gears in CMake-GUI even easier. Issue closed.