Closed ThaiseRF closed 5 years ago
You seem to be using GCC 4.9 as the C++ compiler. This version of GCC did not yet fully support C++14, in particular the relaxed requirements for constexpr
functions, which is what the error message complains about.
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 4.9.3
But it looks like you do have GCC 5.4 installed. I'm not sure why an older version comes up as the C++ compiler. One thing you could try is find the correct command to invoke the C++ compiler for GCC 5.4, maybe it is something like g++-5
, then do:
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=g++-5
This will tell CMake to use g++-5
as the C++ compiler.
Please let me know if you manage to fix this! Your experience here might be useful to others running into the same issue. Thanks!
Thanks! It was the GCC indeed.
So, the files created in /usr/local/lib are
PyDIP_bin.cpython-35m-x86_64-linux-gnu.so PyDIPviewer.cpython-35m-x86_64-linux-gnu.so PyDIP_py.py plus the init.py file.
I'm not being able to import the library. It does not find the module.
$ python3 Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information.
import PyDIP Traceback (most recent call last): File "
", line 1, in ImportError: No module named 'PyDIP'
I've tried to use ctypes, also export the LD_LIBRARY_PATH where the .so file is. It didn't worked. Maybe I'm missing something. Probably.
Thank you!
I expect you to have libDIP.so
and libDIPviewer.so
in /usr/local/lib/
, and the Python bindings you mention (*.cpython-35m-*.so
, PyDIP_py.py
and __init__.py
) in /usr/local/lib/PyDIP/
.
This is not a normal place for Python libraries -- This is something that still needs to be ironed out in our build scripts. Sorry for things still being a bit rough with the Python bindings...
With the current installation location, you can do either one of these:
Start Python with
PYTHONPATH=$PYTHONPATH:/usr/local/lib/ python3
Start Python normally then:
import sys
sys.path.append('/usr/local/lib')
import PyDIP as dip
NOTE that the above is no longer necessary, by default PyDIP will be installed in a place where Python will find it.
It seems that what you expected is correct. libDIP.so and libDIPviewer.so are in /usr/local/lib/, and the Python bindings are in /usr/local/lib/PyDIP/
But Python doesn't seem to be able to reach them. The weird part is that your suggestion worked. It imported PyDIP after setting '/usr/local/lib' but it does not work when I add the PyDIP folder in the path.
Yes, in Python, import package_name
will look for a sub-directory package_name
under any of the directories in sys.path
. So you need to include the directory that contains the PyDIP
directory to the path, not the PyDIP
directory itself.
Some day we'll figure out the correct way to install a Python package, and then you won't need to modify the path any more. :)
Hi! I'm having trouble building the library. The error is:
/home/farol/target/diplib/include/diplib/library/types.h:259:78: error: body of constexpr function ‘constexpr dip::bin& dip::bin::operator^=(dip::bin) const’ not a return-statement constexpr bin& operator^=( bin other ) { v ^= other.v; return *this; } ^ src/CMakeFiles/DIP.dir/build.make:62: recipe for target 'src/CMakeFiles/DIP.dir/support/matrix.cpp.o' failed make[3]: [src/CMakeFiles/DIP.dir/support/matrix.cpp.o] Error 1 CMakeFiles/Makefile2:186: recipe for target 'src/CMakeFiles/DIP.dir/all' failed make[2]: [src/CMakeFiles/DIP.dir/all] Error 2 CMakeFiles/Makefile2:97: recipe for target 'src/CMakeFiles/check.dir/rule' failed make[1]: [src/CMakeFiles/check.dir/rule] Error 2 Makefile:184: recipe for target 'check' failed make: [check] Error 2
The cmake output:
$ cmake -DCMAKE_BUILD_TYPE=Debug -- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 4.9.3 -- 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 -- PROJECT_VERSION = 3.0.alpha -- Try OpenMP C flag = [-fopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Success -- Try OpenMP CXX flag = [-fopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Success -- Found OpenMP: -fopenmp
-- Performing Test HAS_PRETTY_FUNCTION -- Performing Test HAS_PRETTY_FUNCTION - Success -- Performing Test HAS_128_INT -- Performing Test HAS_128_INT - Success -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") -- Looking for strtok_r -- Looking for strtok_r - found -- Found TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (found version "4.0.6") -- Found FFTW3: /usr/local/include
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Found FreeGLUT: /usr/lib/x86_64-linux-gnu/libglut.so
-- FreeGLUT found: /usr/lib/x86_64-linux-gnu/libglut.so -- /usr/include -- Could NOT find GLFW (missing: GLFW_LIBRARY GLFW_INCLUDE_DIR) -- GLFW not found -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE
-- Found PythonInterp: /usr/bin/python3.5 (found version "3.5.2") -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.5m.so -- pybind11 v2.2.4 -- Performing Test HAS_FLTO -- Performing Test HAS_FLTO - Success -- LTO enabled -- Could NOT find Matlab (missing: Matlab_INCLUDE_DIRS Matlab_MEX_LIBRARY Matlab_MEX_EXTENSION Matlab_ROOT_DIR) -- Found OpenCV: /home/farol/OpenCV/build (found version "3.4.2") found components: core imgproc highgui
DIPlib CONFIGURATION REPORT
Next, type 'make; make check; make install'
-- Configuring done -- Generating done -- Build files have been written to: /home/farol/target/diplib
I'm don't have experience in this. So I don't really know what I'm doing wrong.