ethz-asl / kalibr

The Kalibr visual-inertial calibration toolbox
Other
4.39k stars 1.41k forks source link

An error related to numpy occurred during compilation with ROS Noetic #423

Closed DreamWaterFound closed 3 years ago

DreamWaterFound commented 3 years ago

Thanks for your excellent work!

I encountered an error while executing the compile command catkin_make:

In file included from /usr/include/x86_64-linux-gnu/bits/types/stack_t.h:23:0,
                 from /usr/include/signal.h:303,
                 from /usr/include/python3.8/numpy/npy_interrupt.h:84,
                 from /usr/include/python3.8/numpy/arrayobject.h:5,
                 from <MyPath>/kalibr_ws/src/kalibr/Schweizer-Messer/numpy_eigen/include/numpy_eigen/NumpyEigenConverter.hpp:20,
                 from <MyPath>/kalibr_ws/src/kalibr/Schweizer-Messer/numpy_eigen/src/autogen_module/numpy_eigen_export_module.cpp:2:
<MyPath>/kalibr_ws/src/kalibr/Schweizer-Messer/numpy_eigen/src/autogen_module/numpy_eigen_export_module.cpp: In function ‘void init_module_libnumpy_eigen()’:
/usr/include/python3.8/numpy/__multiarray_api.h:1541:35: error: return-statement with a value, in function returning 'void' [-fpermissive]
 #define NUMPY_IMPORT_ARRAY_RETVAL NULL
                                   ^
/usr/include/python3.8/numpy/__multiarray_api.h:1546:151: note: in expansion of macro ‘NUMPY_IMPORT_ARRAY_RETVAL’
 #define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NUMPY_IMPORT_ARRAY_RETVAL; } }
                                                                                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~
<MyPath>/kalibr_ws/src/kalibr/Schweizer-Messer/numpy_eigen/src/autogen_module/numpy_eigen_export_module.cpp:256:2: note: in expansion of macro ‘import_array’
  import_array();
  ^
make[2]: *** [kalibr/Schweizer-Messer/numpy_eigen/CMakeFiles/numpy_eigen.dir/build.make:63: kalibr/Schweizer-Messer/numpy_eigen/CMakeFiles/numpy_eigen.dir/src/autogen_module/numpy_eigen_export_module.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1741: kalibr/Schweizer-Messer/numpy_eigen/CMakeFiles/numpy_eigen.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Invoking "make -j1" failed

Extra information about my computer:


In addition I also have the problem mentioned in issue #368 , and solved by this way. I noticed issue #233 which is very similar to my problem, but I disabled anaconda as here but it didn't work for me. As issue #396 discussed I also worry about whether Kalibr will be able to work perfectly in ROS Noetic.

So are there any solutions to this problem? Thank you very much!

yandiyang commented 3 years ago

use _import_array() instead of import_array()

DreamWaterFound commented 3 years ago

use _import_array() instead of import_array()

Thanks for your reply!

I have tried but some new error occurred, which likes PyInt_Check() and PyInt_AsUnsignedLongLongMask() API functions were not supported in python3. In addition some errors related to Eigen as here described still confused me. This means that at present(April 14, 2021) kalibr does not support ROS Noetic.

However I found an alternative version, it works on my computer. If anyone meets the same problem when building kalibr on ROS Noetic and kalibr still no official support for the ROS Noetic, it may save your time and your hair :joy: