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


Advertisements

ROOT, Python 2, CentOS7, ifarm1402

Did not succeed building ROOT 6 on ifarm1402 (CentOS7) using the Python 2 version in /apps.

[ 88%] Building CXX object bindings/pyroot/CMakeFiles/PyROOT.dir/src/TTupleOfInstances.cxx.o
Linking CXX shared library ../../lib/libPyROOT.so
/usr/bin/ld: /apps/python/2.7.12/lib/libpython2.7.a(myreadline.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/apps/python/2.7.12/lib/libpython2.7.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
gmake[4]: *** [lib/libPyROOT.so] Error 1
gmake[4]: Leaving directory `/w/halld-scifs1a/home/gluex/gluex_top/root/root-6.06.08/build_dir'
gmake[3]: *** [bindings/pyroot/CMakeFiles/PyROOT.dir/all] Error 2
gmake[3]: Leaving directory `/w/halld-scifs1a/home/gluex/gluex_top/root/root-6.06.08/build_dir'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/w/halld-scifs1a/home/gluex/gluex_top/root/root-6.06.08/build_dir'
make[1]: *** [root-6.06.08/.build_done] Error 2
make[1]: Leaving directory `/w/halld-scifs1a/home/gluex/gluex_top/root'
make: *** [root_build] Error 2

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.