I'm attempting to install OpenCV for use with Python. The first install went great; however, I was missing the cv2.so
file. I then added -D BUILD_NEW_PYTHON_SUPPORT=ON
in hopes that it would create the cv2.so
file for me.
Full command:
cmake -D CMAKE_INSTALL_PREFIX=${target} -D CMAKE_FIND_ROOT_PATH=${target} -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_NEW_PYTHON_SUPPORT=ON -D BUILD_SHARED_LIBS=OFF -D CMAKE_SHARED_LINKER_FLAGS="-fPIC" ..
Around 92%, OpenCV fails with the following:
Scanning dependencies of target opencv_python
[ 92%] Building CXX object modules/python/CMakeFiles/opencv_python.dir/src2/cv2.cpp.o
Linking CXX shared library ../../lib/cv2.so
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [lib/cv2.so] Error 1
make[1]: *** [modules/python/CMakeFiles/opencv_python.dir/all] Error 2
make: *** [all] Error 2
ERROR: Build failed, exited 2
Running the default version of Python 2.7.6 that Heroku installs. I've come across a few posts that suggest the need for python-dev
, but it looks like the dev headers are already there (Screenshot).
I'm using a custom buildpack if that's of any help.