OpenCV Ubuntu installation Error - opencv

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.

Related

How to fix "undefined reference to symbol 'vxCannyEdgeDetectorNode'" error compiling openvx on yocto

I'm trying to compile the OpenCV version 4.1.0 whith OpenVX enabled on yocto but It is raising an "undefined referece" error. I already try to include the the "lm" library as a dependency, but I think that It is not available to Yocto. I also noticed that the VX/vx.h file was not present on the OpenCV or OpenVX sources. Does someone have some idea of how I can resolve this error?
CMakeFiles/example_openvx_no_wrappers.dir/no_wrappers.cpp.o: undefined reference to symbol 'vxCannyEdgeDetectorNode'
~/imx-yocto-bsp/build/tmp/sysroots/apalis-imx8/usr/lib/libOpenVX.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [bin/example_openvx_no_wrappers] Error 1
make[2]: Leaving directory `~/imx-yocto-bsp/build/tmp/work/aarch64-mx8qm-poky-linux/opencv/4.1.0+gitAUTOINC+371bba8f54_2c32791a9c_32e315a5b1_34e4206aef_fccf7cd6a4-r0/build'
make[1]: ***[samples/openvx/CMakeFiles/example_openvx_no_wrappers.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
In my opencv_4.1.0.bbappend I put the following PACKAGECONFIG:
PACKAGECONFIG[openvx] = " \
-DWITH_OPENVX=ON -DOPENVX_ROOT=${STAGING_LIBDIR} -DOPENVX_LIB_CANDIDATES='OpenVX;OpenVXU', \
-DWITH_OPENVX=OFF, \
virtual/libopenvx, \
\
"

make linking static libc not dynamic

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

Getting compilation error during building OpenCV

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.

caffe installation error linker error lib/libcaffe.dylib Error and src/caffe/CMakeFiles/caffe.dir/all Error

I have been trying to install caffe on my mac OSX 10.9.5.
I have been following the official caffe installation from http://caffe.berkeleyvision.org/installation.html#compilation.
When I am following the cmake installation's "make all" in build folder, I keep on getting the following linking error. I have been trying many possible suggestions that I have found on the web but to no avail.
Any suggestion is appreciated. Thank you in advance.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libcaffe.dylib] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make: *** [all] Error 2
The full error log is at https://github.com/jackywang529/myOpenCV/blob/master/OpenCV/OpenCVTutorial2/errorLog
Thank you
After upgrading from CUDA6.5 to CUDA7.0, the "make all" step completed successfully. I also made sure that I removed the edits that I had made to the formulas, which were necessary when I was using CUDA6.5. Such edits is described in (http://caffe.berkeleyvision.org/install_osx.html under section libstdc++ installation).
Good luck with all caffe users!

Opencv cross compilation error , when tried to enable GTK+ support

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?

Resources