Include path from root-config semi complete?


_ROOT Version: 6.14/04
Platform: linux
Compiler: gcc 8.2.0


It occured to me that root headers are nowadays in
${CMAKE_INSTALL_PREFIX}/include/root and not anymore in
${CMAKE_INSTALL_PREFIX}/include, while still being included as #include "TF1.h" and not #include "root/TF1.h". Now that’s fine, and root-config --cflags prints out a -I flag with the trailing root.

But, when one installs VecCore along with root, these do end up in
${CMAKE_INSTALL_PREFIX}/include, which may not be in any standard -I path.

MWE:

  1. build and install root with -Dbuiltin_veccore=ON -Dveccore=ON -DCMAKE_INSTALL_PREFIX=/home/pseyfert/root-install-and-nothing-else.

  2. create a tiny c++ file echo '#include "TF1.h"' > main.cpp.

  3. set up a build environment export CPPFLAGS=$(root-config --cflags); export CXX=$(root-config --cxx) (linkage not needed).

  4. use gnu make builtin rules to compile make main.o
    (results in c++ -pthread -std=c++1z -m64 -fdiagnostics-color -march=native -O3 -g -Wextra -Wall -Wshadow -I/home/pseyfert/root-install-and-nothing-else/include/root -c -o main.o main.cpp for me)

the compilation then fails because of

In file included from /home/pseyfert/root-install-and-nothing-else/include/root/TFormula.h:24,
                 from /home/pseyfert/root-install-and-nothing-else/include/root/TF1.h:27,
                 from main.cpp:1:
/home/pseyfert/root-install-and-nothing-else/include/root/Math/Types.h:22:10: fatal error: VecCore/VecCore: No such file or directory
 #include <VecCore/VecCore>
          ^~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: main.o] Error 1

Not overly happy with this, but unsure if I should file that under ‘unfortunate corner case’, ‘bug’, ‘new-version-migration-task’ or something else.

(root_numpy doesn’t build for me atm because of this :/)

(for what concerns building root_numpy. its build framework respects ${CPPFLAGS} so one can bodge the build through environment vars)

PPS: it seems to me I also run into this problem with cmake when following https://root.cern.ch/how/integrate-root-my-project-cmake

Hi, thanks for reporting this. The <prefix>/include/root is used when -Dgnuinstall=ON is passed to cmake. In any case, I do think that we should add the includes for builtins that get installed along with ROOT to the flags ROOT needs, although I do not really like such usage of builtins. If you wouldn’t mind, could you please file a JIRA issue with this same information? Thank you!

https://sft.its.cern.ch/jira/browse/ROOT-9650

Indeed, flipping -Dgnuinstall=OFF I get a setup that works better.

Thanks for creating the issue. Note that if your library directory is lib64, the gnuinstall=OFF setup may not work correctly. I hope to fix that sometime soon as well. Cheers,

Thanks for the warning. My library directory is lib so looks like I’m not affected by that.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.