Skip to content

CMake configuration issues

I hadn't done a Rivet installation with HepMC3 for a while until today, when I updated our bootstrap script to allow it... and hit a few snags. I've documented them below, so we can polish this process: I guess they passed unseen through current testing because we've been running as root and installing to system locations, etc.?

The environment for this is a HEP Centos7 system, but with the GCC9 compiler and Python 3.7 pulled in from the LCG_97 builds on CVMFS. To start with I used this cmake command: cmake ../HepMC3-$HEPMC_VERSION/ -DCMAKE_INSTALL_PREFIX=$PWD/local -Dmomentum=GEV -Dlength=MM (I think the last two flags aren't needed, but they were a hangover from the v2 build and they don't break things.)

Issue 1: configure crashes if ROOT isn't found. Actually with some confusing message about FindROOT.cmake. Great to have it compile against ROOT by default if it finds it, but if it doesn't can't we make it emit a warning and fall back gracefully to a no-ROOT build, rather than confusing error and crash? Adding -DHEPMC3_ENABLE_ROOTIO=OFF fixed this, but that won't be obvious to a new user.

Issue 2: the Centos7 cmake (version 2.8.12.2) can't handle this build config:

CMake Error at /usr/share/cmake/Modules/WriteBasicConfigVersionFile.cmake:39 (message):
  No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakePackageConfigHelpers.cmake:152 (write_basic_config_version_file)
  CMakeLists.txt:242 (write_basic_package_version_file)

To fix this I had to also use CVMFS to set up a CMake v3 environment, and then it ran ok.

Issue 3: as seen in the command above, I'm requesting a standard CMake install prefix in my user area, but I get this error from CMake:

CMake Error at python/cmake_install.cmake:55 (file):
  file cannot create directory: /usr/lib64/python2.7/site-packages/pyHepMC3.
  Maybe need administrative privileges.
Call Stack (most recent call first):
  cmake_install.cmake:102 (include)

Looks like the Python extension is ignoring the requested install prefix and trying to install into /usr?

Issue 4: maybe not a "real issue", but it also caused me trouble that CMake wanted to install into $prefix/lib64 when all my other compiled codes are in $prefix/lib. Just means that I need to symlink the two before building HepMC3 (which is done proactively by Python virtualenv), but it's something to be aware of... HepMC2 always installed into lib if I remember correctly, so this is an arguably unexpected behaviour that'll make migration a bit more awkward.