Linking Pythia with ROOT error

Hello, I was trying to link Pythia with Root. I used this manual to do it: http://www.graverini.net/elena/computing/physics-software/install-pythia/
I tried other methods but they never seemed to work. But this error comes up when I compile ROOT with make.

(.text+0x1262): undefined reference to `BZ2_bzReadOpen'
(.text+0x1289): undefined reference to `BZ2_bzRead'
(.text+0x12c0): undefined reference to `BZ2_bzReadClose'
(.text+0x131e): undefined reference to `BZ2_bzReadClose'
(.text+0x1397): undefined reference to `BZ2_bzReadClose'
(.text+0x13f7): undefined reference to `BZ2_bzReadClose'
/usr/lib/x86_64-linux-gnu/libcfitsio.a(drvrnet.o): In function `https_open_network':
(.text+0x761): undefined reference to `curl_easy_init'
(.text+0x778): undefined reference to `curl_easy_setopt'
(.text+0x7a1): undefined reference to `curl_easy_setopt'
(.text+0x7b7): undefined reference to `curl_easy_setopt'
(.text+0x7cd): undefined reference to `curl_easy_setopt'
(.text+0x810): undefined reference to `curl_easy_setopt'
/usr/lib/x86_64-linux-gnu/libcfitsio.a(drvrnet.o):(.text+0x833): more undefined references to `curl_easy_setopt' follow
/usr/lib/x86_64-linux-gnu/libcfitsio.a(drvrnet.o): In function `https_open_network':
(.text+0x8df): undefined reference to `curl_easy_perform'
(.text+0x905): undefined reference to `curl_easy_cleanup'
(.text+0x93c): undefined reference to `curl_easy_setopt'
(.text+0x94d): undefined reference to `curl_easy_setopt'
(.text+0x955): undefined reference to `curl_easy_perform'
(.text+0x9b5): undefined reference to `curl_easy_setopt'
(.text+0x9bd): undefined reference to `curl_easy_perform'
(.text+0xa63): undefined reference to `curl_easy_cleanup'
(.text+0xb07): undefined reference to `curl_easy_setopt'
(.text+0xb0f): undefined reference to `curl_easy_perform'
collect2: error: ld returned 1 exit status
/usr/marooz_work/root/graf2d/fitsio/Module.mk:45: recipe for target 'lib/libFITSIO.so' failed
make: *** [lib/libFITSIO.so] Error 1
make: *** Waiting for unfinished jobs....
==> lib/libRooFitCore.so done

ROOT v5-34-38
gcc version 7.4.0
ubuntu 18.04.2 LTS

Hi,
you are (at least) missing libcurl.so ( curl_easy_cleanup)
and libbz2.so ( BZ2_bzReadOpen) to be found in
/usr/lib/x86_64-linux-gnu
Modify your configure scripts/Makefile accordingly

However I would highly recommend:
Install pythia8:
http://home.thep.lu.se/~torbjorn/Pythia.html
Install ROOT 6.18.00 as described here:
https://root.cern.ch/building-root
with pythia8 enabled

Otto

1 Like

Is this a valid command to compile ROOT,

cmake -DCMAKE_INSTALL_PREFIX=/usr/marooz_work/rootinstall -DPYTHIA8_DIR=$PYTHIA8 -DPYTHIA8_INCLUDE_DIR=$PYTHIA8/include -DPYTHIA8_LIBRARY=$PYTHIA8/lib/libpythia8.so -DGSL_DIR=/usr/local -Dbuiltin_xrootd=ON -Droofit=ON -Dpythia8=ON …/root

cmake --build . --target install – -j1

because when I do so i get an error like this:
[ 22%] Performing build step for ‘XROOTD’
CMake Error at /usr/marooz_work/rootinstall/XROOTD-prefix/src/XROOTD-stamp/XROOTD-build-RelWithDebInfo.cmake:16 (message):
Command failed: 2

‘/usr/bin/make’

See also

/usr/marooz_work/rootinstall/XROOTD-prefix/src/XROOTD-stamp/XROOTD-build-*.log

CMakeFiles/XROOTD.dir/build.make:111: recipe for target ‘XROOTD-prefix/src/XROOTD-stamp/XROOTD-build’ failed
make[2]: *** [XROOTD-prefix/src/XROOTD-stamp/XROOTD-build] Error 1
CMakeFiles/Makefile2:104: recipe for target ‘CMakeFiles/XROOTD.dir/all’ failed
make[1]: *** [CMakeFiles/XROOTD.dir/all] Error 2
Makefile:151: recipe for target ‘all’ failed
make: *** [all] Error 2

HI,

I assume you did:

git clone http://root.cern.ch/git/root.git
cd root
git checkout -b v6-18-00 v6-18-00

etc.
I just successfully built 6.18.00 on Ubuntu 18.04.02 with -Dbuiltin_xrootd=ON

Was the first cmake step ok?
Which version of cmake do you use: cmake --version
What is in:

/usr/marooz_work/rootinstall/XROOTD-prefix/src/XROOTD-stamp/XROOTD-build-err.log

Otto

1 Like

Hey, I tried building 6-18-00 in a new directory with the same steps as mentioned by you. the first cmake step went ok this time. my cmake version is 3.10.2. but everything stopped with this error:

– Installing: /usr/marooz_work/ROOT/buildroot/include/TClingRuntime.h
CMake Error at core/clingutils/cmake_install.cmake:55 (file):
file INSTALL cannot find
“/usr/marooz_work/ROOT/buildroot/lib/libvectorDict.so”.
Call Stack (most recent call first):
core/cmake_install.cmake:67 (include)
cmake_install.cmake:218 (include)

Makefile:95: recipe for target ‘install’ failed
make: *** [install] Error 1

Is there any way to ignore this error?

Hi
could you try without:

-DCMAKE_INSTALL_PREFIX=/usr/marooz_work/rootinstall 

I normally do after successful build:

make dist

and untar the resulting

...tar.gz

at the place of installation

Otto

thank you for your answer. “make” worked fine and i was able to compile root properly. pythia8 example in my buildroot/tutorials also works now. but main91 and main92 still don’t work. main91 gives the error that it requires root and main92 shows:

main92Dct.cc:(.text._ZN4ROOT6Detail20TCollectionProxyInfo9IteratorsISt6vectorIN7Pythia86InBeamESaIS5_EELb0EE4nextEPvPKv[_ZN4ROOT6Detail20TCollectionProxyInfo9IteratorsISt6vectorIN7Pythia86InBeamESaIS5_EELb0EE4nextEPvPKv]+0x7): undefined reference to kAssertMsg' main92Dct.cc:(.text._ZN4ROOT6Detail20TCollectionProxyInfo9IteratorsISt6vectorIN7Pythia86InBeamESaIS5_EELb0EE4nextEPvPKv[_ZN4ROOT6Detail20TCollectionProxyInfo9IteratorsISt6vectorIN7Pythia86InBeamESaIS5_EELb0EE4nextEPvPKv]+0x2b): undefined reference toFatal(char const*, char const*, …)’
/tmp/ccWlkVTX.o: In function ROOT::Detail::TCollectionProxyInfo::Iterators<std::vector<Pythia8::DecayChannel, std::allocator<Pythia8::DecayChannel> >, false>::next(void*, void const*)': main92Dct.cc:(.text._ZN4ROOT6Detail20TCollectionProxyInfo9IteratorsISt6vectorIN7Pythia812DecayChannelESaIS5_EELb0EE4nextEPvPKv[_ZN4ROOT6Detail20TCollectionProxyInfo9IteratorsISt6vectorIN7Pythia812DecayChannelESaIS5_EELb0EE4nextEPvPKv]+0x7): undefined reference tokAssertMsg’
main92Dct.cc:(.text._ZN4ROOT6Detail20TCollectionProxyInfo9IteratorsISt6vectorIN7Pythia812DecayChannelESaIS5_EELb0EE4nextEPvPKv[_ZN4ROOT6Detail20TCollectionProxyInfo9IteratorsISt6vectorIN7Pythia812DecayChannelESaIS5_EELb0EE4nextEPvPKv]+0x2b): undefined reference to Fatal(char const*, char const*, ...)' /tmp/ccWlkVTX.o: In functionPythia8::ROOT::Pythia8_Dictionary()’:
main92Dct.cc:(.text._ZN7Pythia84ROOTL18Pythia8_DictionaryEv[_ZN7Pythia84ROOT20GenerateInitInstanceEv]+0x41): undefined reference to ROOT::Internal::DefineBehavior(void*, void*)' main92Dct.cc:(.text._ZN7Pythia84ROOTL18Pythia8_DictionaryEv[_ZN7Pythia84ROOT20GenerateInitInstanceEv]+0x76): undefined reference toROOT::TGenericClassInfo::TGenericClassInfo(char const*, int, char const*, int, ROOT::Internal::TInitBehavior const*, TClass* (*)(), int)’
main92Dct.cc:(.text._ZN7Pythia84ROOTL18Pythia8_DictionaryEv[_ZN7Pythia84ROOT20GenerateInitInstanceEv]+0x87): undefined reference to ROOT::TGenericClassInfo::~TGenericClassInfo()' main92Dct.cc:(.text._ZN7Pythia84ROOTL18Pythia8_DictionaryEv[_ZN7Pythia84ROOT20GenerateInitInstanceEv]+0x2b): undefined reference toROOT::TGenericClassInfo::GetClass()’
main92Dct.cc:(.text._ZN7Pythia84ROOTL18Pythia8_DictionaryEv[_ZN7Pythia84ROOT20GenerateInitInstanceEv]+0xa6): undefined reference to ROOT::TGenericClassInfo::GetClass()' /tmp/ccWlkVTX.o: In function_GLOBAL__sub_I_main92Dct.cc’:
main92Dct.cc:(.text.startup+0x11): undefined reference to `TVersionCheck::TVersionCheck(int)’
collect2: error: ld returned 1 exit status
Makefile:159: recipe for target ‘main92.so’ failed
make: *** [main92.so] Error 1

