arm-linux-gnueabihf编译器在ubuntu环境下交叉编译opencv2.4.10 排版3(没有跑通例子程序)

http://blog.csdn.net/alpine_climbing/article/details/53086046
arm-linux-gnueabihf编译器在ubuntu环境下交叉编译opencv2.4.10 排版3


2016-11-08 21:42 234人阅读 评论(0) 收藏 举报
分类: opencv(12)   Linux(9)   tools(5)  
版权声明:本文为博主原创文章,未经博主允许不得转载。




Ubuntu14.04_64bit_samba+ssh+terminal_英文版本20161123_1107.7z
这两天因为要在arm板子上跑基于OpenCV的程序,故对opencv2.4.10在ubuntu14.04 64位英文版本环境下用arm-Linux-gnueabihf进行了编译。中间遇到了很多问题,现在把整个经过记录下来,以供大家参考。


opencv版本: opencv2.4.10


http://www.veryarm.com/arm-linux-gnueabihf-gcc
arm-linux-gnueabihf-gcc下载
gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux.tar.xz
xz解压文件方法或命令
xz -d 要解压的文件
同样使用 -k 参数来保留被解压缩的文件。
xz -dk gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux.tar.xz


tar解包:tar xvf FileName.tar
tar xvf gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux.tar


交叉编译器: arm-linux-gnueabihf


环境变量配置: 在当前用户命令下,配置cmake和arm-linux-gnueabihf的环境变量。 


http://www.cmake.org/files/v2.8/cmake-2.8.4-Linux-i386.tar.gz
http://www.cmake.org/files/v2.8/
用vi .bashrc打开用户环境变量脚本,在最后行输入:
export PATH=$PATH:/home/rootroot/wyb/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin
export PATH=/home/rootroot/wyb/cmake-2.8.4-Linux-i386/bin:$PATH




重启之后:
rootroot@rootroot-virtual-machine:~$ arm-linux-gnueabihf-gcc -v
-bash: /home/rootroot/wyb/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/arm-linux-gnueabihf-gcc: No such file or directory
rootroot@rootroot-virtual-machine:~$ 
rootroot@rootroot-virtual-machine:~$ 
rootroot@rootroot-virtual-machine:~$ sudo apt-get update
rootroot@rootroot-virtual-machine:~$ sudo apt-get install lsb-core




参考资料:
https://zhidao.baidu.com/question/286262649.html
用友善提供的4.5.1解压后,运行/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-gcc -v出错
sudo apt-get install lsb-core








编译opencv包括四个部分:


(貌似不需要)
http://www.ijg.org/files/
http://www.ijg.org/files/jpegsrc.v8d.tar.gz
http://www.ijg.org/files/jpegsr9b.zip
1. 编译jpeg库
rootroot@rootroot-virtual-machine:~/wyb$ tar zxvf jpegsrc.v8d.tar.gz


rootroot@rootroot-virtual-machine:~$ sudo apt-get install lsb-core
rootroot@rootroot-virtual-machine:~$ arm-linux-gnueabihf-gcc -v
arm-linux-gnueabihf-gcc: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
rootroot@rootroot-virtual-machine:~$ arm-linux-gnueabihf-g++ -v




http://www.genshuixue.com/i-cxy/p/7644998
ubuntu解决libstdc++.so.6: cannot open shared object file: No such file or directory:问题
来源:博客园 2015-11-01
解决libstdc++.so.6: cannot open shared object file: No such file or directory: 原因在于,在13.10 版本中,ia32_libs 被废弃了导致没有32位的lib库。 解决方法 
sudo apt-get install lib32stdc++6 
sudo apt-get install lib32z1




rootroot@rootroot-virtual-machine:~/wyb/jpeg-8d$ ./configure CC=arm-linux-gnueabihf-gcc --host=arm-linux-gnueabihf --prefix=/home/rootroot/wyb/jpeg-8d/output --enable-shared --enable-static
rootroot@rootroot-virtual-machine:~/wyb/jpeg-8d$ make
rootroot@rootroot-virtual-machine:~/wyb/jpeg-8d$ make install
cd /home/.../jpeg-8d     这里用的是jpeg-8d版本,从官网上下载压缩包,直接解压缩在home路径下,并且进入当前目录。
./configure CC=arm-linux-gnueabihf-gcc --host=arm-linux-gnueabihf --prefix=/home/wangxiaoming/libopencv_arm/libjpeg-8d --enable-shared --enable-static
jpeg库目录下有configure文件,故可以直接用上面的命令进行编译。
说明:  CC=arm-linux-gnueabihf-gcc, 指的是所用的编译器类型,gcc指的是用来编译.C文件; --host=arm-linux-gnueabihf 指的是所用的编译器名称。--prefix指的是编译 
出来 的文件存放的目录。--enable-shared --enable-static, 分别指的是动态编译和静态编译。


