Running Pythia8 with ROOT getting fatal error: 'Pythia8/Pythia.h' file not found

Thank you!! I am not getting that error, but I got a new one:

ld: warning: directory not found for option ‘-L/usr/local/pythia8243/lib’

ld: library not found for -lpythia8

How did you install Pythia? What file are in /usr/local/pythia8243/lib?

The error is gone and I can compile it now! Sorry, I had the previous error because I didn’t run "make " command for pythia8.

But when I want to run my code, I got this error message:

./forWong forWong.cmnd > forWong.out
dyld: Library not loaded: @rpath/libpythia8.dylib
Referenced from: /usr/local/root/Summer/forWong/./forWong
Reason: image not found
/bin/sh: line 1: 41182 Abort trap: 6 ./forWong forWong.cmnd > forWong.out
make: *** [run] Error 134

And MacOs send me this:
forWong cannot be opened because of a problem.
Check with the developer to make sure forWong works with this version of macOS. You may need to reinstall the application. Be sure to install any available updates for the application and macOS.

Click Report to see more detailed information and send a report to Apple.

Do you know how I can resolve this? Thank you so much for your help!!

I’m not a MacOS user, but maybe adding /usr/local/pythia8243/lib to DYLD_LIBRARY_PATH could help

export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/usr/local/pythia8243/lib

I added this line to bashrc.sh and I also ran this command in my terminal but I am getting the same error. Did I do this correctly?

I guess so… Where is the libpythia8.dylib file?

This is the where libpythia8.dylib is. You gave me the correct one.

Could you try to add also this:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/pythia8243/lib

I tried, and I still got the same error.:cold_sweat:

Did you run the bashrc after modifying it?

No…How do I run it? :hot_face:

source /wherevever/is/bashrc

And replace /wherevever/is/ by the location of your bashrc script :wink:

I look at where the bashrc.sh is and I think it’s probably not the right file because the location is related to python???.. Here is the location: /anaconda3/pkgs/pexpect-4.6.0-py37_0/lib/python3.7/site-packages/pexpect

Is there any other name the bashrc file could be called?

Sorry I should have realized this earlier!

There should be a file called .bashrc in your $HOME directory I suppose…

I didn’t see anything called .bashrc in my home directory:cold_sweat:

OK, so maybe a MacOS user could help you more… @Axel, could you help?

Thanks for your help!! I am glad that I am able to get it compiled.

First of all, this has nothing to do with ROOT: you’re trying to build a binary and you don’t know how to link a dynamic library to it, such that it’s found when starting your binary. That’s not an issue with ROOT - e.g. stackoverflow is a good source of information for non-ROOT related issues.

I suspect that this can likely be fixed by improving your Makefile that generates the library.

Hello Bellenot,

I am sorry that I have new problems. Because I still cannot run the macro I decided to try different versions of PYTHIA and ROOT. So now I have installed PYTHIA 8180 with shared library enabled and ROOT 5.34.36 with pythia8 build option enabled. I tried pythia8.c in /root/tutorials/pythia and it worked out. I have a virtual machine with Ubuntu 18.04.

However, when I run my macro, according to the makefile I should compile with the command make and I got the same error as the post says:

forWong_main.cpp:1:10: fatal error: Pythia8/Pythia.h: No such file or directory
 #include "Pythia8/Pythia.h"
          ^~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:2: recipe for target 'main' failed
make: *** [main] Error 1

I think I have set my environment variables correctly, that in my .bashrc file I have:

export PYTHIA8=/home/killua/pythia8180
export ROOTSYS=/home/ROOT
export PATH=$ROOTSYS/bin:$PATH
export PATH=${PATH}:/home/killua/pythia8180/bin
export LD_LIBRARY_PATH=$ROOTSYS/lib:$PYTHONDIR/lib:$ROOTSYS/bindings/pyroot:$LD$
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/killua//pythia8180/lib
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/home/killua/pythia8180/lib
export PYTHONDIR=$ROOTSYS
export PYTHIA8DATA=/home/killua/pythia8180/xmldoc
export PATH=${PATH}:/home/killua/pythia8180/bin

I am not sure why I am getting the same error as I did what you’ve told me before, perhaps because of the different versions of ROOT and PYTHIA. However, when I am running the example pythia8.C, it can run although I changed the three lines about SoftQCD:minbias = on according to this thread:Running Pythia8 with ROOT.

I appreciate your time reading this and all your help!

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