tudo-astroparticlephysics / PROPOSAL

Monte Carlo Simulation propagating charged Leptons through Media as C++ Library
GNU Lesser General Public License v3.0
35 stars 21 forks source link

problem building with conan on CentOS7 (docker) #322

Closed pkalaczynski closed 1 year ago

pkalaczynski commented 2 years ago

Hi, I've been trying to follow the instruction in https://github.com/tudo-astroparticlephysics/PROPOSAL/blob/master/INSTALL.md but after I do:

yum install -y devtoolset-7-gcc.x86_64 && yum clean -y all
scl enable devtoolset-7 bash
conan profile update settings.compiler.cppstd=14 default
conan profile update settings.compiler.version=7 default
conan profile update settings.compiler.libcxx=libstdc++11 default
git clone https://github.com/tudo-astroparticlephysics/PROPOSAL.git
cd PROPOSAL && mkdir build && cd build    
conan install .. -o with_python=True -o with_testing=False --build=missing

I get:

[root@53f30fa7e6df build]# conan install .. -o with_python=True -o with_testing=False --build=missing
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=14
compiler.libcxx=libstdc++11
compiler.version=7
os=Linux
os_build=Linux
[options]
with_python=True
with_testing=False
[build_requires]
[env]

conanfile.py (proposal/None): Installing package
Requirements
    boost/1.75.0 from 'conancenter' - Cache
    bzip2/1.0.8 from 'conancenter' - Cache
    cubicinterpolation/0.1.5 from 'conancenter' - Cache
    eigen/3.3.9 from 'conancenter' - Cache
    fmt/8.1.1 from 'conancenter' - Cache
    libbacktrace/cci.20210118 from 'conancenter' - Cache
    nlohmann_json/3.9.1 from 'conancenter' - Cache
    pybind11/2.6.2 from 'conancenter' - Cache
    spdlog/1.10.0 from 'conancenter' - Cache
    zlib/1.2.12 from 'conancenter' - Cache
Packages
    boost/1.75.0:1634b696a0c867f781d585d17067590c864a2832 - Build
    bzip2/1.0.8:b27e2b40bcb70be2e7d6f0e0c6e43e35c530f8d3 - Cache
    cubicinterpolation/0.1.5:368862ae27bbb323d360a9c0a6d9b23a711299d8 - Build
    eigen/3.3.9:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    fmt/8.1.1:5dc8476d34fc20d9a29c4f42815d05e1756eb078 - Build
    libbacktrace/cci.20210118:d50a0d523d98c15bb147b18fa7d203887c38be8b - Cache
    nlohmann_json/3.9.1:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    pybind11/2.6.2:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    spdlog/1.10.0:a6152f401a29015baf5fbab6cf91b3f89c9a3ea2 - Build
    zlib/1.2.12:d50a0d523d98c15bb147b18fa7d203887c38be8b - Cache
Build requirements
    b2/4.9.2 from 'conancenter' - Cache
Build requirements packages
    b2/4.9.2:4db1be536558d833e52e862fd84d64d75c2b3656 - Cache

Installing (downloading, building) binaries...
b2/4.9.2: Already installed!
bzip2/1.0.8: Already installed!
eigen/3.3.9: Already installed!
fmt/8.1.1: WARN: Build folder is dirty, removing it: /root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078
fmt/8.1.1: Copying sources to build folder
fmt/8.1.1: Building your package in /root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078
fmt/8.1.1: Generator txt created conanbuildinfo.txt
fmt/8.1.1: Calling generate()
fmt/8.1.1: WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
fmt/8.1.1: Preset 'release' added to CMakePresets.json. Invoke it manually using 'cmake --preset release'
fmt/8.1.1: If your CMake version is not compatible with CMakePresets (<3.19) call cmake like: 'cmake <path> -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078/build/generators/conan_toolchain.cmake -DFMT_DOC=OFF -DFMT_TEST=OFF -DFMT_INSTALL=ON -DFMT_LIB_DIR=lib -DFMT_OS=ON -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release'
fmt/8.1.1: Aggregating env generators
fmt/8.1.1: Calling build()
fmt/8.1.1: apply_conandata_patches(): No patches defined in conandata
fmt/8.1.1: CMake command: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/root/.conan/data/fmt/8.1.1/_/_/package/5dc8476d34fc20d9a29c4f42815d05e1756eb078" -DFMT_DOC="OFF" -DFMT_TEST="OFF" -DFMT_INSTALL="ON" -DFMT_LIB_DIR="lib" -DFMT_OS="ON" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078/src"
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.1...3.18 or higher is required.  You are running version 2.8.12.2

