I am trying to build an open source library (openCV in this case) from source using cmake and make. However, I run into a linking error
Linking CXX shared library ../../lib/libopencv_videoio.so
/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/libopencv_videoio.so.3.0.0] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2
From what I gather, this means make is using the static version of glibc libc.a instead of the dynamic lib.so.6. I'm assuming I need to change a path somewhere in cmake but I'm unsure of where to look. Any help is appreciated.
edit: I'm doing this on a 64 bit linux mint machine
Related
I am trying to build opencv with opencv_contributions, but I can`t figure out this error at building.
I made cmake like this :
cmake -DOPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-master/modules/ ~/opencv-3.2.0/
And at the end of building i got this error:
[100%] Linking CXX executable ../../bin/opencv_perf_stitching
[100%] Built target opencv_perf_stitching
[100%] Linking CXX shared module ../../lib/cv2.so
/usr/bin/ld: CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o: relocation R_X86_64_PC32 against undefined symbol `_Z13pyopencv_fromIN2cv4MatxIdLi4ELi4EEEEP7_objectRKT_' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
modules/python2/CMakeFiles/opencv_python2.dir/build.make:393: recipe for target 'lib/cv2.so' failed
make[2]: *** [lib/cv2.so] Error 1
CMakeFiles/Makefile2:14221: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
I am using Xubuntu 14.04 and trying to install the latest version of OpenCV, which is 3.0.0 rc1. Briefly, this is the error message I get:
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_videoio.so.3.0.0] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2
This error message was raised at 41% of the installation, when linking CXX shared library. Before trying to install openCV, first I configured by using cmake without flags. It said that openCV was ready to be installed. I don't know how to solve this problem and I am new to install packages from source. Any help would be appreciated.
I'm Trying to install OpenCV on Ubuntu 14.10 but i'm facing this error again and again :(
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:654: recipe for target 'lib/libopencv_highgui.so.2.4.9' failed
make[2]: *** [lib/libopencv_highgui.so.2.4.9] Error 1
CMakeFiles/Makefile2:1767: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all' failed
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
Makefile:133: recipe for target 'all' failed
make: *** [all] Error 2
Please provide the command history before you have encountered the error.
If calling make was the last thing before the error occured, you can try to call make CFLAGS="-fPIC" instead.
Late to the party, but the issue is that FFMPEG is not compiled with position-independent code. Go to your FFMPEG directory and do
./configure --enable-nonfree --enable-pic --enable-shared
then redo the make, make install steps, and re-do the build of opencv.
I'm getting
linking shared-object rubyeventmachine.so
/usr/bin/ld: /usr/local/lib/libcrypto.a(bio_lib.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libcrypto.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [rubyeventmachine.so] Error 1
make failed, exit code 2
When executting a
bundle install
On CentOS release 6.4
How can I fix it using openssl istalled using yum install?
Package instaled
openssl-1.0.1e-30.el6_6.4.x86_64
and
openssl-devel-1.0.1e-30.el6_6.4.x86_64
I am trying to cross compile Opencv for ARM.By using cmake.
I could successfully compile the opencv libraries without enabling the GTK+ support, but when i tried it to enable the GTK+ support (by adding the command -DWITH_GTK=ON ).
Then i am encountered with an error
I am using Ubuntu 14.04, and Opencv version 2.4.9.
I have already installed the GTK library
The cmake command that i used is :
cmake -DSOFTFP=ON -DENABLE_NEON=ON -DWITH_GTK=ON -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake ../../..
Linking CXX shared library ../../lib/libopencv_highgui.so
/opt/armv7/codesourcery/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../..
/arm-none-linux-gnueabi/bin/ld: cannot find -lgtk-x11-2.0
collect2: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so.2.4.9] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2
how to fix this problem?