Message: Geant4/expat.h and a new geant4-config option for include ? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Geant4/expat.h and a new geant4-config option for include ? 

Forum: Installation and Configuration
Date: Mar 19, 12:11
From: Guy Barrand <Guy Barrand>

    Dear all

 I stumbled on a conflict with expat due to the fact that there is an expat.h under :
    <geant4_install_path>/include/Geant4
(I use the last Geant4-10.5).

 Somewhere I finished, in the build of an app, to pick the Geant4/expat.h at compile time, but linked 
with another expat and... crashed due to incompatible versions of expat.

 One problem is that, as a lot of people around, I include the Geant4 headers (for example globals.hh) with :
    #include "globals.hh"
or :
    #include <globals.hh>
and then use the :
    geant4-config --cflags
to compile, which contains a "-I" toward <geant4_install_path>/include/Geant4. Which then induced to 
take the  Geant4 expat.h for me.

 After examining the build system of the app, I swapped some "-L" and had been able to run. But it is a 
potential fall-trap to have some quite common includes as expat.h, zlib.h, zconf.h being pointed to by
the "geant4-config --cflags".

 To avoid this potential problem I thought to change the code, with :
    #include <Geant4/globals.hh>

(which should be anyway the right way to go !). But then the "geant4-config --cflags" is no more helpful 
since the "-I" is not pointing to :
    <geant4_install_path>/include

 Then, it would be great, or to prefix the expat.h, zlib.h, zconf.h with G4, which would be consistent with 
the G4 prefix of libG4expat and libG4zlib, or, much better and simpler, to arrange to have geant4-config 
be able to return a "-I" on :
    <geant4_install_path>/include

 A lot of packages, in their "config" program separate the "-I" from the "flags" by having a "--incs" option. 
It is probably too late to change the today "--cflags" in geant4-config,  but then I would suggest to add 
an option "--cflags_only" with the flags only, and a "--incs" with the "-I" pointing to :
    <geant4_install_path>/include
for people wanting to use the :
    #include <Geant4/globals.hh>
way of including.

 (Or to have some "--cflags<something>" having the flags and the "-I" toward <geant4_install_path>/include).

 (In the build system of my app, I can surely tweak the return of "--cflags" with some "sed" to change the 
path, but some new option would be much more clean).

 To argue more for such option(s), I observe that there is a lot of files in include/Geant4 that are not prefixed 
with "G4" and that may clash with other packages. Being able to use the :
     #include <Geant4/globals.hh>
way of including, by using geant4-config, would permit to handle them properly.

 (And sorry for the noise, if such option in geant4-config is already in the pipe line...)

   Cheers. Guy

 Add Message Add Message
to: "Geant4/expat.h and a new geant4-config option for include ?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]