AIDASoft / DD4hep

Detector Description Toolkit for High Energy Physics
http://dd4hep.cern.ch
GNU Lesser General Public License v3.0
50 stars 99 forks source link

Problem with CMake configuration for XercesC #61

Closed jhrdinka closed 7 years ago

jhrdinka commented 7 years ago

When I am trying to build against DD4hep included in the new lcg release: _/afs/cern.ch/sw/lcg/releases/LCG87/DD4hep/ (which is built with XercesC flag ON) I get the following error message:

-- INCLUDING DD4hepBuild.... c++11:OFF c++14:ON
CMake Error at /afs/cern.ch/sw/lcg/releases/CMake/3.5.2-a9b03/x86_64-slc6-gcc62-opt/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find XercesC (missing: XERCESC_LIBRARY XERCESC_INCLUDE_DIR)
Call Stack (most recent call first):
  /afs/cern.ch/sw/lcg/releases/CMake/3.5.2-a9b03/x86_64-slc6-gcc62-opt/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  /afs/cern.ch/sw/lcg/releases/LCG_87/DD4hep/00-17/x86_64-slc6-gcc62-opt/cmake/FindXercesC.cmake:60 (find_package_handle_standard_args)
  /afs/cern.ch/sw/lcg/releases/LCG_87/DD4hep/00-17/x86_64-slc6-gcc62-opt/cmake/DD4hep_XML_setup.cmake:2 (find_package)
  /afs/cern.ch/sw/lcg/releases/LCG_87/DD4hep/00-17/x86_64-slc6-gcc62-opt/cmake/DD4hep.cmake:42 (include)
  /afs/cern.ch/sw/lcg/releases/LCG_87/DD4hep/00-17/x86_64-slc6-gcc62-opt/DD4hepConfig.cmake:32 (include)
  Plugins/DD4hepPlugins/CMakeLists.txt:9 (find_package)

-- Configuring incomplete, errors occurred!

I do not want to make my project depend on XercesC. Therefore could you please change you CMake configuration?

jlingema commented 7 years ago

Hi Julia,

XercesC is part of the LCG stack and you can simply take it from there. The recommendation was to use XercesC rather than TinyXML for performance, if I remember correctly. All you need to change is to setup the environment variable as instructed (or use the LCG view):

export XERCESC_DIR=/afs/cern.ch/sw/lcg/releases/LCG_87/XercesC/3.1.3/x86_64-slc6-gcc62-opt/

or

export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/afs/cern.ch/sw/lcg/views/LCG_87

Cheers, Joschka

jlingema commented 7 years ago

This is not adding a new dependency, it just requires additional setup if you want to use the LCG build. Users of DD4hep+ACTS can still use TinyXML if they prefer (they just need to build the stack themselves).

cgumpert commented 7 years ago

Hi Joschka,

it is great to have the DD4HEP build available from the LCG stack, but I think that the cmake configuration of the installed DD4hep package should be self-contained, in the sense that one can simply use

find_package (DD4hep)

in ones own software package. In my opinion, no further configuration should be necessary (apart from pointing the CMAKE_PREFIX_PATH to the DD4hep installation directory). If you require the user to setup all the environment variables for all DD4hep dependencies, this is asking for incompatibilities (how would I even know against which XercesC release the build was done).

jlingema commented 7 years ago

Yes, I agree. From the LCG side you can get this to work by simply sourcing the setup script of the view, e.g.:

source /afs/cern.ch/sw/lcg/views/LCG_87/x86_64-slc6-gcc62-opt/setup.sh

Regarding the cmake / setup structure of DD4hep, I let the DD4hep experts respond. I was under the impression that source thisdd4hep.sh + find_package(DD4hep) is enough, but I may be wrong.

petricm commented 7 years ago

Hi, our DD4hep dependent software is configure with just source thisdd4hep.sh plus find_package(DD4hep REQUIRED COMPONENTS DDSegmentation DDRec DDG4)

petricm commented 7 years ago

So is there an issue?

jhrdinka commented 7 years ago

Hi, I checked now once again to be sure but I get this error although I sourced thisdd4hep.sh

jlingema commented 7 years ago

I'm guessing, but could it be it's because in this line it is setting XERECESCINSTALL not XERCESCINSTALL?

petricm commented 7 years ago

Thank you for spotting the typo, I just fixed it.

petricm commented 7 years ago

@jhrdinka can you please verify if this was the issue for you?

jhrdinka commented 7 years ago

Yesterday I was setting the path manually (export XERCESCINSTALL=/afs/cern.ch/sw/lcg/releases/XercesC/3.1.3-f6432/x86_64-slc6-gcc62-opt) but I got the same error as before. I can also install the current branch and try it

jhrdinka commented 7 years ago

I could now install the new branch with the configuration used for the lcg release and the Problem is solved now!