lamyj / odil

Odil is a C++11 library for the DICOM standard
Other
85 stars 21 forks source link

Error in compilation #81

Closed valeryozenne closed 3 years ago

valeryozenne commented 3 years ago

Hi,

I have some difficulties to compile odil and dicomifier on a recent ubuntu 20.04

I first install odil 1.1 using the package manager but dicomifier complain in the cmake.

Could NOT find a supported Odil version
  (odil.Reader.read_file(file_name: str, ...) is missing

So I try to compile odil 1.2 but the compilation stopped. Please find below the error message and the corresponding cmake . Maybe I'm missing some libraries ?

Thanks a lot in advance!

Valéry

ps : Dicomifier is really really helpful for converting bruker diffusion data and gradient scheme. How can I cite/reference the tools in publication ?


/home/vozenne/Dev/odil-0.12.1/wrappers/python/Value.cpp: In constructor ‘odil::wrappers::GetSlice::GetSlice(std::size_t, pybind11::slice)’:
/home/vozenne/Dev/odil-0.12.1/wrappers/python/Value.cpp:48:18: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘PySliceObject*’
   48 |         slice.ptr(), size,
      |         ~~~~~~~~~^~
      |                  |
      |                  PyObject* {aka _object*}
In file included from /usr/include/python2.7/Python.h:115,
                 from /usr/include/pybind11/detail/common.h:112,
                 from /usr/include/pybind11/pytypes.h:12,
                 from /usr/include/pybind11/cast.h:13,
                 from /usr/include/pybind11/attr.h:13,
                 from /usr/include/pybind11/pybind11.h:44,
                 from /home/vozenne/Dev/odil-0.12.1/wrappers/python/Value.cpp:11:
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.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
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: date_time exception filesystem log system 
-- Found the following ICU libraries:
--   uc (required)
-- Found ICU: /usr/include (found version "66.1") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Found JsonCpp: /usr/lib/x86_64-linux-gnu/libjsoncpp.so  
-- Trying to find DCMTK expecting DCMTKConfig.cmake
-- Trying to find DCMTK expecting DCMTKConfig.cmake - ok
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0")  
-- Trying to find DCMTK expecting DCMTKConfig.cmake
-- Trying to find DCMTK expecting DCMTKConfig.cmake - ok
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: exception filesystem log unit_test_framework 
-- Trying to find DCMTK expecting DCMTKConfig.cmake
-- Trying to find DCMTK expecting DCMTKConfig.cmake - ok
-- Trying to find DCMTK expecting DCMTKConfig.cmake
-- Trying to find DCMTK expecting DCMTKConfig.cmake - ok
-- Found PythonInterp: /usr/bin/python (found version "2.7.18") 
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- LTO enabled
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vozenne/Dev/odil-0.12.1/build
lamyj commented 3 years ago

Regarding Dicomifier:

Now, to get back to the Odil issue :)

It's probably caused by the fact that CMake is picking up a Python2 interpreter, which is not supported anymore by Odil (nor by Python devs themselves for that matter). You can force the interpreter by passing -DPYTHON_EXECUTABLE=/usr/bin/python3 to CMake (sample build workflows are show in the CI directory).

If you're stuck with Python 2, I can try and fix this, but it won't be a stable solution: since dependencies of Dicomifier (mostly pybind11 and numpy) are also dropping support for Python 2, any fix will stop working at some random point in the future.

valeryozenne commented 3 years ago

Using python 3 for Odil solve the error . And the installation via apt is also convenient. Thanks a lot,