Problem 1660

Summary: Compilation of pyG4gdml with CMake fails
Product: Environments Reporter: Nicola Mori <mori>
Component: g4pyAssignee: Koichi Murakami <Koichi.Murakami>
Status: CLOSED FIXED    
Severity: normal CC: mori
Priority: P5    
Version: 10.0   
Hardware: PC   
OS: Linux   

Description Nicola Mori 2014-07-22 14:42:20 CEST
Configuring the build of g4py in Geant4 10.00.p02 with CMake leads to a failure due to the lack of inclusion of Xerces-C header folder. I configure with:

$ cmake -DXERCESC_ROOT_DIR=/wizard/04/mori/software/install/XERCESC_3.1.1/ -DBOOST_ROOT=/wizard/04/mori/software/install/BOOST_1.55.0/ -DPYTHON_LIBRARY=/wizard/04/mori/software/install/PYTHON_2.7.8/lib/ -DPYTHON_INCLUDE_DIR=/wizard/04/mori/software/install/PYTHON_2.7.8/include/python2.7/ ../
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /wizard/02/LHCfG4_software/installed/external/gcc/bin/gcc
-- Check for working C compiler: /wizard/02/LHCfG4_software/installed/external/gcc/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /wizard/02/LHCfG4_software/installed/external/gcc/bin/c++
-- Check for working CXX compiler: /wizard/02/LHCfG4_software/installed/external/gcc/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found Geant4: /wizard/04/mori/software/install/GEANT4_10.00.p02/bin/.. (10.0.2)
-- Found PythonInterp: /wizard/04/mori/software/install/PYTHON_2.7.8/bin/python (found version "2.7.8")
-- Found PythonLibs: /wizard/04/mori/software/install/PYTHON_2.7.8/lib 
-- Boost version: 1.55.0
-- Found XercesC: /wizard/04/mori/software/install/XERCESC_3.1.1/lib/libxerces-c.so 
-- Found ROOT 5.34/19 in /wizard/04/mori/software/install/ROOT_5.34.19
-- --------------------------------------------------------
-- Parameters for building
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- CMAKE_CXX_COMPILER: /wizard/02/LHCfG4_software/installed/external/gcc/bin/c++
-- CMAKE_INSTALL_PREFIX: /wizard/04/mori/software/source/geant4.10.00.p02/environments/g4py
-- --------------------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /wizard/04/mori/software/source/geant4.10.00.p02/environments/g4py/build


Then, building the target pyG4gdml gives this error:

[100%] Building CXX object source/gdml/CMakeFiles/pyG4gdml.dir/pyG4GDMLParser.cc.o
cd /wizard/04/mori/software/source/geant4.10.00.p02/environments/g4py/build/source/gdml && /wizard/02/LHCfG4_software/installed/external/gcc/bin/c++   -DpyG4gdml_EXPORTS -DENABLE_GDML -Wwrite-strings -Wno-variadic-macros -Wno-long-long -ansi -pipe -ftemplate-depth-255 -finline-functions -fpermissive -DBOOST_PYTHON_DYNAMIC_LIB -O2 -g -fPIC -I/wizard/04/mori/software/install/PYTHON_2.7.8/include/python2.7 -I/wizard/04/mori/software/source/geant4.10.00.p02/environments/g4py/source/boost -I/wizard/04/mori/software/install/GEANT4_10.00.p02/bin/../include/Geant4    -o CMakeFiles/pyG4gdml.dir/pyG4GDMLParser.cc.o -c /wizard/04/mori/software/source/geant4.10.00.p02/environments/g4py/source/gdml/pyG4GDMLParser.cc
In file included from /wizard/04/mori/software/install/GEANT4_10.00.p02/bin/../include/Geant4/G4GDMLReadDefine.hh:45:0,
                 from /wizard/04/mori/software/install/GEANT4_10.00.p02/bin/../include/Geant4/G4GDMLReadMaterials.hh:45,
                 from /wizard/04/mori/software/install/GEANT4_10.00.p02/bin/../include/Geant4/G4GDMLReadSolids.hh:44,
                 from /wizard/04/mori/software/install/GEANT4_10.00.p02/bin/../include/Geant4/G4GDMLReadSetup.hh:47,
                 from /wizard/04/mori/software/install/GEANT4_10.00.p02/bin/../include/Geant4/G4GDMLReadParamvol.hh:43,
                 from /wizard/04/mori/software/install/GEANT4_10.00.p02/bin/../include/Geant4/G4GDMLReadStructure.hh:46,
                 from /wizard/04/mori/software/install/GEANT4_10.00.p02/bin/../include/Geant4/G4GDMLParser.hh:43,
                 from /wizard/04/mori/software/source/geant4.10.00.p02/environments/g4py/source/gdml/pyG4GDMLParser.cc:35:
/wizard/04/mori/software/install/GEANT4_10.00.p02/bin/../include/Geant4/G4GDMLRead.hh:42:47: fatal error: xercesc/parsers/XercesDOMParser.hpp: No such file or directory
compilation terminated.


It seems that the proper -I flag for Xerces-C headers folder is missing, even if during configuration no error/warning has come out. If I add the flag:

  -I/wizard/04/mori/software/install/XERCESC_3.1.1/include

the file is compiled without errors.
Comment 1 Koichi Murakami 2015-12-11 06:36:32 CET
Fixed in the 10.1 release.

Add the following line  in CMakeLists.txt in source/gdml/

include_directories (${XERCESC_INCLUDE_DIRS})