Error when compiling macro: "'Pythia8/Analysis.h' file not found"

The issue persists with ROOT version 6.18 – the necessary Pythia include files were not copied during the ROOT build, and needed to be done manually. Here’s some more info I should have included before:
Operating System: macOS 10.14.5
CMake: version 3.14.5

Are you sure you built root with pythia8 option on?
What is output of command: root-config --features ?

Thank you for the reply!

I do believe I had the option set on (in ccmake), here is the output of root-config --features :

cxx11 asimage astiff builtin_afterimage builtin_clang builtin_davix builtin_freetype 
builtin_ftgl builtin_gl2ps builtin_glew builtin_llvm builtin_lz4 builtin_openssl builtin_tbb 
builtin_vdt builtin_xxhash clad cling cocoa davix exceptions explicitlink fftw3 gdml 
http imt libcxx opengl pch pythia8 python roofit shared sqlite ssl thread tmva tmva-cpu 
tmva-pymva vdt xml

I see, can you send please your macro so I can try to reproduce error?

Apologies for the delay! Here is a copy of the macro – I have included some configuration files for Pythia as well. The macro itself is at pythia_example/generation/generator.C, and can be run like:

root [0] .L generator.C+
root [1] Run()

Apologies that this isn’t quite a minimum working example. However, the issue previously seemed to come up simply from line 25: <#include “TPythia8.h”>
Ever since I manually copied the directories “Pythia8” and “Pythia8Plugins” from the Pythia installation to /path/to/root/build/dir/include/ , that hasn’t caused any issues, and things are working correctly. If those files should have been there in the first place, could this perhaps be a CMake issue?
Thanks for following up!

pythia_example.zip (38.1 KB)

Hi, I just wanted to follow up on this issue. I’m continuing to run into this issue, now with ROOT 6.20 (and Pythia 8244).

To recap, compiling a macro using TPythia8 raises this error:
/Users/jan/root/root-6.20.00/rbuild/include/TPythia8.h:69:10: fatal error: 'Pythia8/Pythia.h' file not found

(for exactness, I will report the paths exactly as they appear on my local machine, instead of using shorthand like path/to/root/build)

As I mentioned before, this problem is resolved if I copy some directories from Pythia’s include dir, containing .h files, into the ROOT build’s include dir:

cp -r /Users/jan/pythia/pythia8244/include/* /Users/jan/root/root-6.20.00/rbuild/include/.
After doing this, I can successfully compile & run ROOT macros using TPythia8.

However I assume this manual copy should not be necessary. I have built Pythia8 with the shared library, and built ROOT using the following flags in cmake, with the Pythia8 option turned on:

PYTHIA8_DATA = /Users/jan/pythia/pythia8244/share/Pythia8/xmldoc            
PYTHIA8_INCLUDE_DIR = /Users/jan/pythia/pythia8244/include                         
PYTHIA8_LIBRARY = /Users/jan/pythia/pythia8244/lib/libpythia8.dylib 

I also have the following lines in my .bash_profile:

export PYTHIA8=/Users/jan/pythia/pythia8244
export PYTHIA8DATA=/Users/jan/pythia/pythia8244/share/Pythia8/xmldoc
DYLD_LIBRARY_PATH=${PYTHIA8}/lib:${DYLD_LIBRARY_PATH}

Without performing that manual copy I mentioned above, I can successfully run the ROOT tutorial pythia8.C and my own macros in interpreter mode, but compilation will fail with the error message at the top of this post.

As a side note, the ccmake description for PYTHIA8_INCLUDE_DIR is “Specify the directory containing Pythia.h.”. However while this should be given as /Users/jan/pythia/pythia8244/include (otherwise the build fails), the file Pythia.h is actually located at /Users/jan/pythia/pythia8244/include/Pythia8/Pythia.h.
This seems to be reflected in the include statement in TPythia8.h causing my error, which accounts for the Pythia8 subdirectory – the ccmake variable descriptions thus might be a little misleading.

Thanks again for the help!

Operating System: macOS 10.14.6
ROOT: 6.20/00
Clang: Apple clang version 11.0.0 (clang-1100.0.33.8)
CMake: version 3.17.0-rc1

@oshadura Could you take another look?

Hi!

Can you please print me PYTHIA8_INCLUDE_DIR from CMakeCache of your build?

Thanks a lot!

this one right?

1 Like

I will try to reproduce problem, locally, and let you know…

What is your command that you use to compile your macro? or you are using it from root interpreter?

I tried locally to build ROOT with PYTHIA8 and with this PR build was successful (minor changes) https://github.com/root-project/root/pull/5416

I used next variable while configuring ROOT:

 $ env | grep PYTHIA8
PYTHIA8=/home/oksana/CERN_sources/pythia8

Both cases using ROOT from build directory and from installation directory allowed me to execute root tutorials/pythia/pythia8.C without any error.

1 Like

@oshadura
Regarding your 1st comment: For example, I try to compile & run the Pythia8 tutorial code like the following:
root -x pythia8.C+
(This line works without the +, in which case I’m just using interpreter mode)

I will try the new PR in a little bit and let you know if I can get it running. Thanks!

I managed to run root -x pythia8.C+ as well…

@jaofferm I’d assume you have installed Pythia somewhere where your compiler does not look. You can add to the directories it checks by passing -I/wherever/you/installed/pythia8. For ROOT itself you can pass that as gSystem->AddIncludePath("-I/wherever/you/installed/pythia8")

1 Like

Hi Axel,
Thanks for the response! This solves my problem, now I can successfully compile my macro using TPythia8.

Out of curiosity, is this the expected functionality/solution? That is, since I gave the path to the Pythia8 shared library when building ROOT (via the -PYTHIA8_LIBRARY flag in cmake), I thought that it would have been automatically added to the include path for ROOT’s compiler.

Does it help if you do gSystem->Load("libEGPythia8") before running .x pythia8.C+? That might inject the required -I.

1 Like

Hi @Axel,
This also solves the problem! (sorry for the late reply)

I guess I didn’t quite understand how ROOT was handling these external libraries – this is a nice solution to my problem, since I can just put the gSystem->Load("libEGPythia8") command into a local rootlogon.C if I want to compile & run a ROOT macro with TPythia8 from the command line.

Thanks again to you and @oshadura for looking into this!

1 Like

3 posts were split to a new topic: ‘TPythia8.h’ file not found