Problem 1322

Summary: cmake -DGEANT4_USE_SYSTEM_ZLIB="ON" does not define G4LIB_USE_ZLIB in cpp
Product: Geant4 Reporter: Olivier LAHAYE <olivier.lahaye1>
Component: cmakeAssignee: Ben Morgan <Ben.Morgan>
Status: CLOSED FIXED    
Severity: trivial    
Priority: P5    
Version: 9.5   
Hardware: All   
OS: All   
See Also: http://bugzilla-geant4.kek.jp/show_bug.cgi?id=1291
Attachments: Fixes architecture.gmk for G4LIB_USE_ZLIB
replace hardcoded G4zlib by ${ZLIB_LIBRARIES} in HepRep/sources.cmake
add_definitions(-DG4LIB_USE_ZLIB) so G4HepRepSceneHandler.cc uses zlib

Description Olivier LAHAYE 2012-06-08 16:16:38 CEST
Created attachment 171 [details]
Fixes architecture.gmk for G4LIB_USE_ZLIB

cmake -DGEANT4_USE_SYSTEM_ZLIB="ON" does not define G4LIB_USE_ZLIB in cpp flags and thus libG4visHepRep.so is build without zlib compression support.

In order to fix this, the following attached patches need to be applyed.
(see next attachments)


geant4.9.5.p01_zlib.patch: fixes architecture.gmk (not realy related to cmake, but usefull anyway) (taken and adapted from gentoo packaging patches here: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sci-physics/geant/files/geant-4.9.3-zlib.patch?hideattic=0&view=log)

geant-4.9.4-zlib.patch: fixes HepRep/sources.cmake
replace hardcoded G4zlib by ${ZLIB_LIBRARIES} created from FindZLIB.cmake
Note: needs to populate ZLIB_LIBRARIES with G4zlib if we are not using external ZLIB (patch not provided (need to be done))
Patch taken from gentoo build here: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sci-physics/geant/files/geant-4.9.4-zlib.patch?hideattic=0&view=log

geant4.9.5.p01_zlibflag.patch: fixes build of geant4.9.5.p01/source/visualization/HepRep/src/G4HepRepSceneHandler.cc line 209. cmake build system does not define -DG4LIB_USE_ZLIB, thus even if the link is done with the correct zlib, this zlib is not used
this patch adds "add_definitions(-DG4LIB_USE_ZLIB)" to Geant4OptionalComponents.cmake .
this patch was done by me and I'm not sure this is the correct way to do things. and this flag is only related to G4HepRepSceneHandler.cc, maybe there are better places to do this.
Comment 1 Olivier LAHAYE 2012-06-08 16:19:36 CEST
Created attachment 172 [details]
replace hardcoded G4zlib by ${ZLIB_LIBRARIES} in HepRep/sources.cmake

replace hardcoded G4zlib by ${ZLIB_LIBRARIES}

needs to put G4zlib in ZLIB_LIBRARIES if  ZLIB_FOUND is false
Comment 2 Olivier LAHAYE 2012-06-08 16:24:46 CEST
Created attachment 173 [details]
add_definitions(-DG4LIB_USE_ZLIB) so G4HepRepSceneHandler.cc uses zlib

add_definitions(-DG4LIB_USE_ZLIB) so G4HepRepSceneHandler.cc builds using zlib.

May need to be located in HepRep/source.cmake instead of Modules/Geant4OptionalComponents.cmake

But as I'm ultra newbee in cmake, this is just a supposition.

This is a prework that surely needs attention.
Comment 3 Ben Morgan 2012-06-11 14:06:59 CEST
Thanks for the patches - note that the system vs internal libraries interface will be updated for consistent use in 9.6, but this will not make it into the beta for 9.6. It will however appear in the release later this year. The same goes for the related Bug #1291.
Comment 4 Olivier LAHAYE 2012-06-13 11:25:24 CEST
Great!

tanks a lot for your work. The move toward cmake vs proprietary configure script was a big step, especially for the rpm packager I am.

Keep up the good work guys :-)
Comment 5 Ben Morgan 2013-03-26 13:32:45 CET
Apologies for the delay in fixing this - we have also re-organized the use of internal/external packages, so it took a little longer than it should...

Fixed in tags

cmake-V09-06-07
vis-HepRep-V09-06-05

These should make it into the next patch of 9.6, possibly into the next patch of 9.5.

Thanks again for the report and patches!