• «
  • 1
  • 2
  • »
  • Pages: 1/2     Go
主题 : 移植opencv到tiny6410 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 47559
精华: 1
发帖: 20
金钱: 150 两
威望: 30 点
贡献值: 1 点
综合积分: 60 分
注册时间: 2011-05-23
最后登录: 2014-12-10
楼主  发表于: 2011-09-16 09:32

 移植opencv到tiny6410

管理提醒: 本帖被 xoom 执行加亮操作(2011-09-16)
软件环境:Oracle VM Virtualbox
                    Fedora 9
硬件环境:tiny6410

1.    下载opencv 1.0
http://www.opencv.org.cn/index.php/Download#Version_1.0
2.    编译
$tar zxvf opencv-1.0.0.tar.gz.gz
$cd opencv-1.0.0
$./configure    --prefix=/work/code/opencv/ --host=arm-linux --without-carbon --without-quicktime --without-1394libs --without-ffmpeg --without-python --without-swig --without-gtk --enable-static --enable-shared --disable-apps
$make
$make install
3.    安装与使用
在/work/code/opencv/目录下得到 /include /lib /share 的库文件,copy到板子中即可。
在pc上用opencv编译应用程序
export PKG_CONFIG_PATH=/work/code/opencv/lib/pkgconfig
arm-linux-g++ opencv.c -o opencv_arm `pkg-config --cflags --libs opencv`

出现的问题:

when running "make" after "./configure",
>  getting the following error during make:

>
> In file included from _cxcore.h:60,
>                  from cxalloc.cpp:42:
> ../../cxcore/include/cxmisc.h:133:6: error : #elif with no expression

原因分析:
GCC 4.4 will introduce better checks in the preprocessor. The problem
is pretty obvious: you're using a #elif without any condition when
you really want a #else.

You can reproduce this problem with gcc-snapshot from unstable.

