Ask Your Question

Linking problems while building 3.0.0 on 64 bit linux

asked 2015-04-23 14:00:16 -0600

For some reason my linker keeps trying to link against the static version of libc instead of the dynamic version when building from source. I also tried setting the cmake flag BUILD_SHARED_LIBRARIES to OFF but this led to other problems. Full error below.

Linking CXX shared library ../../lib/ /usr/bin/ld: /usr/local/lib/libc.a(lib_a-mallocr.o): relocation R_X86_64_32S against `__malloc_av_' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libc.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status make[2]: * [lib/] Error 1 make[1]: [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2 make: ** [all] Error 2

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-04-30 18:10:05 -0600

For some reason I installed my own static C libraries in /usr/local. OpenCV assumes if you put C libraries there you did it on purpose and uses them instead of the ones installed at /lib. Removing the ones in /usr/local solved the problem.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-04-23 14:00:16 -0600

Seen: 260 times

Last updated: Apr 30 '15