python3 build
Created by: mhardcastle
I'm trying to build DPPP in a native Python 3 environment, i.e. python == python3.7 and the appropriate boost libraries are all there. (In detail this is a singularity image based on Debian buster.)
With the default makefile I get linking errors of the form
100%] Linking CXX executable DPPP
[100%] Built target dppp_testdyndppp
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_Size'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_FromStringAndSize'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_FromString'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyInt_Type'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyInt_FromLong'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyFile_FromString'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyNumber_Divide'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyUnicodeUCS4_FromEncodedObject'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyNumber_InPlaceDivide'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_InternFromString'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyUnicodeUCS4_AsWideChar'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyInt_AsLong'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_AsString'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_FromFormat'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyClass_Type'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyFile_AsFile'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `Py_InitModule4_64'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_Type'
collect2: error: ld returned 1 exit status
make[2]: *** [DPPP/CMakeFiles/DPPP.dir/build.make:413: DPPP/DPPP] Error 1
make[1]: *** [CMakeFiles/Makefile2:514: DPPP/CMakeFiles/DPPP.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
This I think is a python 2/3 incompatibility. I can fix the compile errors by editing CMakeLists.txt to look for Python and explicitly use the version of python it finds for the boost library:
FIND_PACKAGE(Python REQUIRED COMPONENTS Interpreter Development)
INCLUDE_DIRECTORIES( ${Python_INCLUDE_DIRS} )
#Prevent accidentally finding old BoostConfig.cmake file from casapy
set(Boost_NO_BOOST_CMAKE ON)
find_package(Boost COMPONENTS date_time filesystem python${Python_VERSION_MAJOR}${Python_VERSION_MINOR} program_options system unit_test_framework REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
but this gives a warning about not being able to build the Python DPPP interface (which is fine for my purposes). I don't understand cmake well enough to debug this further.
It would be good if DPPP could cope with a python3 based system...