lamyj/dicomifier

compilation

valeryozenne opened this issue · 3 comments

Hi Julien,

I would like to install dicomifier without conda, either using ppa or directly by building it. Using the build, I 'm struggling with PYBIND11. I tried to build it either in python2.7 or python3 . And I install pybind with apt get, pip and directly from source as the issue was reported in google. But none of these solved my problem . Do you have any recommendation ?

Thanks in advance
Valéry

[ 27%] Building CXX object src/python/dicomifier/CMakeFiles/pydicomifier_dicomifier.dir/dicomifier.cpp.o
/home/valery/Dev/dicomifier/src/python/dicomifier/dicomifier.cpp:13:16: error: expected constructor, destructor, or type conversion before ‘(’ token
PYBIND11_MODULE(_dicomifier, _dicomifier)

CMake was fine, using gcc 7, on ubuntu 18.04

-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- date_time
-- filesystem
-- system
-- regex
-- Found PythonInterp: /usr/bin/python (found version "2.7.17")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Success
-- Performing Test HAS_CPP11_FLAG
-- Performing Test HAS_CPP11_FLAG - Success
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- filesystem
-- system
-- unit_test_framework
-- Configuring done
-- Generating done
-- Build files have been written to: /home/valery/Dev/dicomifier/build

ccmake output
BUILD_EXAMPLES ON
BUILD_SHARED_LIBS ON
BUILD_TESTING ON
CMAKE_BUILD_TYPE
CMAKE_INSTALL_PREFIX /usr/local
PYBIND11_CPP_STANDARD -std=c++14
PYBIND11_PYTHON_VERSION
pybind11_DIR /usr/lib/cmake/pybind11

Hi

The PPA install is fine , so I don't really need to solve the issue anymore, but I'll be happy to test in odre to have successful compilation in my computer.
Best

lamyj commented

Let's try and solve this nevertheless :) From your CMake output, it appears CMake is picking Python 2.17 instead of Python 3 (Found PythonInterp: /usr/bin/python (found version "2.7.17")) and I can indeed reproduce your error with Python 2. You should be able to compile Dicomifier by running CMake with an option specifying the Python interpreter (e.g. -DPYTHON_EXECUTABLE=/usr/bin/python3, as in the CI scripts), but depending on your installed Python packages, it may still fail at run-time: the dependencies I use are here.

A side note about Odil: you'll need the latest version for Dicomifier 2.0, which is not yet in the official repositories. It is however available in my unofficial repo.

Let me know if this fix works for you. To avoid the same problem for future users, I've updated the CMakeLists (3e3a032) to check the versions of Python, Boost, Pybind11 and Odil.

Your indication are perfect, indeed I was missing one libraries and using the python3 , compilation succeed. Thanks a lot and have a good weekend .
I close the issue.

Les paquets supplémentaires suivants seront installés :
python-pybind11
Paquets suggérés :
pybind11-doc
Les paquets suivants seront mis à jour :
pybind11-dev python-pybind11 python3-pybind11