> Automatic build of opencv_1.0.0-6.1 on em64t by sbuild/amd64 0.53
...
> /bin/sh ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../.. -I. -I../../cxcore/include -I../.. -DNDEBUG -fno-strict-aliasing -Wall -g -fopenmp -O2 -g -MT cxalloc.lo -MD -MP -MF .deps/cxalloc.Tpo -c -o cxalloc.lo cxalloc.cpp
> g++ -DHAVE_CONFIG_H -I. -I../.. -I. -I../../cxcore/include -I../.. -DNDEBUG -fno-strict-aliasing -Wall -g -fopenmp -O2 -g -MT cxalloc.lo -MD -MP -MF .deps/cxalloc.Tpo -c cxalloc.cpp -fPIC -DPIC -o .libs/cxalloc.o
> In file included from _cxcore.h:60,
> from cxalloc.cpp:42:
> ../../cxcore/include/cxmisc.h:133:6: error: #elif with no expression
> make[4]: *** [cxalloc.lo] Error 1
> make[4]: Leaving directory `/build/tbm/opencv-1.0.0/cxcore/src'
> make[3]: *** [all-recursive] Error 1

解决办法:

--- cxcore/include/cxmisc.h~ 2008-11-07 15:12:58.000000000 +0000  (删除)
+++ cxcore/include/cxmisc.h 2008-11-07 15:13:03.000000000 +0000    (打开)
@@ -130,7 +130,7 @@
#include <alloca.h>
#elif defined HAVE_ALLOCA
#include <stdlib.h>
-#elif
+#else
#error
#endif
把 #elif 改为 #else后编译成功!!!
级别: 侠客
UID: 47357
精华: 0
发帖: 76
金钱: 390 两
威望: 78 点
贡献值: 0 点
综合积分: 152 分
注册时间: 2011-05-21
最后登录: 2017-09-13
1楼  发表于: 2011-09-16 12:03

 回 楼主(lonely2010) 的帖子

谢谢分享
级别: 侠客
UID: 34127
精华: 0
发帖: 60
金钱: 315 两
威望: 63 点
贡献值: 0 点
综合积分: 120 分
注册时间: 2010-12-11
最后登录: 2012-08-07
2楼  发表于: 2011-09-17 10:47
你编译程序放板子上跑过吗,移植highgui了吗?
级别: 新手上路
UID: 47559
精华: 1
发帖: 20
金钱: 150 两
威望: 30 点
贡献值: 1 点
综合积分: 60 分
注册时间: 2011-05-23
最后登录: 2014-12-10
3楼  发表于: 2011-09-19 11:14

 回 2楼(liujian4210) 的帖子

跑过了
疯狂的嵌入式爱好者
级别: 论坛版主
UID: 40543
精华: 1
发帖: 169
金钱: 920 两
威望: 184 点
贡献值: 1 点
综合积分: 358 分
注册时间: 2011-03-19
最后登录: 2013-05-10
4楼  发表于: 2011-09-20 00:45
这个移植版本太低太没意义了。
别人转角遇见爱,我转角遇见猫T _T .
级别: 新手上路
UID: 49363
精华: 0
发帖: 23
金钱: 115 两
威望: 23 点
贡献值: 0 点
综合积分: 46 分
注册时间: 2011-06-10
最后登录: 2012-10-08
5楼  发表于: 2011-09-28 15:58
我用的是fedora9的系统,开发板是友善的tiny6410,在虚拟机上装了opencv2.0.0,并将opencv和qt4.7移植到ARM板子上了。
我在虚拟机上编译程序drawing程序出错:[root@localhost c]# g++ drawing.c -o drawing -L"/usr/local/lib/" -I"/usr/local/include/opencv/" -lcxcore -lcv -lml -lhighgui -lcvaux
错误如下:/usr/bin/ld: skipping incompatible /usr/local/lib//libcxcore.so when searching for -lcxcore
/usr/bin/ld: skipping incompatible /usr/local/lib//libcxcore.a when searching for -lcxcore
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i386-redhat-linux/4.3.0/../../../libcxcore.so when searching for -lcxcore
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i386-redhat-linux/4.3.0/../../../libcxcore.a when searching for -lcxcore
/usr/bin/ld: skipping incompatible /usr/local/lib/libcxcore.so when searching for -lcxcore
/usr/bin/ld: skipping incompatible /usr/local/lib/libcxcore.a when searching for -lcxcore
/usr/bin/ld: skipping incompatible /usr/lib/libcxcore.so when searching for -lcxcore
/usr/bin/ld: skipping incompatible /usr/lib/libcxcore.a when searching for -lcxcore
当然在PC上就不能运行了

但是:[root@localhost c]# arm-linux-g++ drawing.c -o drawing -L"/usr/local/lib/" -I"/usr/local/include/opencv/" -lcxcore -lcv -lml -lhighgui -lcvaux
编译能通过,下载到板子上提示缺少GTK。。。。我知道移植GTK到ARM上很难,于是用qt来解决,我在虚拟机上装了qt creator,并将qt4.7交叉编译后移植到板子里了,在qt creator里写好了camshift的程序,编译时出现唯一的错误,如下所示:
/usr/local/lib/libcv.so:: error: could not read symbols: File in wrong format
:: error: collect2: ld returned 1 exit status

请教个位达人了,就我的以上两出错误究竟如何解决,谢谢了,我的QQ:465035933
疯狂的嵌入式爱好者
级别: 论坛版主
UID: 40543
精华: 1
发帖: 169
金钱: 920 两
威望: 184 点
贡献值: 1 点
综合积分: 358 分
注册时间: 2011-03-19
最后登录: 2013-05-10
6楼  发表于: 2011-09-30 12:04
/usr/local/lib/libcv.so,不知道你看到这个东西没有,它实际链接了你主机上的库文件,这个文件不是交叉编译器变异的,i386的当然不能链接了。gtk移植还不是特别难,如果你想省点力气,可以试试我们的Openwrt SDK。
http://www.aiothome.net/read.php?tid-14569.html
别人转角遇见爱,我转角遇见猫T _T .
级别: 新手上路
UID: 49363
精华: 0
发帖: 23
金钱: 115 两
威望: 23 点
贡献值: 0 点
综合积分: 46 分
注册时间: 2011-06-10
最后登录: 2012-10-08
7楼  发表于: 2011-09-30 12:56

 回 6楼(lintel) 的帖子

求QQ号,谢谢啦,项目现在很急啊
疯狂的嵌入式爱好者
级别: 论坛版主
UID: 40543
精华: 1
发帖: 169
金钱: 920 两
威望: 184 点
贡献值: 1 点
综合积分: 358 分
注册时间: 2011-03-19
最后登录: 2013-05-10
8楼  发表于: 2011-10-08 17:58
Gtalk:lintel.huang@gmail.com
别人转角遇见爱,我转角遇见猫T _T .
级别: 新手上路
UID: 40741
精华: 0
发帖: 49
金钱: 250 两
威望: 50 点
贡献值: 0 点
综合积分: 98 分
注册时间: 2011-03-22
最后登录: 2015-03-13
9楼  发表于: 2011-11-29 08:29
mark!学习了。
  • «
  • 1
  • 2
  • »
  • Pages: 1/2     Go