#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)
Change History (17)
Changed 17 years ago by
Attachment: | relocation-1.1.0.patch added |
---|
comment:1 Changed 17 years ago by
Owner: | changed from support@sherpa-mc.de to Frank Siegert |
---|---|
Version: | trunk → 1.1.0 |
comment:2 Changed 17 years ago by
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
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
Attachment: | sherpa-1.1.1-relocation.patch added |
---|
Previous patch with LD_LIBRARY_PATH inserted into TOOLS/makeinstall
comment:4 Changed 16 years ago by
Version: | 1.1.0 → 1.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
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
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 follow-up: 8 Changed 16 years ago by
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 Changed 16 years ago by
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
Resolution: | → fixed |
---|---|
Status: | new → closed |
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:12 Changed 13 years ago by
Milestone: | → rel-old |
---|
comment:14 Changed 11 years ago by
Milestone: | → rel-2.1.1 |
---|
comment:15 Changed 11 years ago by
Milestone: | rel-2.1.1 |
---|
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