Compiling ROOT with Pythia8

I tried compiling Root + Pythia version 8.205, using the following compiler options

g++ main30.cc …/lib/libpythia8.a -o main30 -I…/include -O2 -ansi root-config --cflags --glibs -pedantic -W -Wall -Wshadow -fPIC -Wl,-rpath …/lib -ldl

The options for each of the examples in the pythia package/examples folder are in the Makefile,
I tried main30.cc, Added the header + command

#include “TCanvas.h”

in the main

TCanvas *c = new TCanvas(“c”, “”, 30, 30);

I didn’t see the Canvas opening up, and no compiler errors either.

Could you somebody point out how I can get to see the Canvas?

Hi,

See for example the $(ROOTSYS)/tutorials/pythia/pythia8.C tutorial

Cheers, Bertrand.

I tried running the example, I have set the environment variables as per the instructions in
home.thep.lu.se/~torbjorn/pythia … lcome.html

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:path_to_PYTHIA8_installation/lib
export PYTHIA8=/path_to_PYTHIA_installation
export PYTHIA8DATA=$PYTHIA8/xmldoc

I am running root from T2 where ROOT is installed by default. When I run the
root -l pythia8.C , I got a bunch of errors.

Error in TSystem::ExpandFileName: input: $PYTHIA8/lib/libpythia8.so, output: $PYTHIA8/lib/libpythia8.so

Now in the $PYTHIA8/lib, I have libpythia.a, which is not a dynamic library, while ROOT is looking for shared library .so file.

I am not sure what I should be doing from here. Help appreciated !

Isn’t it obvious that you need to rebuild your pythia8 (so that its shared library is built, too)?

I was digging the Makefile provided inside Pythia8 folder. I don’t want to break the Makefile that came with Pythia8, is there a way of loading libPythia8.a file inside ROOT, which is much simpler I guess?

Try to run “configure --help” in your pythia8 sources.

When I run : ./configure --help,
I get a lot out of which I am posting what I think is relevant.
Installation directories.
–prefix=DIR : Directory to install PYTHIA [$PWD].
–prefix-COMPONENT=DIR : Set the installation directory for each PYTHIA
COMPONENT from the following list.
bin : Binaries, including the configuration script [PREFIX/bin].
lib : Libraries, both shared and static [PREFIX/lib].
include : Source headers [PREFIX/include/Pythia8].
share : Shared data, including configuration, READMEs, documentation, and
examples [PREFIX/share/Pythia8].

The --prefix-COMPONENT=DIR seems relevant, but I am not sure how I can force pythia 8 to make a .so file. Suggestions please.

When I run : ./configure --help,
I get a lot out of which I am posting what I think is relevant.
Installation directories.
–prefix=DIR : Directory to install PYTHIA [$PWD].
–prefix-COMPONENT=DIR : Set the installation directory for each PYTHIA
COMPONENT from the following list.
bin : Binaries, including the configuration script [PREFIX/bin].
lib : Libraries, both shared and static [PREFIX/lib].
include : Source headers [PREFIX/include/Pythia8].
share : Shared data, including configuration, READMEs, documentation, and
examples [PREFIX/share/Pythia8].

The --prefix-COMPONENT=DIR seems relevant, but I am not sure how I can force pythia 8 to make a .so file. Suggestions please.[/quote]

I did this :

  1. ./configure --enable-shared
  2. make

Got the .so file in the lib directory. Thanks for your suggestions!!

While I was able to get the shared library, I am still unable to run the pythia8.C, the error I get is the following

Processing pythia8.C…
Error in TGClient::TGClient: can’t open display “10.66.249.100:0.0”, switching to batch mode…
In case you run from a remote ssh session, reconnect with ssh -Y
Error: Symbol TPythia8 is not defined in current scope pythia8.C:51:
Error: Symbol TPythia8 is not defined in current scope pythia8.C:51:
Error: type TPythia8 not defined FILE:/gpfs22/home/user/Pythia8NativeTesting/./pythia8.C LINE:51
Error: Invalid type ‘TPythia8*’ in declaration of ‘pythia8’ pythia8.C:51:

This is what I have at line 51 : TPythia8* pythia8 = new TPythia8();

I went into the $ROOTSYS/include to check if there is TPythia8.h, there is none, similarly libEGPythia8 is also not found.

How can I run the pythia8.C example?

After (re)building your pythia8, have you (re)built your ROOT from scratch again?

Hi,

You might need to tell ROOT’s configure where to find your pythia8 installation if it’s not at a standard location.

Axel.

@ Wiley E Coyote : I am on a computing cluster, so I don’t have an option to compile root :frowning:

@Axel I don’t have permissions to do anything and moroever I wasnt able to find a configure file :frowning:

As I understand, I need to tell Pythia8 ROOT’s path during compilation, I wasn’t able to mix the
g++ options so that I can compile as I would normally if I need to use classes from several packages at once.

Is there any other way?

You should be able to easily build your own ROOT “in-place”:
[root.cern.ch/phpBB3/viewtopic.p … 931#p76931](Missing Canvas
[root.cern.ch/phpBB3/viewtopic.p … 797#p78797](Trouble Installing
[root.cern.ch/phpBB3/viewtopic.p … 839#p78839](Problem with png of divided canvas in 5-34/19 on Mac
Just add “–enable-pythia8 --with-pythia8-incdir=${PYTHIA8}/include --with-pythia8-libdir=${PYTHIA8}/lib” to the configure flags.
Also, before building your new ROOT version, make sure that nothing in your environment variables (i.e. “ROOTSYS”, “PATH”, “LD_LIBRARY_PATH”) points to another existing version of ROOT. Try:
echo ${ROOTSYS}
echo ${PATH}
echo ${LD_LIBRARY_PATH}
which root
type root
which rootcint
type rootcint
and see if there’s anything related to another ROOT version (if yes, you need to make sure that it’s not “seen”).