I am quoting some part of the “error”. I hope i can fix this somehow without compiling root again :slight_smile: .

Hi,
seems to me in your pythia env you dont see your ROOT installation
e.g.

this symbol is defined in ROOTs libcore.so

Does this work in your pythia dir:
root-config --glibs
Do you have e.g. $ROOT_LIBS defined
in pythias Makefile we have:

main92: $$@.cc $$@.h $$@LinkDef.h $(PREFIX_LIB)/libpythia8.a
ifeq ($(ROOT_USE),true)
        export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(ROOT_LIB);\
         $(ROOT_BIN)rootcint -f $@Dct.cc -c -I$(PREFIX_INCLUDE) $@.h $@LinkDef.h
        $(CXX) $@Dct.cc $^ -o $@ -w -I$(ROOT_INCLUDE) $(CXX_COMMON)\
         -Wl,-rpath,$(ROOT_LIB) `$(ROOT_BIN)root-config --glibs`
else
        @echo "Error: $@ requires ROOT"
endif

Otto

I forgot:
Assume ROOTSYS points to your ROOT installation then
you should do:

source $ROOTSYS/bin/thisroot.sh

this should initialize the needed env variables

Otto

Hey, I am sorry for the late reply. I do have source $ROOTSYS/bin/thisroot.sh in my .bashrc and I have also given the ROOT_libs path. This is what I have in .bashrc:

