Algomorph/pyboostcvconverter

NumPy

Closed this issue · 2 comments

I have a problem related to NumPy that I get when I compile the code:

root@ares:/home/# make -j20
make: Warning: File 'Makefile' has modification time 4602 s in the future
make[1]: Warning: File 'CMakeFiles/Makefile2' has modification time 4602 s in the future
make[2]: Warning: File 'CMakeFiles/pbcvt.dir/flags.make' has modification time 4602 s in the future
Scanning dependencies of target pbcvt
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
make[2]: Warning: File 'CMakeFiles/pbcvt.dir/flags.make' has modification time 4602 s in the future
[ 60%] Building CXX object CMakeFiles/pbcvt.dir/src/pyboost_cv2_converter.cpp.o
[ 80%] Building CXX object CMakeFiles/pbcvt.dir/src/pyboost_cv3_converter.cpp.o
[ 80%] Building CXX object CMakeFiles/pbcvt.dir/src/pyboost_cv4_converter.cpp.o
[ 80%] Building CXX object CMakeFiles/pbcvt.dir/src/python_module.cpp.o
/media/v-sense-nas/04_Projects/2020-04-13_ColorMismatchCorrection/DudekTransformation/pyboostcvconverter/src/python_module.cpp: In function 'void* pbcvt::init_ar()':
/media/v-sense-nas/04_Projects/2020-04-13_ColorMismatchCorrection/DudekTransformation/pyboostcvconverter/src/python_module.cpp:212:16: error: 'NUMPY_IMPORT_ARRAY_RETVAL' was not declared in this scope
         return NUMPY_IMPORT_ARRAY_RETVAL;
                ^~~~~~~~~~~~~~~~~~~~~~~~~
CMakeFiles/pbcvt.dir/build.make:134: recipe for target 'CMakeFiles/pbcvt.dir/src/python_module.cpp.o' failed
make[2]: *** [CMakeFiles/pbcvt.dir/src/python_module.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pbcvt.dir/all' failed
make[1]: *** [CMakeFiles/pbcvt.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

NumPy is installed on my machine:

root@ares:/home/#python -m pip install numpy
Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (1.19.5)

The problem is the macro NUMPY_IMPORT_ARRAY_RETVAL that is not defined. Apparently, this macro is defined as NULL for python version >=3, and nothing otherwise. Strangely, even if I have Python 3.6 installed in Ubuntu, this macro is not defined. For the moment, I have replaced NUMPY_IMPORT_ARRAY_RETVAL with NULL in python_module.cpp.

Thank you, fix committed!