Error in running Analysis code

Hello every
in trying to run an Analysis code for which i have this Makefile

SHELL = /bin/sh

pythialib= /home/anwarzada/Packages/Pythia8244/pythia/lib
hepmclib = /home/anwarzada/Packages/HepMC-2.06.09/HepMC/lib 
tauolalib= /home/anwarzada/Packages/TAUOLA/lib/ 
lhapdflib= /home/anwarzada/Packages/LHAPDF-6.2.3/LHAPDF/lib/
lhapdfinc= /home/anwarzada/Packages/LHAPDF-6.2.3/LHAPDF/include
hepmcinc = /home/anwarzada/Packages/HepMC-2.06.09/HepMC/include 
tauolainc= /home/anwarzada/Packages/TAUOLA/include
pythiainc= /home/anwarzada/Packages/Pythia8244/pythia/include/
rootinc=   /home/anwarzada/Packages/root-6.20.02/myroot/include
rootlib=   /home/anwarzada/Packages/root-6.20.02/myroot/lib
fastjetlib= /home/anwarzada/Packages/fastjet-3.3.3/FASTJET/lib/
fastjetinc= /home/anwarzada/Packages/fastjet-3.3.3/FASTJET/include
CXXFLAGS = -O2 -ansi -pedantic -fbounds-check

all :
	@echo "Using makefile ..., please enter the code name to compile"	

WriteHepMC :
#	gfortran  -I$(hepmcinc) -I$(pythiainc) WriteHepMC.cc -o $@.exe -L$(pythialib) -L$(hepmclib) -L$(tauolalib) -L$(lhapdflib) -lpythia8 -lLHAPDF -lhepmcinterface  -lHepMC -lTauolaCxxInterface -lTauolaFortran 
	g++ -I$(pythiainc) -I$(tauolainc) WriteHepMC.cc -o $@.exe -L$(pythialib) -L$(hepmclib) -L$(tauolalib) -L$(lhapdflib) `root-config --cflags --glibs` `fastjet-config --cxxflags --plugins` `fastjet-config --libs --plugins` -lpythia8 -lLHAPDF -lhepmcinterface  -lHepMC -lTauolaCxxInterface -lTauolaFortran 

Analysishadbkg   :
	g++ -I$(pythiainc) -I$(tauolainc) Analysishadbkg.cc -o $@.exe -L$(pythialib) -L$(hepmclib) -L$(tauolalib) -L$(lhapdflib) `root-config --cflags --glibs` `fastjet-config --cxxflags --plugins` `fastjet-config --libs --plugins` -lpythia8 -lLHAPDF -lhepmcinterface  -lHepMC -lTauolaCxxInterface -lTauolaFortran
	
Analysis   :
	g++ -g -I$(pythiainc) -I$(tauolainc) -I$(hepmcinc) -I$(lhapdfinc) Analysis.cc -o $@.exe -L$(tauolalib) -L$(pythialib) -L$(hepmclib) -L$(lhapdflib) `root-config --cflags --glibs` `fastjet-config --cxxflags --plugins` `fastjet-config --libs --plugins` -L$(HEPMC2_LIB) -Wl,-rpath,$(HEPMC2_LIB) -lHepMC -ldl -lpythia8 -lLHAPDF -lTauolaCxxInterface -lTauolaFortran

which the command make Analysis
i got this error

My ubuntu = 20.04.2
ROOT = 20.06.02
fastjet = 3.3.3
LHAPDF=6.2.3
HepMC=2.06.09
Pythia=8244

Thanks in Advance

Hi @anwar ,
please check out Posting code? Read this first! for instructions on how to post code on the forum. I edited your previous post to make it more readable.

As far as I can tell the error is due to a broken Pythia installation. If it worked before, maybe you recently upgraded your system and need to recompile Pythia? Or maybe you installed a Pythia binary incompatible with your system.

Cheers,
Enrico

Hi @eguiraud ,
thanks for your response and guidance,
i resolved that error but now i am facing this issue
‘’’’
root-config --cflags --glibs fastjet-config --cxxflags --plugins fastjet-config --libs --plugins -L -Wl,-rpath, -lHepMC -lpythia8 -ldl -lLHAPDF -lTauolaCxxInterface -lTauolaFortran
/usr/lib/gcc/x86_64-linux-gnu/7/…/…/…/x86_64-linux-gnu/crt1.o: In function _start': (.text+0x20): undefined reference to main’
collect2: error: ld returned 1 exit status
makefile:25: recipe for target ‘Analysis’ failed
make: * [Analysis] Error 1
‘’’’

Hi @anwar ,
please post the full compilation command (and use three backticks ``` to format it properly).

From the compilation error it seems that you are missing a source file that defines a main function.
Cheers,
Enrico

As i shared the Makefile above, for which i use the command make Analysis to create an .exe file for an Analysis.cc code.
but when i give the make Analysis command, it returns this error

root-config --cflags --glibs fastjet-config --cxxflags --plugins fastjet-config --libs --plugins -L -Wl,-rpath, -lHepMC -lpythia8 -ldl -lLHAPDF -lTauolaCxxInterface -lTauolaFortran
/usr/lib/gcc/x86_64-linux-gnu/7/…/…/…/x86_64-linux-gnu/crt1.o: In function _start': (.text+0x20): undefined reference to main’
collect2: error: ld returned 1 exit status
makefile:25: recipe for target ‘Analysis’ failed
make: * [Analysis] Error 1

Ok, there is an error in your Makefile, either you are compiling a library as if it was an executable (so the compiler expects a main function) or you are compiling an executable but you don’t pass the source file that contains main.

This is not strictly related to ROOT, I can suggest to use make VERBOSE=1 to see the exact compilation command that is being run and see what’s wrong with it.

Cheers,
Enrico

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