-- Configuring incomplete, errors occurred!
fmt/8.1.1: 
fmt/8.1.1: ERROR: Package '5dc8476d34fc20d9a29c4f42815d05e1756eb078' build failed
fmt/8.1.1: WARN: Build folder /root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078/build/Release
ERROR: fmt/8.1.1: Error in build() method, line 98
        cmake.configure()
        ConanException: Error 1 while executing cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/root/.conan/data/fmt/8.1.1/_/_/package/5dc8476d34fc20d9a29c4f42815d05e1756eb078" -DFMT_DOC="OFF" -DFMT_TEST="OFF" -DFMT_INSTALL="ON" -DFMT_LIB_DIR="lib" -DFMT_OS="ON" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078/src"
[root@53f30fa7e6df build]#

I tried upgrading to Cmake 3.6 but it still fails:

...
Installing (downloading, building) binaries...
b2/4.9.2: Already installed!
bzip2/1.0.8: Already installed!
eigen/3.3.9: Already installed!
fmt/8.1.1: WARN: Build folder is dirty, removing it: /root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078
fmt/8.1.1: Copying sources to build folder
fmt/8.1.1: Building your package in /root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078
fmt/8.1.1: Generator txt created conanbuildinfo.txt
fmt/8.1.1: Calling generate()
fmt/8.1.1: WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
fmt/8.1.1: Preset 'release' added to CMakePresets.json. Invoke it manually using 'cmake --preset release'
fmt/8.1.1: If your CMake version is not compatible with CMakePresets (<3.19) call cmake like: 'cmake <path> -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078/build/generators/conan_toolchain.cmake -DFMT_DOC=OFF -DFMT_TEST=OFF -DFMT_INSTALL=ON -DFMT_LIB_DIR=lib -DFMT_OS=ON -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release'
fmt/8.1.1: Aggregating env generators
fmt/8.1.1: Calling build()
fmt/8.1.1: apply_conandata_patches(): No patches defined in conandata
fmt/8.1.1: CMake command: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/root/.conan/data/fmt/8.1.1/_/_/package/5dc8476d34fc20d9a29c4f42815d05e1756eb078" -DFMT_DOC="OFF" -DFMT_TEST="OFF" -DFMT_INSTALL="ON" -DFMT_LIB_DIR="lib" -DFMT_OS="ON" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078/src"
-- CMake version: 3.6.2
CMake Error at /root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078/build/generators/conan_toolchain.cmake:8 (include_guard):
  Unknown CMake command "include_guard".
Call Stack (most recent call first):
  /opt/rh/llvm-toolset-7/root/usr/share/cmake/Modules/CMakeDetermineSystem.cmake:98 (include)
  CMakeLists.txt:66 (project)

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
fmt/8.1.1: 
fmt/8.1.1: ERROR: Package '5dc8476d34fc20d9a29c4f42815d05e1756eb078' build failed
fmt/8.1.1: WARN: Build folder /root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078/build/Release
ERROR: fmt/8.1.1: Error in build() method, line 98
        cmake.configure()
        ConanException: Error 1 while executing cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/root/.conan/data/fmt/8.1.1/_/_/package/5dc8476d34fc20d9a29c4f42815d05e1756eb078" -DFMT_DOC="OFF" -DFMT_TEST="OFF" -DFMT_INSTALL="ON" -DFMT_LIB_DIR="lib" -DFMT_OS="ON" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/root/.conan/data/fmt/8.1.1/_/_/build/5dc8476d34fc20d9a29c4f42815d05e1756eb078/src"
[root@53f30fa7e6df build]#

My conan profile is:

[root@53f30fa7e6df build]# conan profile show default
Configuration for profile default:

[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=7
compiler.libcxx=libstdc++11
build_type=Release
compiler.cppstd=14
pkalaczynski commented 2 years ago

It is already there in fact:

[root@53f30fa7e6df build]# cmake3 -version
cmake version 3.6.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).
[root@53f30fa7e6df build]#
pkalaczynski commented 2 years ago

Hmmm when trying to just do cmake3 ../ I got

[root@53f30fa7e6df build]# cmake3 .. 
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.9 or higher is required.  You are running version 3.6.2

-- Configuring incomplete, errors occurred!
[root@53f30fa7e6df build]# cmake3 ../

so maybe I just have to upgrade it ...

Jean1995 commented 1 year ago

Did upgrading the version of CMake solve the problem?

pkalaczynski commented 1 year ago

I've switched to Redhat (https://hub.docker.com/r/redhat/ubi8) to be able to upgrade CMake and gcc and now I got to the conan build .. step, but there it fails almost at the end:

