Notes on Python and RHEL6


tar zxvf Python-2.7.13.tgz
cd Python-2.7.13
./configure --prefix=`pwd` --enable-shared
make
make install

> diff ~/build_scripts/gluex_env_jlab.csh gluex_env_jlab_my_python.csh
21,22c21,23
<     setenv PATH $BUILD_SCRIPTS/patches/jlab_extras/rh6:/apps/python/PRO/bin:$PATH
<     setenv LD_LIBRARY_PATH /apps/python/PRO/lib:$LD_LIBRARY_PATH
---
>     set pypath=/group/halld/Software/builds/$BMS_OSNAME/python/Python-2.7.13
>     setenv PATH $pypath/bin:$PATH
>     setenv LD_LIBRARY_PATH $pypath/lib:$LD_LIBRARY_PATH

> git diff GNUmakefile
diff --git a/GNUmakefile b/GNUmakefile
index 81bc97f..1e461d9 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -83,7 +83,7 @@ INTYLIBS += -Wl,--whole-archive $(DANALIBS) -Wl,--no-whole-archive
 INTYLIBS += -fPIC -I$(HDDS_HOME) -I$(XERCESCROOT)/include
 INTYLIBS += -L${XERCESCROOT}/lib -lxerces-c
 INTYLIBS += -L$(G4TMPDIR) -lhdds
-INTYLIBS += -lboost_python $(shell python-config --ldflags)
+INTYLIBS += -lboost_python -L$(shell python-config --prefix)/lib $(shell python-config --ldflags)
 INTYLIBS += -L$(G4ROOT)/lib64 $(patsubst $(G4ROOT)/lib64/lib%.so, -l%, $(G4shared_libs))
 
 .PHONY: all


Error Building ROOT on jlabl1 with roofit Enabled

Here is the error on jlabl1 (RHEL6.7, i686):

g++ -shared -Wl,-soname,libPyROOT.so -m32 -O2 -Wl,--no-undefined -Wl,--as-needed -o lib/libPyROOT.so bindings/pyroot/src/Adapters.o bindings/pyroot/src/ClassMethodHolder.o bindings/pyroot/src/ConstructorHolder.o bindings/pyroot/src/Converters.o bindings/pyroot/src/Executors.o bindings/pyroot/src/FunctionHolder.o bindings/pyroot/src/MemoryRegulator.o bindings/pyroot/src/MethodHolder.o bindings/pyroot/src/MethodProxy.o bindings/pyroot/src/ObjectProxy.o bindings/pyroot/src/PropertyProxy.o bindings/pyroot/src/PyBufferFactory.o bindings/pyroot/src/PyRootType.o bindings/pyroot/src/PyStrings.o bindings/pyroot/src/Pythonize.o bindings/pyroot/src/RootModule.o bindings/pyroot/src/RootWrapper.o bindings/pyroot/src/TCustomPyTypes.o bindings/pyroot/src/TemplateProxy.o bindings/pyroot/src/TPyClassGenerator.o bindings/pyroot/src/TPyDispatcher.o bindings/pyroot/src/TPyException.o bindings/pyroot/src/TPyFitFunction.o bindings/pyroot/src/TPyReturn.o bindings/pyroot/src/TPyROOTApplication.o bindings/pyroot/src/TPySelector.o bindings/pyroot/src/TPython.o bindings/pyroot/src/TRflxCallback.o bindings/pyroot/src/TSetItemHolder.o bindings/pyroot/src/Utility.o bindings/pyroot/src/G__PyROOT.o -Llib -lCore -lCint -ldl -Llib -lRIO -lHist -lGraf -lGraf3d -lGpad -lTree -lMatrix -lNet -lThread -lMathCore -lCore -lCint -L/apps/python/PRO/lib -lpython2.7
/apps/python/PRO/lib/libpython2.7.a(dynload_shlib.o): In function `_PyImport_GetDynLoadFunc':
/apps/python/BUILD/Python-2.7.1/Python/dynload_shlib.c:94: undefined reference to `dlsym'
/apps/python/BUILD/Python-2.7.1/Python/dynload_shlib.c:130: undefined reference to `dlopen'
/apps/python/BUILD/Python-2.7.1/Python/dynload_shlib.c:141: undefined reference to `dlsym'
/apps/python/BUILD/Python-2.7.1/Python/dynload_shlib.c:133: undefined reference to `dlerror'

Looks like the python library needs libdl.so but that is included earlier and so is not searched. This is from make. How could this work on other platforms?

On jlabl3 (RHEL6.7, x86_64):

g++ -shared -Wl,-soname,libPyROOT.so -m64 -O2 -Wl,--no-undefined -Wl,--as-needed -o lib/libPyROOT.so bindings/pyroot/src/Adapters.o bindings/pyroot/src/ClassMethodHolder.o bindings/pyroot/src/ConstructorHolder.o bindings/pyroot/src/Converters.o bindings/pyroot/src/Executors.o bindings/pyroot/src/FunctionHolder.o bindings/pyroot/src/MemoryRegulator.o bindings/pyroot/src/MethodHolder.o bindings/pyroot/src/MethodProxy.o bindings/pyroot/src/ObjectProxy.o bindings/pyroot/src/PropertyProxy.o bindings/pyroot/src/PyBufferFactory.o bindings/pyroot/src/PyRootType.o bindings/pyroot/src/PyStrings.o bindings/pyroot/src/Pythonize.o bindings/pyroot/src/RootModule.o bindings/pyroot/src/RootWrapper.o bindings/pyroot/src/TCustomPyTypes.o bindings/pyroot/src/TemplateProxy.o bindings/pyroot/src/TPyClassGenerator.o bindings/pyroot/src/TPyDispatcher.o bindings/pyroot/src/TPyException.o bindings/pyroot/src/TPyFitFunction.o bindings/pyroot/src/TPyReturn.o bindings/pyroot/src/TPyROOTApplication.o bindings/pyroot/src/TPySelector.o bindings/pyroot/src/TPython.o bindings/pyroot/src/TRflxCallback.o bindings/pyroot/src/TSetItemHolder.o bindings/pyroot/src/Utility.o bindings/pyroot/src/G__PyROOT.o -Llib -lCore -lCint -ldl -Llib -lRIO -lHist -lGraf -lGraf3d -lGpad -lTree -lMatrix -lNet -lThread -lMathCore -lCore -lCint -L/apps/python/PRO/lib -lpython2.7
==> lib/libPyROOT.so done

No problem.

Converting build_scripts from Subversion to Git

Questions and answers for plan to conversion to use of the new git repository:

  • Where to locate the new JLab working version?
    • In /group/halld/Software/build_scripts. This is a move from SVN location under scripts. The old location is misleading now since build_scripts is no longer an SVN subdirectory of scripts.
  • Is the working version an archive or a clone?
    • It is a clone. That way one can inquire about version information.
  • Is the working version a release branch or master?
    • For now is is a temporary branch. See below.

The conversion was done at SVN revision 19207. The last change to build_scripts previoiusly was at revision 19203.

The head of the build_scripts master branch does not support getting code from Git repositories at all. It does support getting source from Subversion repositories. Before conversion of build_scripts to Git, in special versions of Makefile_hdds and Makefile_sim-recon an archive is made from the local JLab Git repositories to support the nightly builds. The build_halld.csh script did this by changing the checkout (from subversion) of build_scripts to get these special versions at revision 19034 of build scripts via svn update. Note that this only worked at JLab. Here is the relevant part of the script.

< # temp update of git-enabled makefiles
< pushd build_scripts
< svn update -r19034 Makefile_hdds Makefile_sim-recon
< popd

In git this commit this svn revision is commit 16fa07793df6bf77359dd597a5e99cf685dd2f70

On JLab, in the Software/build_scripts repository, made branch nightly_temp that uses the local-only git enabled versions of Makefile_hdds and Makefile_sim-recon. It also has a modified version of build_halld.csh that will git-archive from this branch. That repository has this branch checked-out so that the special version of build_halld.csh is out there to be used.

The nightly build is now accessing build_scripts in this location, i. e., /group/halld/Software/build_scripts.

Notes on Version Management

  • base it on gluex_top
  • default, not there, prod
  • use it for set-up at first
  • the list of packages is at https://halldweb1.jlab.org/wiki/index.php/Scripts_for_Installing_GlueX_Software
  • philosophy on versions:
    • build philosophy
      • makefiles should respect version numbers in environment
      • if no version specified, use default version, default version is package dependent
      • if version is specified, use it, of course
      • no default versions in makefile
    • directory philosophy
      • use version number if possible
      • if from repository trunk, use “-latest”
      • if multiple versions needed because of multiple dependencies, use combo of directory names
    • setup script philosophy
      • default choices, determined by prod
      • use version.xml as input to a script which calls gluex_env.csh

Current list of makefiles:

  1. xerces-c
  2. CERNLIB
  3. ROOT
  4. CLHEP
  5. Geant4
  6. GSL (Gnome Scientific Library)
  7. CCDB
  8. JANA
  9. HDDS
  10. sim-recon

 

References on the getarg_fix Patch to CERNLIB in build_scripts

https://markito3.wordpress.com/2009/12/15/1737/

Contains an example of the error when nothing is done.

https://lists.debian.org/debian-science/2007/07/msg00042.html

Contains an alternate solution, with code. Notes that getarg is needed for “mpich”.

http://www-zeuthen.desy.de/linear_collider/cernlib/new/cernlib_2005.html

Updated version of Vogt’s CERNLIB 64-bit site.

http://www-zeuthen.desy.de/linear_collider/cernlib/cernlib_2005.html

Old version of Vogt’s site. Contains comment on need for getarg fix, but link to the code is dead now.

https://gcc.gnu.org/onlinedocs/gcc-4.7.1/gfortran/GETARG.html

Documentation for getarg from gfortran 4.7.1. Notes that it is provided for backward compatibility.

https://gcc.gnu.org/onlinedocs/gcc-4.2.2/gfortran/GETARG.html

Shows getarg appearing in gcc 4.2.2 at least.

http://home.fnal.gov/~rhatcher/macosx/fetch_and_build_cern_linux.sh_080606

This is probably where I got the patch in the first place.

http://opensource.apple.com/source/Libcompat/Libcompat-14.1/4.4.subproj/cuserid.c?txt

A copy of the patch’s cuserid.c from the web, except our version hardwires L_cuserid to 9. See SVN revision 5482.