error "cannot find -ld" in pythia8 @ MG5 v2.6.0

Asked by Kyeongpil Lee on 2017-10-24

Dear experts,

I'm trying to generate DY->ll sample @ NLO using MG5 v2.6.0 (latest one) [1], and at least LHE file is produced without error.
After that, I tried the hadronization using pythia8 installed within MG5 framework. (I already installed all necessary things in MG5 (hepmc, pythia8 & interface, and so on) before starting to generate events)

But when I tried to hadronize the LHE file, I got an error like [2] which said that it cannot find -ld.

When I run using MG5 v2.5.5, there's no line "-ld" in the compile command and it worked well.
So I tried to run pythia8 without including "d" in the "extralibs" variable in shower_card.dat using MG5 v2.6.0, but MG5 interface automatically added "d" when it is not included in the card and makes error again.

As a test, when I modified bin/internal/shower_card.py not to include "d" in the "extralibs" and run pythia8, it works without error.

Could you suggest any solution to resolve this problem? or can I safely remove "d" in "extralibs" by hand for pythia8 run?
Thank you!

Best Regards,
Kyeongpil

[1]
import model loop_sm-no_b_mass

define p = p b b~
define j = j b b~

#define ell+ = e+ mu+ ta+
#define ell- = e- mu- ta-

generate p p > mu+ mu- [QCD] @0
#add process p p > ell+ ell- j [QCD] @1
#add process p p > ell+ ell- j j [QCD] @2

output Local/MG5_Output -nojpeg

[2]
(mcatnlo.log)
 USING PYTHIA 8, version >= 8.200
g++ -O -I/cvmfs/cms.cern.ch/slc6_amd64_gcc530/external/lhapdf/6.1.6-ikhhed2/include -I/cvmfs/cms.cern.ch/slc6_amd64_gcc530/external/boost/1.57.0-ikhhed2/include -I/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/pythia8/include \
  -I/home/kplee/Physics/ZprimeTo4L/GENSIM/Madgraph/GEN_v12_DYJetsToLL_NLO/v02_MG5_260_ReinstalledPythia/Local/MG5_Output/MCatNLO/include Pythia82.cc -o Pythia8.exe \
  -L/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/pythia8/lib -lpythia8 \
  -I/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/hepmc/include -L/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/hepmc/lib -lHepMC -L../lib -L/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/pythia8//lib -L/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/boost/lib -L/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/zlib/lib -lpythia8 -lboost_iostreams -lz -ldl -lstdc++ -ld \

/cvmfs/cms.cern.ch/slc6_amd64_gcc530/external/gcc/5.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/5.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -ld
collect2: error: ld returned 1 exit status
Makefile:49: recipe for target 'Pythia82' failed
make: *** [Pythia82] Error 1
Pythia8 compilation did not succeed, exiting

Question information

Language:
English Edit question
Status:
Answered
For:
MadGraph5_aMC@NLO Edit question
Assignee:
Stefan Prestel Edit question
Last query:
2017-10-24
Last reply:
2017-11-15

Hi,

> Could you suggest any solution to resolve this problem? or can I safely remove “d" in "extralibs" by hand for pythia8 run?

I guess that it should be save but I would be interested to know what is the origin of this problem.

As you have notice, we indeed add some “extralibs” automatically. Those dependencies are actually not hardcoded in our code, but are depending directly on the pythia8-config executables. (see below).
Would you be keen enough to run
pythia8-config --libs
and
pythia8-config --config

In my setup, the first line return
-L/Users/omatt/Documents/HEPTools/pythia8//lib -lpythia8 -L/usr/local/Cellar/boost/1.55.0/lib -lboost_iostreams -L/Users/omatt/Documents/HEPTools/zlib/lib -lz -ld

and therefore we add this library to the extralibs. I guess that this is a pythia8 problem and will therefore assign this to a pythia8 author.

Cheers,

Olivier

PS: The code that we use to get the library needed when compiling pythia8:

> # 2. take the compilation flag of PY8 from pythia8-config
> libs , paths = [], []
> p = misc.subprocess.Popen([executable, '--libs'], stdout=subprocess.PIPE)
> stdout, _ = p. communicate()
> libs = [x[2:] for x in stdout.split() if x.startswith('-l') or paths.append(x[2:])]

> # Add additional user-defined compilation flags
> p = misc.subprocess.Popen([executable, '--config'], stdout=subprocess.PIPE)
> stdout, _ = p. communicate()
> for lib in ['-ldl','-lstdc++','-lc++']:
> if lib in stdout:
> libs.append(lib[2:])

> On Oct 24, 2017, at 10:56, Kyeongpil Lee <email address hidden> wrote:
>
> New question #659847 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/659847
>
> Dear experts,
>
> I'm trying to generate DY->ll sample @ NLO using MG5 v2.6.0 (latest one) [1], and at least LHE file is produced without error.
> After that, I tried the hadronization using pythia8 installed within MG5 framework. (I already installed all necessary things in MG5 (hepmc, pythia8 & interface, and so on) before starting to generate events)
>
> But when I tried to hadronize the LHE file, I got an error like [2] which said that it cannot find -ld.
>
> When I run using MG5 v2.5.5, there's no line "-ld" in the compile command and it worked well.
> So I tried to run pythia8 without including "d" in the "extralibs" variable in shower_card.dat using MG5 v2.6.0, but MG5 interface automatically added "d" when it is not included in the card and makes error again.
>
> As a test, when I modified bin/internal/shower_card.py not to include "d" in the "extralibs" and run pythia8, it works without error.
>
> Could you suggest any solution to resolve this problem? or can I safely remove "d" in "extralibs" by hand for pythia8 run?
> Thank you!
>
> Best Regards,
> Kyeongpil
>
> [1]
> import model loop_sm-no_b_mass
>
> define p = p b b~
> define j = j b b~
>
> #define ell+ = e+ mu+ ta+
> #define ell- = e- mu- ta-
>
> generate p p > mu+ mu- [QCD] @0
> #add process p p > ell+ ell- j [QCD] @1
> #add process p p > ell+ ell- j j [QCD] @2
>
> output Local/MG5_Output -nojpeg
>
> [2]
> (mcatnlo.log)
> USING PYTHIA 8, version >= 8.200
> g++ -O -I/cvmfs/cms.cern.ch/slc6_amd64_gcc530/external/lhapdf/6.1.6-ikhhed2/include -I/cvmfs/cms.cern.ch/slc6_amd64_gcc530/external/boost/1.57.0-ikhhed2/include -I/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/pythia8/include \
> -I/home/kplee/Physics/ZprimeTo4L/GENSIM/Madgraph/GEN_v12_DYJetsToLL_NLO/v02_MG5_260_ReinstalledPythia/Local/MG5_Output/MCatNLO/include Pythia82.cc -o Pythia8.exe \
> -L/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/pythia8/lib -lpythia8 \
> -I/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/hepmc/include -L/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/hepmc/lib -lHepMC -L../lib -L/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/pythia8//lib -L/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/boost/lib -L/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/zlib/lib -lpythia8 -lboost_iostreams -lz -ldl -lstdc++ -ld \
>
> /cvmfs/cms.cern.ch/slc6_amd64_gcc530/external/gcc/5.3.0/bin/../lib/gcc/x86_64-pc-linux-gnu/5.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -ld
> collect2: error: ld returned 1 exit status
> Makefile:49: recipe for target 'Pythia82' failed
> make: *** [Pythia82] Error 1
> Pythia8 compilation did not succeed, exiting
>
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Kyeongpil Lee (kplee) said : #2

Dear Olivier,

Thank you so much for your comments!
Then I will wait for the answer from pythia8 authors :)

cf) [1] is the results for "./pythia8-config --libs" and "./pythia8-config --config" in my setup.
Obviously, it has "-ld" option, which makes error in my case :(

[1]
[kplee@cms1 bin]$ ./pythia8-config --libs
-L/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/pythia8//lib -lpythia8 -L/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/boost/lib -lboost_iostreams -L/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/zlib/lib -lz -ld

[kplee@cms1 bin]$ ./pythia8-config --config
./configure --prefix=/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/pythia8/ --with-hepmc2=/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/hepmc --with-hepmc2-include=/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/hepmc/include --with-gzip=/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/zlib --with-lhapdf6=/cvmfs/cms.cern.ch/slc6_amd64_gcc530/external/lhapdf/6.1.6-ikhhed2 --with-lhapdf6-plugin=LHAPDF6.h --with-boost=/home/kplee/Physics/Madgraph/MG5_aMC_v2_6_0/HEPTools/boost --cxx-common='-ldl -fPIC -lstdc++ -DHEPMC2HACK'

Hi,

I recently encountered the same problem. While waiting for a response from the pythia authors I think the cause of the problem and the solution in the meantime may be a typo in the pythia8-config script itself:

The second to last line appends " -ld" to the output (If the argument to the script was --libs or --ldflags ), and I am fairly certain this is supposed to append " -ldl" instead?

Cheers,
Leon

abulikim2011 (abulikim2011) said : #4

hello Leon,
i recently encounterd the same problem,how do you solve this problem?

Hi,

I'm not too confident that this was the source of the problem & that what I'm doing isn't horribly breaking something elsewhere but my understanding is that Madgraph checks what libraries Pythia8 needs by running pythia8--config (which, if Pythia was installed via madgraph, should be in [Madgraph Folder]/HEPTools/pythia8/bin/).

The problem is that madgraph thinks pythia needa a library called "d", but as far as I can tell It doesn't based on the fact that it runs fine without it and that it appears nowhere in the pythia-installation log. I think It might have been a typo in the pythia8--config script where "d" should be "dl", because as far as I can tell that is a library pythia uses as it appears both in the pythia install log and as a comment in madgraph's shower_card_default.dat which says "PYTHIA > 8.200 may require library dl".

What I did to get around this was to modify pythia8--config which is just a bash script. Specifically in my installation the last several lines were:

if [ "$VAR" = "LDFLAGS" ]; then OUT+=" -ld"; fi
echo $OUT

Which just appends " -ld" ('library d') to the output . I changed this to append " -ldl" (library dl) instead, and this seems to have fixed the issue for me.

Hi,

This sounds a good fix to me. I'm trying to contact PY8 author concerning such problem but so far I did not get any feed back on this problematic.

Cheers,

Olivier

Can you help with this problem?

Provide an answer of your own, or ask Kyeongpil Lee for more information if necessary.

To post a message you must log in.