...
Consolidate compiler generated dependencies of target PROPOSAL
[ 89%] Built target PROPOSAL
Consolidate compiler generated dependencies of target pyPROPOSAL
[ 90%] Linking CXX shared library proposal.cpython-37m-x86_64-linux-gnu.so
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(abstract.o): relocation R_X86_64_32S against symbol `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(boolobject.o): relocation R_X86_64_32S against symbol `_Py_FalseStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(bytearrayobject.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(bytesobject.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(call.o): relocation R_X86_64_32S against symbol `PyFunction_Type' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(classobject.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(descrobject.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(exceptions.o): relocation R_X86_64_32S against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(floatobject.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(frameobject.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(funcobject.o): relocation R_X86_64_32S against symbol `PyCode_Type' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(iterobject.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(listobject.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(longobject.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(dictobject.o): relocation R_X86_64_32S against `.text.hot' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(memoryobject.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(methodobject.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(moduleobject.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(object.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(obmalloc.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(capsule.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(rangeobject.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(setobject.o): relocation R_X86_64_32S against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(sliceobject.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(structseq.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(tupleobject.o): relocation R_X86_64_32 against symbol `_PyEval_SliceIndexNotNone' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(typeobject.o): relocation R_X86_64_32 against symbol `PyBaseObject_Type' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(unicodeobject.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(unicodectype.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(weakrefobject.o): relocation R_X86_64_32S against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(_warnings.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(bltinmodule.o): relocation R_X86_64_32S against symbol `PyFilter_Type' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(ceval.o): relocation R_X86_64_32 against symbol `_PyRuntime' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(compile.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(codecs.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(errors.o): relocation R_X86_64_32S against symbol `PyTraceBack_Type' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(future.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(getargs.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(getversion.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(import.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(importdl.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(marshal.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(modsupport.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(peephole.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(pyhash.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(pylifecycle.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(pystate.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(context.o): relocation R_X86_64_32 against symbol `PyContext_Type' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(hamt.o): relocation R_X86_64_32S against symbol `_PyHamt_BitmapNode_Type' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(pythonrun.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(pytime.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(bootstrap_hash.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(structmember.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(symtable.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(sysmodule.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(thread.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(traceback.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(pystrtod.o): relocation R_X86_64_32S against symbol `_Py_ctype_tolower' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(dtoa.o): relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(formatter_unicode.o): relocation R_X86_64_32S against symbol `_Py_ctype_table' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(fileutils.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(dynload_shlib.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(main.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(gcmodule.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(posixmodule.o): relocation R_X86_64_32S against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(errnomodule.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(pwdmodule.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(_sre.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(_codecsmodule.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(_weakref.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(_functoolsmodule.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(_operator.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(_collectionsmodule.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(_abc.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(itertoolsmodule.o): relocation R_X86_64_32S against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(atexitmodule.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(signalmodule.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(_stat.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(timemodule.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(_threadmodule.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(_localemodule.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(_iomodule.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(iobase.o): relocation R_X86_64_32 against symbol `_Py_FalseStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(fileio.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(bytesio.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(bufferedio.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(textio.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(stringio.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(zipimport.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(faulthandler.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(_tracemalloc.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(hashtable.o): relocation R_X86_64_32 against symbol `PyMem_RawFree' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(symtablemodule.o): relocation R_X86_64_32 against symbol `PyUnicode_FSDecoder' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(xxsubtype.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(getbuildinfo.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(acceler.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(grammar1.o): relocation R_X86_64_32S against symbol `_PyParser_TokenNames' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(myreadline.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(parsetok.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(tokenizer.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(accu.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(bytes_methods.o): relocation R_X86_64_32S against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(cellobject.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(codeobject.o): relocation R_X86_64_32S against symbol `PyUnicode_Type' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(complexobject.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(enumobject.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(genobject.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(fileobject.o): relocation R_X86_64_32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(odictobject.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(namespaceobject.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(Python-ast.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(ast.o): relocation R_X86_64_32S against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(ast_opt.o): relocation R_X86_64_32S against symbol `PyFrozenSet_Type' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(ast_unparse.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(getcompiler.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(getcopyright.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(getplatform.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(mystrtoul.o): relocation R_X86_64_32S against symbol `_Py_ctype_table' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(pathconfig.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(getopt.o): relocation R_X86_64_32S against `.rodata.str4.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(getpath.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libpython3.7m.a(parser.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
gmake[2]: *** [src/pyPROPOSAL/CMakeFiles/pyPROPOSAL.dir/build.make:282: src/pyPROPOSAL/proposal.cpython-37m-x86_64-linux-gnu.so] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:192: src/pyPROPOSAL/CMakeFiles/pyPROPOSAL.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
ERROR: conanfile.py (proposal/None): Error in build() method, line 58
        cmake.build()
        ConanException: Error 2 while executing cmake --build '/root/PROPOSAL/build' '--' '-j4'

Sorry for the delay by the way, I had to focus on other pressing taksks ...

pkalaczynski commented 1 year ago

What I executed in the container was:

yum install -y cmake && yum clean -y all
yum install -y gcc gcc-c++ openssl-devel bzip2-devel libffi-devel make sqlite-devel git && yum clean -y all
PY37_VERSION=3.7.6
cd /usr/src && curl https://www.python.org/ftp/python/${PY37_VERSION}/Python-${PY37_VERSION}.tgz | tar -xz &&\
  cd Python-${PY37_VERSION} && ./configure --enable-optimizations && make -j4 altinstall &&\
  rm -rf /usr/src/Python-${PY37_VERSION}
python3.7 -c "import sqlite3"
cd
pip3.7 install conan
git clone https://github.com/tudo-astroparticlephysics/PROPOSAL.git && cd PROPOSAL && mkdir build && cd build
conan install .. -o with_python=True -o with_testing=False --build=missing --with-pic
# update the conan profile:
conan profile update settings.compiler.version=11.2.1 default
conan profile update settings.compiler.libcxx=libstdc++11 default
export CXXFLAGS="$CXXFLAGS -fPIC"
conan build ..
Jean1995 commented 1 year ago

What I executed in the container was:

yum install -y cmake && yum clean -y all
yum install -y gcc gcc-c++ openssl-devel bzip2-devel libffi-devel make sqlite-devel git && yum clean -y all
PY37_VERSION=3.7.6
cd /usr/src && curl https://www.python.org/ftp/python/${PY37_VERSION}/Python-${PY37_VERSION}.tgz | tar -xz &&\
  cd Python-${PY37_VERSION} && ./configure --enable-optimizations && make -j4 altinstall &&\
  rm -rf /usr/src/Python-${PY37_VERSION}
python3.7 -c "import sqlite3"
cd
pip3.7 install conan
git clone https://github.com/tudo-astroparticlephysics/PROPOSAL.git && cd PROPOSAL && mkdir build && cd build
conan install .. -o with_python=True -o with_testing=False --build=missing --with-pic
# update the conan profile:
conan profile update settings.compiler.version=11.2.1 default
conan profile update settings.compiler.libcxx=libstdc++11 default
export CXXFLAGS="$CXXFLAGS -fPIC"
conan build ..

I can reproduce this issue locally and will have a look into it.

maxnoe commented 1 year ago

@pkalaczynski You seem to be linking against a static python library (libpython3.7m.a), make sure you build and link against the shared one, probably by including --enable-shared in the ./configure call for python (or include -fPIC already in the CFLAGS for the python build.

Jean1995 commented 1 year ago

@pkalaczynski You seem to be linking against a static python library (libpython3.7m.a), make sure you build and link against the shared one, probably by including --enable-shared in the ./configure call for python (or include -fPIC already in the CFLAGS for the python build.

Adding the --enable-shared flag to the ./configure call, i.e.

cd /usr/src && curl https://www.python.org/ftp/python/${PY37_VERSION}/Python-${PY37_VERSION}.tgz | tar -xz &&\
  cd Python-${PY37_VERSION} && ./configure --enable-optimizations --enable-shared && make -j4 altinstall &&\
  rm -rf /usr/src/Python-${PY37_VERSION}

solved the problem for me. I had so follow the steps from here to make python work afterwards.

@pkalaczynski Note that this line

conan profile update settings.compiler.version=11.2.1 default

should not be executed, since it overwrites the (correct) compiler version set in conan and can lead to problems.

pkalaczynski commented 1 year ago

Thank you @Jean1995 @maxnoe , now it worked for me as well!

For anyone with a similar problem reading this issue, here's the complete working code:

yum install -y cmake && yum clean -y all
yum install -y gcc gcc-c++ openssl-devel bzip2-devel libffi-devel make sqlite-devel git && yum clean -y all
PY37_VERSION=3.7.6
cd /usr/src && curl https://www.python.org/ftp/python/${PY37_VERSION}/Python-${PY37_VERSION}.tgz | tar -xz &&\
  cd Python-${PY37_VERSION} && ./configure --enable-optimizations --enable-shared && make -j4 altinstall &&\
  rm -rf /usr/src/Python-${PY37_VERSION}
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
python3.7 -c "import sqlite3"
cd
pip3.7 install conan
git clone https://github.com/tudo-astroparticlephysics/PROPOSAL.git && cd PROPOSAL && mkdir build && cd build
conan install .. -o with_python=True -o with_testing=False --build=missing
conan profile update settings.compiler.libcxx=libstdc++11 default
export CXXFLAGS="$CXXFLAGS -fPIC"
conan build ..
cmake --install .