Build problem: libz.a(gzlib.o): relocation R_X86_64_32S against `.rodata'...

asked 2016-03-06 15:27:52 -0500

I am trying to cmake the source

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_C_EXAMPLES=OFF \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D BUILD_EXAMPLES=ON ..

and I am getting:

 Linking CXX shared library ../../lib/libopencv_core.so
/usr/bin/ld: /usr/local/lib/libz.a(gzlib.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_core.so.3.1.0] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2

I removed and re-installed zlib but I am still getting this error. Any idea how to proceed?

edit retag flag offensive close merge delete