kornerc / brisk

Binary Robust Invariant Scalable Keypoints
Other
31 stars 14 forks source link

"error: return-statement with a value, in function returning 'void' [-fpermissive]" in conversion.cpp #3

Open dchang0 opened 8 years ago

dchang0 commented 8 years ago

Here's the error (ignore the NumPy 1.7 deprecated warning before it):

[ 92%] Building CXX object thirdparty/opencv-ndarray-conversion/CMakeFiles/conversion.dir/conversion.cpp.o
In file included from /usr/include/numpy/ndarraytypes.h:1761:0,
                 from /usr/include/numpy/ndarrayobject.h:17,
                 from /home/sysadmin/Downloads/brisk/thirdparty/opencv-ndarray-conversion/conversion.h:8,
                 from /home/sysadmin/Downloads/brisk/thirdparty/opencv-ndarray-conversion/conversion.cpp:1:
/usr/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it by " \
  ^
In file included from /usr/include/sched.h:28:0,
                 from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/4.9/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/4.9/bits/gthr.h:148,
                 from /usr/include/c++/4.9/ext/atomicity.h:35,
                 from /usr/include/c++/4.9/bits/ios_base.h:39,
                 from /usr/include/c++/4.9/ios:42,
                 from /usr/include/c++/4.9/istream:38,
                 from /usr/include/c++/4.9/sstream:38,
                 from /usr/include/c++/4.9/complex:45,
                 from /usr/local/include/opencv2/core/core.hpp:56,
                 from /usr/local/include/opencv2/imgproc/imgproc.hpp:46,
                 from /home/sysadmin/Downloads/brisk/thirdparty/opencv-ndarray-conversion/conversion.h:5,
                 from /home/sysadmin/Downloads/brisk/thirdparty/opencv-ndarray-conversion/conversion.cpp:1:
/home/sysadmin/Downloads/brisk/thirdparty/opencv-ndarray-conversion/conversion.cpp: In function ‘void init()’:
/home/sysadmin/Downloads/brisk/thirdparty/opencv-ndarray-conversion/conversion.cpp:9:5: error: return-statement with a value, in function returning 'void' [-fpermissive]
     import_array();
     ^
/home/sysadmin/Downloads/brisk/thirdparty/opencv-ndarray-conversion/conversion.cpp: In member function ‘void NDArrayConverter::init()’:
/home/sysadmin/Downloads/brisk/thirdparty/opencv-ndarray-conversion/conversion.cpp:125:5: error: return-statement with a value, in function returning 'void' [-fpermissive]
     import_array();
     ^
thirdparty/opencv-ndarray-conversion/CMakeFiles/conversion.dir/build.make:54: recipe for target 'thirdparty/opencv-ndarray-conversion/CMakeFiles/conversion.dir/conversion.cpp.o' failed
make[2]: *** [thirdparty/opencv-ndarray-conversion/CMakeFiles/conversion.dir/conversion.cpp.o] Error 1
CMakeFiles/Makefile2:233: recipe for target 'thirdparty/opencv-ndarray-conversion/CMakeFiles/conversion.dir/all' failed
make[1]: *** [thirdparty/opencv-ndarray-conversion/CMakeFiles/conversion.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2

I am running Debian 8.5 with OpenCV 3.1.0 (built from GitHub) AND OpenCV 2.4.13 (also built from GitHub) on the same system, with python-numpy 1.8.2-2 (from Debian jessie APT repo). The NumPy warning probably could be handled by downgrading to NumPy 1.7, but I don't have any idea what is causing the error in conversion.cpp.

bucketzxm commented 8 years ago

hi, I happen to have this problem, too. And I found it may be caused by import_array function that return int instead void in the new version of numpy.

so may be you can use this way to change the import function #if PY_VERSION >= 3 int init_numpy() { import_array(); } #else void init_numpy() { import_array(); } #endif

I hope this can help you @dchang0

da-steve101 commented 7 years ago

I was getting this issue when cmake tried to use python3 instead of 2.7 I change line 38 of CMakeLists.txt from:

find_package(PythonLibs REQUIRED)

to

find_package(PythonLibs 2.7 REQUIRED)

After cleaning build it used 2.7 and compiled fine :)

dchang0 commented 7 years ago

Thanks for the help, both of you. I ended up switching from Debian to Ubuntu 14.04 and Mac OS X Sierra, on which these problems did not occur. Not sure why, but the builds went well. That said, if I get a chance, I'll try your tips and confirm that they work on Debian 8.x here. Thanks again!

johannathiemich commented 6 years ago

@bucketzxm How do you mean that? In which file and line will I have to edit those lines? Any help would be greatly appreciated!