export PYTHIA8=/usr/marooz_work/pythia8243
export PYTHIA8DATA=/usr/marooz_work/pythia8243/share/Pythia8/xmldoc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/marooz_work/pythia8243/lib
export ROOTSYS=/usr/marooz_work/ROOT/buildroot
export PATH=$PATH:$ROOTSYS/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib

source $ROOTSYS/bin/thisroot.sh

and using root-config --glibs in pythia directory gives:
-L/usr/marooz_work/ROOT/buildroot/lib -lGui -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lROOTDataFrame -pthread -lm -ldl -rdynamic

But I do not have anything like what you quoted in Makefile. I am afraid that it might be the actual problem. Infact in Makefile.inc, I have for ROOT:

ROOT configuration.

ROOT_USE=true
ROOT_BIN=
ROOT_LIBS=
CXX_ROOT=

Hi,
there seems in fact a problem with pythias Makefile concerning ROOT.
I did with ROOT 6.18.00:
Download the latest pythia8243.tgz, untar and go to pythia8243
Make sure ROOTSYS is correctly set

./configure --with-root=$ROOTSYS
make

Go to examples and check if in Makefile.inc ROOT vars are
correctly set, e.g. for me:

ROOT_BIN=/software/opt/xenial/x86_64/root/6.18.00/bin

