svalinn / DAGMC

Direct Accelerated Geometry Monte Carlo Toolkit
https://svalinn.github.io/DAGMC
Other
96 stars 63 forks source link

DAGMC not compatible with Geant4 v11.1.1 #857

Closed ahnaf-tahmid-chowdhury closed 9 months ago

ahnaf-tahmid-chowdhury commented 1 year ago

Recently, I have installed Geant4 and its dependences in my Ubuntu 22.04 machine with Python 3.10.6. Now, I am trying to integrate it with DAGMC. But I am getting compile errors.

commands:

cmake ../ -DMOAB_CMAKE_CONFIG=$env_dir/lib/cmake/MOAB \
  -DMOAB_DIR=$env_dir \
  -DBUILD_STATIC_LIBS=OFF \
  -DBUILD_GEANT4=ON \
  -DGeant4_CMAKE_CONFIG=$env_dir/lib/cmake/Geant4 \
  -DGEANT4_DIR=$env_dir \
  -DCMAKE_INSTALL_PREFIX=$env_dir

Log:

Consolidate compiler generated dependencies of target DagGeant4
[ 81%] Building CXX object src/geant4/app/CMakeFiles/DagGeant4.dir/exampleN01.cc.o
/opt/nuclear-boy/dagmc-repo/src/geant4/app/exampleN01.cc: In function ‘int main(int, char**)’:
/opt/nuclear-boy/dagmc-repo/src/geant4/app/exampleN01.cc:82:5: error: ‘G4UIExecutive’ was not declared in this scope
   82 |     G4UIExecutive* ui = new G4UIExecutive(argc, argv, "tcsh");
      |     ^~~~~~~~~~~~~
/opt/nuclear-boy/dagmc-repo/src/geant4/app/exampleN01.cc:82:20: error: ‘ui’ was not declared in this scope
   82 |     G4UIExecutive* ui = new G4UIExecutive(argc, argv, "tcsh");
      |                    ^~
/opt/nuclear-boy/dagmc-repo/src/geant4/app/exampleN01.cc:82:29: error: expected type-specifier before ‘G4UIExecutive’
   82 |     G4UIExecutive* ui = new G4UIExecutive(argc, argv, "tcsh");
      |                             ^~~~~~~~~~~~~
/opt/nuclear-boy/dagmc-repo/src/geant4/app/exampleN01.cc:85:12: error: type ‘<type error>’ argument given to ‘delete’, expected pointer
   85 |     delete ui;
      |            ^~
/opt/nuclear-boy/dagmc-repo/src/geant4/app/exampleN01.cc:87:5: error: ‘G4VisManager’ was not declared in this scope; did you mean ‘G4VPCManager’?
   87 |     G4VisManager* visManager = new G4VisExecutive;
      |     ^~~~~~~~~~~~
      |     G4VPCManager
/opt/nuclear-boy/dagmc-repo/src/geant4/app/exampleN01.cc:87:19: error: ‘visManager’ was not declared in this scope; did you mean ‘UImanager’?
   87 |     G4VisManager* visManager = new G4VisExecutive;
      |                   ^~~~~~~~~~
      |                   UImanager
/opt/nuclear-boy/dagmc-repo/src/geant4/app/exampleN01.cc:87:36: error: ‘G4VisExecutive’ does not name a type
   87 |     G4VisManager* visManager = new G4VisExecutive;
      |                                    ^~~~~~~~~~~~~~
/opt/nuclear-boy/dagmc-repo/src/geant4/app/exampleN01.cc:90:5: error: ‘G4UIExecutive’ was not declared in this scope
   90 |     G4UIExecutive* UI = new G4UIExecutive(argc, argv);
      |     ^~~~~~~~~~~~~
/opt/nuclear-boy/dagmc-repo/src/geant4/app/exampleN01.cc:90:20: error: ‘UI’ was not declared in this scope
   90 |     G4UIExecutive* UI = new G4UIExecutive(argc, argv);
      |                    ^~
/opt/nuclear-boy/dagmc-repo/src/geant4/app/exampleN01.cc:90:29: error: expected type-specifier before ‘G4UIExecutive’
   90 |     G4UIExecutive* UI = new G4UIExecutive(argc, argv);
      |                             ^~~~~~~~~~~~~
/opt/nuclear-boy/dagmc-repo/src/geant4/app/exampleN01.cc:94:12: error: type ‘<type error>’ argument given to ‘delete’, expected pointer
   94 |     delete visManager;
      |            ^~~~~~~~~~
/opt/nuclear-boy/dagmc-repo/src/geant4/app/exampleN01.cc:95:12: error: type ‘<type error>’ argument given to ‘delete’, expected pointer
   95 |     delete UI;
      |            ^~
make[2]: *** [src/geant4/app/CMakeFiles/DagGeant4.dir/build.make:76: src/geant4/app/CMakeFiles/DagGeant4.dir/exampleN01.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1477: src/geant4/app/CMakeFiles/DagGeant4.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

This error message is indicating that the compiler encountered errors while attempting to build the exampleN01.cc file of a Geant4 application. Specifically, there are several errors related to undefined types and undeclared variables, which suggests that the necessary Geant4 header files and libraries may not have been properly included.

The first error indicates that the type G4UIExecutive was not declared in the current scope. This could indicate that the header file which defines this type was not properly included at the beginning of the source file.

Similarly, the second error indicates that the variable ui was not declared in the current scope, which suggests that the type of ui may also be undefined or not properly declared.

gonuke commented 1 year ago

Thanks for this update. We do have an active PR #803 that was an upgrade to be compatible with v10. If you are interested/able/have time, we'd love an assessment of whether this also fixes for newer versions of Geant4. (tagging @helen-brooks )

ahnaf-tahmid-chowdhury commented 9 months ago

Issue solved by #907