交叉编译opencv

http://www.opencv.org.cn/forum/viewtopic.php?t=9757

交叉编译opencv,解决不了这个错误,请大家帮忙!

beckham009 » 2010-04-02 17:08

我使用的编译工具是arm-none-linux-gnueabi-g++
想用opencv写个程序,放到devkit8000(omap3530芯片)开发板上。

在configure指令用的是下面这些
代码: 全选
./configure --host=arm-none-linux-gnueabi --without-gtk --without-carbon  --without-quicktime --without-1394libs --without-ffmpeg --without-python
--without-swig --enable-static --disable-shared --disable-apps
CXX= arm-none-linux-gnueabi -g++
CPPFLAGS=-I/usr/include
--prefix=/opt/opencv-arm6

成功。
Make成功。
Makeinstall成功。

之后进行交叉编译我自己写的程序diejia2.cpp
代码: 全选
arm-none-linux-gnueabi-g++ diejia2.cpp -o diejia2 -I/opt/opencv-arm6/include/opencv -L/opt/opencv-arm6/lib
-lcv -lcvaux -lcxcore -lhighgui -lml

出错,信息如下
代码: 全选
davinci@davinci-desktop:~/diejia$ arm-none-linux-gnueabi-g++ diejia2.cpp -o diejia2 -I/opt/opencv-arm6/include/opencv -L/opt/opencv-arm6/lib -lcv -lcvaux -lcxcore -lhighgui -lml
/opt/opencv-arm6/lib/libhighgui.a(loadsave.o): In function `__static_initialization_and_destruction_0(int, int)':
loadsave.cpp:(.text+0x1b0): undefined reference to `cvSetImageIOFunctions'
/opt/opencv-arm6/lib/libhighgui.a(loadsave.o): In function `icvLoadImage(char const*, int, bool)':
loadsave.cpp:(.text+0x34c): undefined reference to `cvError'
loadsave.cpp:(.text+0x350): undefined reference to `cvGetErrStatus'
loadsave.cpp:(.text+0x37c): undefined reference to `cvReleaseMat'
loadsave.cpp:(.text+0x438): undefined reference to `cvCreateImage'
loadsave.cpp:(.text+0x440): undefined reference to `cvGetErrStatus'
loadsave.cpp:(.text+0x45c): undefined reference to `cvGetMat'
loadsave.cpp:(.text+0x498): undefined reference to `cvReleaseMat'
loadsave.cpp:(.text+0x4b4): undefined reference to `cvReleaseImage'
loadsave.cpp:(.text+0x4e0): undefined reference to `cvCreateMat'
loadsave.cpp:(.text+0x4e8): undefined reference to `cvGetErrStatus'
loadsave.cpp:(.text+0x50c): undefined reference to `cvError'
loadsave.cpp:(.text+0x558): undefined reference to `cvReleaseImage'
loadsave.cpp:(.text+0x588): undefined reference to `cvError'
/opt/opencv-arm6/lib/libhighgui.a(loadsave.o): In function `cvSaveImage':
loadsave.cpp:(.text+0x600): undefined reference to `cvError'
loadsave.cpp:(.text+0x608): undefined reference to `cvReleaseMat'
loadsave.cpp:(.text+0x610): undefined reference to `cvReleaseMat'
loadsave.cpp:(.text+0x614): undefined reference to `cvGetErrStatus'
loadsave.cpp:(.text+0x634): undefined reference to `cvGetMat'
loadsave.cpp:(.text+0x63c): undefined reference to `cvGetErrStatus'
loadsave.cpp:(.text+0x69c): undefined reference to `cvError'
loadsave.cpp:(.text+0x74c): undefined reference to `cvCreateMat'
loadsave.cpp:(.text+0x754): undefined reference to `cvGetErrStatus'
loadsave.cpp:(.text+0x770): undefined reference to `cvGetErrStatus'
loadsave.cpp:(.text+0x7e4): undefined reference to `cvError'
loadsave.cpp:(.text+0x7f8): undefined reference to `cvCreateMat'
loadsave.cpp:(.text+0x800): undefined reference to `cvGetErrStatus'
loadsave.cpp:(.text+0x818): undefined reference to `cvFlip'
loadsave.cpp:(.text+0x81c): undefined reference to `cvGetErrStatus'
loadsave.cpp:(.text+0x844): undefined reference to `cvError'
loadsave.cpp:(.text+0x864): undefined reference to `cvError'
loadsave.cpp:(.text+0x884): undefined reference to `cvError'
loadsave.cpp:(.text+0x8a4): undefined reference to `cvError'
loadsave.cpp:(.text+0x8c4): undefined reference to `cvError'
/opt/opencv-arm6/lib/libhighgui.a(loadsave.o):loadsave.cpp:(.text+0x8e4): more undefined references to `cvError' follow
/opt/opencv-arm6/lib/libhighgui.a(utils.o): In function `cvConvertImage':
utils.cpp:(.text+0x10e4): undefined reference to `cvGetMat'
utils.cpp:(.text+0x10ec): undefined reference to `cvGetErrStatus'
utils.cpp:(.text+0x1108): undefined reference to `cvGetMat'
utils.cpp:(.text+0x1110): undefined reference to `cvGetErrStatus'
utils.cpp:(.text+0x1158): undefined reference to `cvError'
utils.cpp:(.text+0x1290): undefined reference to `cvError'
utils.cpp:(.text+0x1298): undefined reference to `cvReleaseMat'
utils.cpp:(.text+0x12bc): undefined reference to `cvError'
utils.cpp:(.text+0x12d0): undefined reference to `cvCreateMat'
utils.cpp:(.text+0x1324): undefined reference to `cvConvertScale'
utils.cpp:(.text+0x135c): undefined reference to `cvError'
utils.cpp:(.text+0x137c): undefined reference to `cvError'
utils.cpp:(.text+0x139c): undefined reference to `cvError'
utils.cpp:(.text+0x17fc): undefined reference to `cvCopy'
utils.cpp:(.text+0x1800): undefined reference to `cvGetErrStatus'
utils.cpp:(.text+0x1824): undefined reference to `cvError'
utils.cpp:(.text+0x1840): undefined reference to `cvFlip'
utils.cpp:(.text+0x1844): undefined reference to `cvGetErrStatus'
utils.cpp:(.text+0x1868): undefined reference to `cvError'
collect2: ld returned 1 exit status


