You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Checked for duplicates
Yes, kind of. I thought that there was a ticket about this by @amadio, but I didn't find anything.
Describe the bug
In a setup where ROOT was installed in a system directory, ROOT was picking up headers from that directory instead of its own.
How to reproduce:
echo '#error This is the wrong header' > /my/include/directory/RooSpan.h (or a few other headers).
Install some builtins into that directory, e.g. VDT
cmake -DCMAKE_PREFIX_PATH=/my/include/directory/ <root> to create a dependency to that include directory.
Build.
Now ROOT should find VDT, and add a -I/my/include/directory/ to the compile command, which will accidentally include other parts of ROOT.
The problem is that it's difficult to provoke this error using only one header:
All core includes are prepended to every compile command, so none of the core includes will be picked up wrongly.
Library A will always find its own includes in the correct location, because it's also prepended.
The problem only becomes visible when A depends on B and C, and B depends on something in /system/include/ (e.g. VDT), and C is also installed in those system includes. This generates a compile command such as:
Instead of picking up C from ROOT's build directory, it now comes from /system/include/.
Expected behavior
ROOT picks up all its own includes first, and system includes last. This can be achieved with -isystem ..., so every -I ... is searched before -isystem ....
In CMake, this means:
Using imported targets when software comes from system directories (these are implicitly system includes)
Explicitly marking some include directories SYSTEM.
Setup
Centos8
ROOT installed in /data/software/
ROOT configured with cmake -DCMAKE_PREFIX_PATH=/data/software ... <root>
The text was updated successfully, but these errors were encountered:
It is likely that more builtins (or rather FindXXX have to be converted to IMPORTED targets, so they don't provoke this error again. A broken configuration can be detected by
Having CMake pick up a dependency in some common directory, e.g. install a lot of builtins there.
Either
Place an entire ROOT installation there, where all headers start with #error This is the wrong header. or
Search compile_commands.json for -I/my/include/directory/
Fix the FindXXX for all dependencies that provoke the above error.
Yes, kind of. I thought that there was a ticket about this by @amadio, but I didn't find anything.
Describe the bug
In a setup where ROOT was installed in a system directory, ROOT was picking up headers from that directory instead of its own.
How to reproduce:
echo '#error This is the wrong header' > /my/include/directory/RooSpan.h
(or a few other headers).cmake -DCMAKE_PREFIX_PATH=/my/include/directory/ <root>
to create a dependency to that include directory.Now ROOT should find VDT, and add a
-I/my/include/directory/
to the compile command, which will accidentally include other parts of ROOT.The problem is that it's difficult to provoke this error using only one header:
The problem only becomes visible when
A
depends onB and C
, andB
depends on something in/system/include/
(e.g. VDT), andC
is also installed in those system includes. This generates a compile command such as:Instead of picking up
C
from ROOT's build directory, it now comes from/system/include/
.Expected behavior
ROOT picks up all its own includes first, and system includes last. This can be achieved with
-isystem ...
, so every-I ...
is searched before-isystem ...
.In CMake, this means:
SYSTEM
.Setup
Centos8
ROOT installed in
/data/software/
ROOT configured with
cmake -DCMAKE_PREFIX_PATH=/data/software ... <root>
The text was updated successfully, but these errors were encountered: