sherpa is hosted by Hepforge, IPPP Durham
close Warning: Can't synchronize with repository "(default)" (/hepforge/svn/sherpa does not appear to be a Subversion repository.). Look in the Trac log for more information.
Modify

Opened 16 years ago

Closed 16 years ago

Last modified 10 years ago

#13 closed defect (fixed)

Sherpa is not relocatable

Reported by: Oleg.Zenin@cern.ch Owned by: Frank Siegert
Priority: minor Milestone:
Component: Unknown Version: 1.1.1
Keywords: relocation, hard-coded paths, libtool, -rpath Cc:

Description

Currently, Sherpa is built with the `-rpath' linker option which makes it usable only from the location where it was originally installed. In order to make Sherpa relocatable one can add to configure.ac a code removing `-rpath' from linker options (see attached patch).

Then, it would be nice if Sherpa could read SHERPA_BINARY_PATH, SHERPA_PDF_PATH and SHERPA_SHARE_PATH from environment variables (see the same attached patch).

Attachments (2)

relocation-1.1.0.patch (3.8 KB) - added by Oleg.Zenin@cern.ch 16 years ago.
sherpa-1.1.1-relocation.patch (4.4 KB) - added by Oleg.Zenin@cern.ch 16 years ago.
Previous patch with LD_LIBRARY_PATH inserted into TOOLS/makeinstall

Download all attachments as: .zip

Change History (17)

Changed 16 years ago by Oleg.Zenin@cern.ch

Attachment: relocation-1.1.0.patch added

comment:1 Changed 16 years ago by Frank Siegert

Owner: changed from support@sherpa-mc.de to Frank Siegert
Version: trunk1.1.0

Hi Oleg,

thanks for your suggestion, it really sounds like a useful thing to have. Also thanks for taking the time and preparing a patch. I will try to get your patch into the bugfix release 1.1.1 which is supposed to be finished within the next days. Can you tell me, to which extent you have already tested your changes? If I don't find the time to test it before the release, it can still be provided as an official patch afterwards, and of course also with the next release after that.

Cheers, Frank

comment:2 Changed 16 years ago by Oleg.Zenin@cern.ch

Dear Frank,

Can you tell me, to which extent you have already tested your changes?


Patched Sherpa 1.1.0 was compiled and installed to the temporary directory as follows:

#!/bin/bash

VERS_SHERPA=1.1.0

platform=slc4_ia32_gcc34

CLHEP_PATH=/afs/cern.ch/sw/lcg/external/clhep/2.0.3.2
HEPMC_PATH=/afs/cern.ch/sw/lcg/external/HepMC/2.03.08
ROOT_PATH=/afs/cern.ch/sw/lcg/external/root/5.16.00
LHAPDF_PATH=/afs/cern.ch/sw/lcg/external/MCGenerators/lhapdf/5.3.1

export HEPMC2DIR=$HEPMC_PATH/$platform
export CLHEPDIR=$CLHEP_PATH/$platform
export ROOTSYS=$ROOT_PATH/$platform/root
export LHAPDFDIR=$LHAPDF_PATH/$platform

INSTALLDIR=/genser1/ozenin/ac/sherpa-relocatable

./TOOLS/makeinstall -t -r \
 --copt --enable-shared --copt --enable-static \
 --copt --enable-clhep  --copt --enable-hepmc2 \
 --copt --enable-root \
 --copt --enable-lhapdf \
 --copt --prefix=$INSTALLDIR \
 --copt --exec-prefix=$INSTALLDIR/$platform

cp -r SHERPA/Run $INSTALLDIR/share/SHERPA-MC-${VERS_SHERPA}/

Then, the installation was moved to another directory while temporary installation and source directories were deleted to find out whether there had been any hard-coded paths casually pointing to them.

Next, a slightly modified test from our LCG/GenSer test suite was successfully run:

#!/bin/bash

VERS_SHERPA=1.1.0

platform=slc4_ia32_gcc34

SHERPA_PATH=/genser1/MCGenerators.test/sherpa/1.1.0/$platform

LHAPDF_PATH=/afs/cern.ch/sw/lcg/external/MCGenerators/lhapdf/5.3.1/$platform
ROOT_PATH=/afs/cern.ch/sw/lcg/external/root/5.16.00
ROOTSYS=$ROOT_PATH/$platform/root
HEPMC_PATH=/afs/cern.ch/sw/lcg/external/HepMC/2.03.08/$platform
CLHEP_PATH=/afs/cern.ch/sw/lcg/external/clhep/2.0.3.2/$platform

export ROOTSYS

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib:$SHERPA_PATH/lib/SHERPA-MC:$LHAPDF_PATH/lib:$HEPMC_PATH/lib:$CLHEP_PATH/lib
 

progname=Sherpa
rm ../bin/${progname}.exe || mkdir -p ../bin/
ln -s ${SHERPA_PATH}/bin/${progname} ../bin/${progname}.exe 
progexe=`pwd`/../bin/${progname}.exe
mkdir -p ./Sherpa && cd ./Sherpa || exit
export SHERPA_PDF_PATH=$LHAPDF_PATH/../share 
rm -rf LHC/
cp -r ${SHERPA_PATH}/../share/SHERPA-${VERS_SHERPA}/Run/LHC .
echo "OUTPUT = 2" > LHC/Run.dat
mkdir -p LHC/Result
echo -e "Using PDF_SET = cteq6l via LHAPDF: \n"
sed -i 's/^[ ]*PDF_SET[ ]*=.*$/PDF_SET = cteq6l.LHpdf/;
        s/^[ ]*PDF_GRID_PATH[ ]*=.*$/PDF_GRID_PATH = PDFsets/;
       ' LHC/ISR.dat
## Set the runtime environment:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SHERPA_PATH/lib
export SHERPA_PDF_PATH=$LHAPDF_PATH/../share             # using external PDF
export SHERPASYS=$SHERPA_PATH/include/SHERPA-MC
export SHERPA_INC_PATH=$SHERPA_PATH/include/SHERPA-MC
export SHERPA_BIN_PATH=$SHERPA_PATH/bin/SHERPA-MC
export SHERPA_SHARE_PATH=$SHERPA_PATH/../share/SHERPA-MC
# First run: initialization
$progexe PATH=LHC/                       
cd LHC/ && ./makelibs  &&  cd ..
# Actual run:
$progexe PATH=./LHC

WBR,
Oleg.

comment:3 Changed 16 years ago by Frank Siegert

Hi Oleg,

finally I have found time to look at this issue. When I compile with your patch, the compilation of the Sherpa executable fails for me because it doesn't seem to find the Sherpa libraries (which certainly has to do with disabling rpath in your patch).

/usr/bin/ld: warning: libSherpaInitialization.so.0, needed by SHERPA/Main/.libs/libSherpaMain.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libSherpaSingleEvents.so.0, needed by SHERPA/Main/.libs/libSherpaMain.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libSherpaPerturbativePhysics.so.0, needed by SHERPA/Main/.libs/libSherpaMain.so, not found (try using -rpath or -rpath-li
nk)
...
Main.o: In function `main':
SHERPA/Run/Main.C:21: undefined reference to `ATOOLS::exh'
SHERPA/Run/Main.C:21: undefined reference to `ATOOLS::Exception_Handler::Init()'
SHERPA/Run/Main.C:26: undefined reference to `ATOOLS::Terminate()'
SHERPA/Run/Main.C:27: undefined reference to `ATOOLS::Terminate()'
...

Did you not encounter this? I am using gcc 4.2.3, automake 1.10.1, autoconf 2.61, libtool 1.5.26 on Ubuntu 8.04. I simply applied your patch, did an "autoreconf -i" to regenerate the build system, and then "TOOLS/makeinstall -c".

Cheers, Frank

Changed 16 years ago by Oleg.Zenin@cern.ch

Previous patch with LD_LIBRARY_PATH inserted into TOOLS/makeinstall

comment:4 Changed 16 years ago by Oleg.Zenin@cern.ch

Version: 1.1.01.1.1

Thank you, Frank.

Please see attached a slightly corrected patch. With the latter patch Sherpa 1.1.1 successfully compiles in your environment: gcc-4.2.3, autoconf-2.61, automake-1.10.1, libtool-1.5.26.

I'm sorry for the delay, but I couldn't post this LD_LIBRARY_PATH fix w/o having tested it on Ubuntu myself.

WBR, Oleg.

comment:5 Changed 16 years ago by Frank Siegert

Hmmmmm... I understand. But from this it follows, that users of Sherpa will have to set LD_LIBRARY_PATH to include the $prefix/lib/SHERPA-MC directory even _after_ installation, just to be able to run Sherpa, even if they have not moved anything. Or do I misunderstand your suggestion?

comment:6 Changed 16 years ago by Frank Siegert

Hi Oleg again,

I have just finished an implementation without the need for the rpath changes, at least I hope so. So once you have installed Sherpa, and relocated it to <newinstalldir>, you just have to specify the following variables:

  export SHERPA_LIBRARY_PATH=<newinstalldir>/lib/SHERPA-MC
  export SHERPA_SHARE_PATH=<newinstalldir>/share/SHERPA-MC
  export SHERPA_LIBRARY_PATH=<newinstalldir>/lib/SHERPA-MC
  export LD_LIBRARY_PATH=$SHERPA_LIBRARY_PATH:$LD_LIBRARY_PATH

This should enable you to run <newinstalldir>/bin/Sherpa.

I have prepared a beta-version tarball so that you can test whether this works for you and fulfills all your requirements. You can find it at

http://www.hepforge.org/archive/sherpa/Sherpa-beta.1.1.2.tar.gz

Thanks for testing,

Frank

PS: This tarball also contains the functionality requested for flexible LHAPDF paths. Since it uses LHAPDF's own pdfsets-finding-logic, you can simply specify the environment variable LHAPATH to point to the location of the PDFsets. I have tested this with LHAPDF 5.3.1 and LHAPDF 5.4.0 (which needs a small fix in its include files, which will be part of 5.4.1).

comment:7 Changed 16 years ago by anonymous

Thanks, Frank. It works if SHERPA_INCLUDE_PATH is defined as well:

export SHERPA_LIBRARY_PATH=$SHERPA_PATH/lib/SHERPA-MC export SHERPA_INCLUDE_PATH=$SHERPA_PATH/include/SHERPA-MC export SHERPA_SHARE_PATH=$SHERPA_PATH/../share/SHERPA-MC export LD_LIBRARY_PATH=$SHERPA_LIBRARY_PATH:$LD_LIBRARY_PATH

Best regards, Oleg.

comment:8 in reply to:  7 Changed 16 years ago by Oleg.Zenin@cern.ch

I'm sorry for the broken formatting in the previous comment. It should read as

Thanks, Frank. It works if SHERPA_INCLUDE_PATH is defined as well:
 
% export SHERPA_LIBRARY_PATH=$SHERPA_PATH/lib/SHERPA-MC
% export SHERPA_INCLUDE_PATH=$SHERPA_PATH/include/SHERPA-MC
% export SHERPA_SHARE_PATH=$SHERPA_PATH/../share/SHERPA-MC
% export LD_LIBRARY_PATH=$SHERPA_LIBRARY_PATH:$LD_LIBRARY_PATH
 
Best regards,
Oleg.

comment:9 Changed 16 years ago by Frank Siegert

Resolution: fixed
Status: newclosed

Hi Oleg,

sorry, I forgot to replace the "LIBRARY" in one of the lines with "INCLUDE". Of course you are right with your export commands. Thanks for your feedback, due to which I am closing this bug. This feature is going to be available in release 1.1.2 in the near future.

Cheers, Frank

comment:10 Changed 15 years ago by anonymous

Last edited 10 years ago by anonymous (previous) (diff)

comment:11 Changed 15 years ago by Corleon2

Last edited 10 years ago by Frank Siegert (previous) (diff)

comment:12 Changed 12 years ago by Frank Siegert

Milestone: rel-old

comment:13 Changed 10 years ago by Stefan Hoeche

Milestone: old

Milestone old deleted

comment:14 Changed 10 years ago by gastby@webpm.com

Milestone: rel-2.1.1
Last edited 10 years ago by Frank Siegert (previous) (diff)

comment:15 Changed 10 years ago by Frank Siegert

Milestone: rel-2.1.1

Modify Ticket

Change Properties
Action
as closed The owner will remain Frank Siegert.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.