最后执行make, make install命令。 








(貌似不需要)
http://www.zlib.net/
http://www.zlib.net/zlib-1.2.10.tar.gz
2. 编译zlib 库


rootroot@rootroot-virtual-machine:~/wyb/zlib-1.2.10$ ./configure --prefix=/home/rootroot/wyb/zlib-1.2.10/output --enable-shared
rootroot@rootroot-virtual-machine:~/wyb/zlib-1.2.10$ make
rootroot@rootroot-virtual-machine:~/wyb/zlib-1.2.10$ make install


在home下解压缩库文件,参照下图修改Makefile文件。注意,在Makefile里要添加上添加编译选项:
CFLAGS+=-fPIC。否则,后期编译opencv时会出现错误:


Linking CXX shared library../../lib/libopencv_core.so
/home/wangxiaoming/linaro-multilib-2014.06-gcc4.9/bin/../lib/gcc/arm-linux-gnueabihf/4.9.1/../../../../arm-linux-gnueabihf/bin/ld:../../3rdparty/lib/libzlib.a(gzlib.c.obj):relocationR_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making ashared object; recompile with -fPIC
../../3rdparty/lib/libzlib.a: error addingsymbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_core.so] Error1
make[1]: ***[modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2




#CC=gcc
CC=arm-linux-gnueabihf-gcc


CFLAGS=-O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
CFLAGS+=-fPIC


#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DZLIB_DEBUG
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
#           -Wstrict-prototypes -Wmissing-prototypes


SFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
LDFLAGS=
TEST_LDFLAGS=-L. libz.a


#LDSHARED=gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map
LDSHARED=arm-linux-gnueabihf-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map


#CPP=gcc -E
CPP=arm-linux-gnueabihf-gcc -E


STATICLIB=libz.a
SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.10
SHAREDLIBM=libz.so.1
LIBS=$(STATICLIB) $(SHAREDLIBV)


#AR=ar
AR=arm-linux-gnueabihf-ar
ARFLAGS=rc


#RANLIB=ranlib
RANLIB=arm-linux-gnueabihf-ranlib


LDCONFIG=ldconfig
LDSHAREDLIBC=-lc
TAR=tar
SHELL=/bin/sh
EXE=


prefix =/home/rootroot/wyb/zlib-1.2.10/output








3. 编译opencv2.4.10时,先用cmake-gui版本进行编译。


rootroot@rootroot-virtual-machine:~/wyb/cmake-2.8.4-Linux-i386/bin$ ./cmake-gui 
./cmake-gui: error while loading shared libraries: libSM.so.6: cannot open shared object file: No such file or directory




http://blog.csdn.net/tabactivity/article/details/42173025
解决error while loading shared libraries: libXxf86vm.so.1:
2014-12-26 16:04 857人阅读 评论(1) 收藏 举报


./jd-gui: error while loading shared libraries: libXxf86vm.so.1: cannot open shared object file: No such file or directory


百度不得其解,搜狗乎,得解!


from: http://www.mjt.me.uk/posts/getting-jd-gui-to-work-on-ubuntu-13.10/
So you’ve just downloaded the latest versionof jd-gui for Linux but itdoesn’t start.




rootroot@rootroot-virtual-machine:~/wyb/cmake-2.8.4-Linux-i386/bin$ sudo apt-get install libgtk2.0-0:i386 libxxf86vm1:i386 libsm6:i386 lib32stdc++6
[sudo] password for rootroot: 
Reading package lists... Done




rootroot@rootroot-virtual-machine:~/wyb$ unzip opencv-2.4.10.zip
rootroot@rootroot-virtual-machine:~/wyb/opencv-2.4.10$ mkdir output
执行./cmake-gui命令:@ubuntu:~/cmake-2.8.4-Linux-i386/bin$ ./cmake-gui  会出现cmake的图形界面。


/home/rootroot/wyb/opencv-2.4.10/
/home/rootroot/wyb/opencv-2.4.10/output/




点击configure, 选择Specify options for cross-compiling选项。接下来继续配置如下,记得用“Linux”,其它的如下配置:
linux
/home/rootroot/wyb/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/arm-linux-gnueabihf-gcc
/home/rootroot/wyb/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/arm-linux-gnueabihf-g++
/home/rootroot/wyb/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/




再下来,选择编译选项。
另外注意更改编译安装路径:CMAKE_INSTALL_PREFIX 的路径 /usr/local  为  /home/rootroot/wyb/opencv-2.4.10/output/ 自定义的路径下。
然后再次点configure,然后点Generate完整配置。








http://opencv.org/downloads.html
https://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.10/opencv-2.4.10.zip/download
https://pilotfiber.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.10/opencv-2.4.10.zip
4. 安装opencv2.4.10


在交叉编译的路径下,即在libopencv目录下,执行make命令 (cmake编译生成的makefile文件在这里)。
在此时,先把编译好的第三方库zlib和jpeg的头文件和库文件复制到 opencv安装的路径下的include和lib文件下,再执行make命令,成功编译后。在执行make install命令,在temp文件夹下生成include,lib和share文件。
可以把../libopencv/include和../libopencv/lib和../libopencv/temp/include和../libopencv/temp/lib文件合在一起。
到此,opencv2.4.10的交叉编译完成了。


  
环境配置:命令vim .bashrc,在文件最后一行输入:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/wng/libopencv_arm/libopencv/lib/pkgconfig
exportPKG_CONFIG_PATH







(注意,这里没有完成)
5. 编译测试
假如已经有一个hello.cpp函数文件了,进入其所在目录,执行下列命令进行编译:
arm-linux-gnueabihf-g++ hello.cpp -o hello  -lpthread -lrt `pkg-config --libs --cflags opencv`
其中arm-linux-gnueabihf-g++是编译用的编译器,hello.cpp是要编译的程序;hello为编译后生成的可执行二进制程序,可以任意命名。  


到此,opencv交叉编译已全部完成。


知识在于分享与交流。若有问题,欢迎大家留言!








[ 27%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_exr.cpp.obj
[ 27%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_tiff.cpp.obj
[ 27%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/bitstrm.cpp.obj
Linking CXX shared library ../../lib/libopencv_highgui.so
/home/rootroot/wyb/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.9.1/../../../../arm-linux-gnueabihf/bin/ld: ../../3rdparty/lib/liblibjpeg.a(jdinput.c.obj): relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
../../3rdparty/lib/liblibjpeg.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2
rootroot@rootroot-virtual-machine:~/wyb/opencv-2.4.10/output$ make
[  2%] Built target zlib
[  5%] Built target libtiff
[  5%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jdmainct.c.obj
[  6%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jcomapi.c.obj
[  6%] Building C object 3rdparty/libjpeg/CMakeFiles/libjpeg.dir/jidctflt.c.obj


http://ask.csdn.net/questions/70191
跪求cmake交叉编译出错原因!!!


opencv c++ cmake
Linking CXX shared library ../../lib/libopencv_core.so
/opt/EmbedSky/4.4.6/lib/gcc/arm-embedsky-linux-gnueabi/4.4.6/../../../../arm-embedsky-linux-gnueabi/bin/ld: ../../3rdparty/lib/libzlib.a(inflate.c.obj): relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
../../3rdparty/lib/libzlib.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [lib/libopencv_core.so] 错误 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] 错误 2
make: *** [all] 错误 2
请问这是什么错误啊?
opencv路径及版本:/usr/local/ Opencv2.4.1
cmake路径及版本:/usr/local/ cmake-2.8.12.2-Linux-i386
用户:root


同问0 |浏览4312| 收藏0 |分享
1个回答
按赞数排序 
dengweiai VVWA   2014.12.26 15:18
进入opencv目录下的3rdparty的对应目录CMakeFiles/ *.dir下,打开flags.make,在C_FLAGS = 后添加-O3 -fPIC用来支持在64位机上编译
如../3rdparty/zlib/CMakeFiles/zlib.dir/flags.make
修改C_FLAGS =  -W -Wall 为 C_FLAGS =  -O3 -fPIC  -W -Wall

修改CXX_FLAGS =  -W -Wall 为 C_FLAGS =  -O3 -fPIC  -W -Wall










../../lib/libopencv_ts.a(ts_gtest.cpp.obj): In function `testing::internal::HasNewFatalFailureHelper::~HasNewFatalFailureHelper()':
ts_gtest.cpp:(.text._ZN7testing8internal24HasNewFatalFailureHelperD0Ev+0x16): undefined reference to `pthread_getspecific'
ts_gtest.cpp:(.text._ZN7testing8internal24HasNewFatalFailureHelperD0Ev+0xa2): undefined reference to `pthread_setspecific'
../../lib/libopencv_ts.a(ts_gtest.cpp.obj): In function `testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::GetOrCreateValue() const':
ts_gtest.cpp:(.text._ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv]+0x8): undefined reference to `pthread_getspecific'
ts_gtest.cpp:(.text._ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv]+0x88): undefined reference to `pthread_setspecific'
../../lib/libopencv_ts.a(ts_gtest.cpp.obj): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::GetOrCreateValue() const':
ts_gtest.cpp:(.text._ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv]+0xa): undefined reference to `pthread_getspecific'
ts_gtest.cpp:(.text._ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv]+0x106): undefined reference to `pthread_setspecific'
../../lib/libopencv_core.so: undefined reference to `pthread_spin_init'
../../lib/libopencv_core.so: undefined reference to `pthread_spin_unlock'
../../lib/libopencv_core.so: undefined reference to `pthread_spin_lock'
../../lib/libopencv_core.so: undefined reference to `pthread_spin_destroy'
../../lib/libopencv_core.so: undefined reference to `pthread_once'
../../lib/libopencv_core.so: undefined reference to `pthread_spin_trylock'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/opencv_perf_core] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_perf_core.dir/all] Error 2
make: *** [all] Error 2
rootroot@rootroot-virtual-machine:~/wyb/opencv-2.4.10/output$ 


http://blog.csdn.net/xy010902100449/article/details/45092757
Opencv-2.4.9 在 mini2440 上的移植
原因是找不到pthread链接库,打开文件夹下的CmakeCache.txt进行修改


//Flags used by the linker.(大概在194行附近)
CMAKE_EXE_LINKER_FLAGS:STRING=-lpthread -lrt  








[ 69%] Building CXX object modules/legacy/CMakeFiles/opencv_legacy.dir/src/bgfg_codebook.cpp.obj
[ 69%] Building CXX object modules/legacy/CMakeFiles/opencv_legacy.dir/src/kdtree.cpp.obj
[ 69%] Building CXX object modules/legacy/CMakeFiles/opencv_legacy.dir/src/blobtrackingmsfgs.cpp.obj
CMake Error at /home/rootroot/wyb/opencv-2.4.10/cmake/cl2cpp.cmake:50 (string):
  string does not recognize sub-command MD5




make[2]: *** [modules/ocl/opencl_kernels.cpp] Error 1
make[1]: *** [modules/ocl/CMakeFiles/opencv_ocl.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 69%] Building CXX object modules/legacy/CMakeFiles/opencv_legacy.dir/src/eigenobjects.cpp.obj




注释掉:
#string(MD5 hash "${lines}")








http://blog.csdn.net/huohuxingxing1987/article/details/19411229
centos6.4 成功安装 opencv2.4.8(参考2.3.1)
参考文献:http://www.cnblogs.com/zlbeidou/p/3209029.html


成功通过编译,显示结果如图。


make
// (2.4.8)error:   /opencv248/opencv-2.4.8/cmake/cl2cpp.cmake:50 (string):   string does not recognize sub-command MD5


改错:删除 cl2cpp.cmake 内的第50 行。重新 make








nking CXX shared library ../../lib/libopencv_videostab.so
[ 93%] Built target opencv_videostab
Scanning dependencies of target opencv_test_nonfree
[ 93%] Building CXX object modules/ocl/CMakeFiles/opencv_perf_ocl.dir/perf/perf_filters.cpp.obj
[ 93%] Building CXX object modules/nonfree/CMakeFiles/opencv_test_nonfree.dir/test/test_surf_ocl.cpp.obj
[ 93%] Building CXX object modules/nonfree/CMakeFiles/opencv_perf_nonfree.dir/perf/perf_main.cpp.obj
Linking CXX executable ../../bin/opencv_perf_nonfree
../../lib/libopencv_ocl.so: undefined reference to `dlopen'
../../lib/libopencv_ocl.so: undefined reference to `dlsym'
[ 94%] Building CXX object modules/ocl/CMakeFiles/opencv_test_ocl.dir/test/test_gemm.cpp.obj
collect2: error: ld returned 1 exit status
make[2]: *** [bin/opencv_perf_nonfree] Error 1
make[1]: *** [modules/nonfree/CMakeFiles/opencv_perf_nonfree.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 94%] Building CXX object modules/ocl/CMakeFiles/opencv_test_ocl.dir/test/test_blend.cpp.obj
[ 94%] Building CXX object modules/nonfree/CMakeFiles/opencv_test_nonfree.dir/test/test_detectors.cpp.obj
[ 94%] Building CXX object modules/ocl/CMakeFiles/opencv_test_ocl.dir/test/test_objdetect.cpp.obj
Linking CXX executable ../../bin/opencv_perf_ocl
../../lib/libopencv_ocl.so: undefined reference to `dlopen'
../../lib/libopencv_ocl.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/opencv_perf_ocl] Error 1
make[1]: *** [modules/ocl/CMakeFiles/opencv_perf_ocl.dir/all] Error 2
[ 94%] Building CXX object modules/ocl/CMakeFiles/opencv_test_ocl.dir/test/test_bgfg.cpp.obj
[ 94%] Building CXX object modules/ocl/CMakeFiles/opencv_test_ocl.dir/test/test_api.cpp.obj
[ 94%] Building CXX object modules/ocl/CMakeFiles/opencv_test_ocl.dir/test/test_imgproc.cpp.obj
[ 94%] Building CXX object modules/ocl/CMakeFiles/opencv_test_ocl.dir/test/test_fft.cpp.obj
[ 94%] Building CXX object modules/ocl/CMakeFiles/opencv_test_ocl.dir/test/test_color.cpp.obj
[ 94%] Building CXX object modules/ocl/CMakeFiles/opencv_test_ocl.dir/test/test_kmeans.cpp.obj
[ 94%] Building CXX object modules/ocl/CMakeFiles/opencv_test_ocl.dir/test/test_optflow.cpp.obj
[ 94%] Building CXX object modules/nonfree/CMakeFiles/opencv_test_nonfree.dir/test/test_gpu.cpp.obj
[ 94%] Building CXX object modules/ocl/CMakeFiles/opencv_test_ocl.dir/test/test_match_template.cpp.obj
[ 94%] Building CXX object modules/ocl/CMakeFiles/opencv_test_ocl.dir/test/test_warp.cpp.obj
[ 94%] Building CXX object modules/nonfree/CMakeFiles/opencv_test_nonfree.dir/test/test_rotation_and_scale_invariance.cpp.obj
[ 94%] Building CXX object modules/nonfree/CMakeFiles/opencv_test_nonfree.dir/test/test_keypoints.cpp.obj
[ 95%] Building CXX object modules/nonfree/CMakeFiles/opencv_test_nonfree.dir/test/test_features2d.cpp.obj
[ 96%] Building CXX object modules/ocl/CMakeFiles/opencv_test_ocl.dir/test/test_sort.cpp.obj
[ 96%] Building CXX object modules/nonfree/CMakeFiles/opencv_test_nonfree.dir/test/test_main.cpp.obj
Linking CXX executable ../../bin/opencv_test_nonfree
../../lib/libopencv_ocl.so: undefined reference to `dlopen'
../../lib/libopencv_ocl.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/opencv_test_nonfree] Error 1
make[1]: *** [modules/nonfree/CMakeFiles/opencv_test_nonfree.dir/all] Error 2
Linking CXX executable ../../bin/opencv_test_ocl
../../lib/libopencv_ocl.so: undefined reference to `dlopen'
../../lib/libopencv_ocl.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/opencv_test_ocl] Error 1
make[1]: *** [modules/ocl/CMakeFiles/opencv_test_ocl.dir/all] Error 2
make: *** [all] Error 2
rootroot@rootroot-virtual-machine:~/wyb/opencv-2.4.10/output$ 








请严重注意:如果连接加 -ldl,不能解决问题!
http://blog.csdn.net/xy010902100449/article/details/45092757
Opencv-2.4.9 在 mini2440 上的移植
(2)  opencv编译OPENEXR时要用到libImath.so,


在配置界面要把build_opencvxr和with_opencvxr去掉,否则会出现这个问题。


/usr/lib/libImath.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so] 错误 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] 错误 2 make: *** [all] 错误 2
还要去掉build_opencv_ocl和with_opencl,否则会出下面的错误
../../lib/libopencv_ocl.so:undefined reference to 'dlopen'
还要去掉tiff库的编译





阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页