好像是highgui交叉编译出问题。

把diejia2.cpp注释掉里面的
代码: 全选
//ima=cvloadimage(“1.bmp”)

代码之后,没错了。生成了可执行文件。
但是没有cvloadimage怎么读取图像??肯定要有的。

在网上看到好多人说,交叉编译时gtk和highgui是会出问题的,我想只有两条路可以解决问题
1 想办法把highgui交叉编译通过,不知道大家有没有做成的,指教一下
2 不用highgui,有没有其他读图片的方法,初学望指教
beckham009
OpenCV幼儿园宝宝
 
帖子: 3
注册: 2010-04-02 15:20
页首

Re: 交叉编译opencv,解决不了这个错误,请大家帮忙!

zouyiran » 2010-04-22 23:06

你离成功不远了~~~highgui的确有问题~~所以自己写采集接口吧~~·
至于loadimage~~~我给你三种方法吧~~
1)iplImage = cvCreateImageHeader(cvSize(width,heigth),IPL_DEPTH_8U,1);-
cvSetData(iplImage,pGrayBuffer,width*1); //第3个参数是行字节数
cvReleaseImageheader(&iplImage);
free(pGrayBuffer); //pGrayBuffer是程序里用来放灰度数据的空间,由calloc分配


(2)iplImage = cvCreateImage(cvSize(width,heigth),IPL_DEPTH_8U,1);
iplImage->imageData=pGrayBuffer;
iplImage->imageDataOrigin=pGrayBuffer;
cvReleaseImageheader(&iplImage);
free(pGrayBuffer);


(3) iplImage = cvCreateImage(cvSize(width,heigth),IPL_DEPTH_8U,1);
memcpy(iplImage->imageData,pGrayBuffer,iplImage->imageSize);
cvReleaseImage(&iplImage);
free(pGrayBuffer);
zouyiran
OpenCV小学生
 
帖子: 8
注册: 2010-01-01 3:38
页首

Re: 交叉编译opencv,解决不了这个错误,请大家帮忙!

beckham009 » 2010-04-26 10:28

感谢楼上,非常感谢!!!
beckham009
OpenCV幼儿园宝宝
 
帖子: 3
注册: 2010-04-02 15:20
页首

Re: 交叉编译opencv,解决不了这个错误,请大家帮忙!

catch » 2010-08-16 13:36

现在我也碰到这个问题,
看过后,受益匪浅,
谢谢啦!!


你可能感兴趣的:(c,function,reference,initialization,2010,gtk)