Modify the Makefile:
line 37:

CXX_COMMON+= -Wl,-rpath, -L$(PREFIX_LIB) -lpythia8 -ldl

Replace code for targets main91, main92 by the following:

main91: $$@.cc $(PREFIX_LIB)/libpythia8.a
ifeq ($(ROOT_USE),true)
        $(CXX) $< -o $@ -w $(CXX_COMMON)\
         `$(ROOT_BIN)/root-config --cflags`\
         -Wl,-rpath,$(ROOT_LIB) `$(ROOT_BIN)/root-config --glibs`
else
        @echo "Error: $@ requires ROOT"
endif
main92: $$@.cc $(PREFIX_LIB)/libpythia8.a main92.so
ifeq ($(ROOT_USE),true)
        $(CXX) $< main92.so -o $@ -w -I$(ROOT_INCLUDE) \
         `$(ROOT_BIN)/root-config --cflags` -Wl,-rpath,./\
         -Wl,-rpath,$(ROOT_LIB) $(CXX_COMMON) `$(ROOT_BIN)/root-config --glibs`
else
        @echo "Error: $@ requires ROOT"
endif
main92.so: main92Dct.cc $(PREFIX_LIB)/libpythia8.a
        $(CXX) $< -o $@ -c -w -I$(ROOT_INCLUDE) $(CXX_SHARED) $(CXX_COMMON)\
         `$(ROOT_BIN)/root-config --cflags`
main92Dct.cc: main92.h main92LinkDef.h
        export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(ROOT_LIB);\
         $(ROOT_BIN)/rootcint -f $@ -c -I$(PREFIX_INCLUDE) $^

Essentially: ROOTBIN ->ROOT_BIN, add a “/” before root-config and rootcint,
add -c option in target main92.so
Then try

make main91
make main92

I am not sure who takes care of this Makefile especially the ROOT part.

Cheers
Otto

hey, I did exactly as u said. ROOT_BIN has the correct path and line 37 is same. and Makefile is same as you quoted. But make main91 gives the error:

main91.cc:15:10: fatal error: Pythia8/Pythia.h: No such file or directory
#include “Pythia8/Pythia.h”
^~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:144: recipe for target ‘main91’ failed
make: *** [main91] Error 1

sorry there was still a “/” missing in main91:
but this should have given a different error message (in fact about 5 pages)
Could you try with this and show the complete log:
Esp. the line with: g++ main91.cc …

main91: $$@.cc $(PREFIX_LIB)/libpythia8.a
ifeq ($(ROOT_USE),true)
        $(info CXX_COMMON= $(CXX_COMMON))
        $(info ROOT_BIN= $(ROOT_BIN))
        $(CXX) $< -o $@ -w $(CXX_COMMON)\
         `$(ROOT_BIN)/root-config --cflags`\
         -Wl,-rpath,$(ROOT_LIB) `$(ROOT_BIN)/root-config --glibs`
else

what about: make main92?
Otto

same error:
ROOT_BIN= /usr/marooz_work/ROOT/buildroot/bin
Makefile:146: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.

makefile is very picky:
“TABs and spaces are as from different worlds”
Please replace the spaces by TAB
Otto

1 Like

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