OpenCV中文网站

 找回密码
 立即注册
搜索
热搜: 安装 配置
查看: 6785|回复: 6

OpenCV在Blackfin-uClinux下的移植&问题~

[复制链接]
发表于 2009-1-5 20:54:33 | 显示全部楼层 |阅读模式
宿主机:Red Hat 9 - Vmware 6
目标板:HH-Blackfin531 - uClinux 2.6.16 for Blackfin
ToolsChain:gcc-bfin-3.4.tgz
OpenCV:OpenCV-1.0.0.tar.gz

解压后,进入opencv目录:
  1. [root@white opencv]# ./configure --host=bfin-uclinux --without-gtk --without-carbon --without-quicktime --without-1394libs --without-ffmpeg --without-python --without-swig --enable-static --disable-shared --disable-apps CC=bfin-uclinux-gcc-3.4.5 CXX=bfin-uclinux-g++-3.4.5 CPPFLAGS=-I/usr/include
复制代码
一切正常,然后make,出现错误:
  1. /usr/include/bits/mathinline.h: In function `void icvThickLine(CvMat*, CvPoint, CvPoint, const void*, int, int, int, int)':
  2. /usr/include/bits/mathinline.h:441: error: impossible constraint in `asm'
  3. /usr/include/bits/mathinline.h:441: warning: '__result' might be used uninitialized in this function
  4. make[3]: *** [cxdrawing.lo] Error 1
  5. make[3]: Leaving directory `/home/opencv/cxcore/src'
  6. make[2]: *** [all-recursive] Error 1
  7. make[2]: Leaving directory `/home/opencv/cxcore'
  8. make[1]: *** [all-recursive] Error 1
  9. make[1]: Leaving directory `/home/opencv'
  10. make: *** [all] Error 2
复制代码
之后换了opencv-0.9.9.tar.gz,不行,configure加入--without-v4l,一样的错误,请教~!
看了好久,好像OpenCV在uClinux和WinCE下都没有完整成功移植的案例,实在是个头疼的问题,进度就卡在这里了...

发现个问题,有文章使用bfin-uclinux作为host,有的则是分别用host和target
回复

使用道具 举报

发表于 2009-1-6 01:43:26 | 显示全部楼层

OpenCV在Blackfin-uClinux下的移植&问题~

错误提示很清楚,估计是使用了非本架构支持的asm指令,出错那行肯定是embedded asm,而且里边可能用到了非目标平台支持的汇编指令或是寄存器。
出现这种错误,原因肯定是config.h中的某些宏定义不对,造成make时去编译了其他平台的文件,进而是configure参数不对。从你贴的东西来看,--host=bfin-uclinux似乎是有问题的,是否应该是--target=bfin-uclinux或直接用--cross-compiler之类的,具体你可以自己看configure文件中的内容就可以了。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-1-10 19:47:03 | 显示全部楼层

OpenCV在Blackfin-uClinux下的移植&问题~

使用opencv-0.9.9.tar.gz,解压后进入opencv目录,使用选项命令
  1. ./configure --build=i686-pc-linux-gnu --host=bfin-uclinux
复制代码
通过,然后make
  1. In file included from /usr/local/gcc-bfin-3.4-uclinux/bfin-uclinux/runtime/usr/include/limits.h:26,
  2.                  from /usr/local/gcc-bfin-3.4-uclinux/lib/gcc/bfin-uclinux/3.4.5/include/limits.h:122,
  3.                  from /usr/local/gcc-bfin-3.4-uclinux/lib/gcc/bfin-uclinux/3.4.5/include/syslimits.h:7,
  4.                  from /usr/local/gcc-bfin-3.4-uclinux/lib/gcc/bfin-uclinux/3.4.5/include/limits.h:11,
  5.                  from /usr/include/python2.2/Python.h:27,
  6.                  from _cv.cpp:129:
  7. /usr/local/gcc-bfin-3.4-uclinux/bfin-uclinux/runtime/usr/include/features.h:329:2: #error It appears you have defined _FILE_OFFSET_BITS=64. Unfortunately, uClibc was built without large file support enabled.
  8. In file included from /usr/local/gcc-bfin-3.4-uclinux/bfin-uclinux/runtime/usr/include/stdio.h:72,
  9.                  from /usr/include/python2.2/Python.h:42,
  10.                  from _cv.cpp:129:
  11. /usr/local/gcc-bfin-3.4-uclinux/bfin-uclinux/runtime/usr/include/bits/uClibc_stdio.h:72:2: #error Sorry... uClibc was built without large file support!
  12. In file included from /usr/include/python2.2/Python.h:42,
  13.                  from _cv.cpp:129:
  14. /usr/local/gcc-bfin-3.4-uclinux/bfin-uclinux/runtime/usr/include/stdio.h:83: error: `__STDIO_fpos64_t\' does not name a type
  15. In file included from /usr/include/python2.2/Python.h:42,
  16.                  from _cv.cpp:129:
  17. /usr/local/gcc-bfin-3.4-uclinux/bfin-uclinux/runtime/usr/include/stdio.h:701: error: `fpos_t\' has not been declared
  18. /usr/local/gcc-bfin-3.4-uclinux/bfin-uclinux/runtime/usr/include/stdio.h:703: error: expected `,\' or `...\' before \'*\' token
  19. In file included from /usr/include/python2.2/Python.h:71,
  20.                  from _cv.cpp:129:
  21. /usr/include/python2.2/unicodeobject.h:118:21: wchar.h: No such file or directory
  22. In file included from /usr/local/gcc-bfin-3.4-uclinux/lib/gcc/bfin-uclinux/3.4.5/include/c++/bfin-uclinux/bits/c++locale.h:43,
  23.                  from /usr/local/gcc-bfin-3.4-uclinux/lib/gcc/bfin-uclinux/3.4.5/include/c++/iosfwd:46,
  24.                  from /usr/local/gcc-bfin-3.4-uclinux/lib/gcc/bfin-uclinux/3.4.5/include/c++/bits/stl_algobase.h:70,
  25.                  from /usr/local/gcc-bfin-3.4-uclinux/lib/gcc/bfin-uclinux/3.4.5/include/c++/bits/char_traits.h:46,
  26.                  from /usr/local/gcc-bfin-3.4-uclinux/lib/gcc/bfin-uclinux/3.4.5/include/c++/string:47,
  27.                  from /usr/local/gcc-bfin-3.4-uclinux/lib/gcc/bfin-uclinux/3.4.5/include/c++/stdexcept:45,
  28.                  from _cv.cpp:2694:
  29. /usr/local/gcc-bfin-3.4-uclinux/lib/gcc/bfin-uclinux/3.4.5/include/c++/cstdio:100: error: `::fpos_t\' has not been declared
  30. _cv.cpp:2473: warning: \'long int PyInt_AS_LONG(PyObject*)\' defined but not used
  31. _cv.cpp:2483: warning: \'double PyFloat_AS_DOUBLE(PyObject*)\' defined but not used
  32. make[4]: *** [_cv_la-_cv.lo] Error 1
  33. make[4]: Leaving directory `/home/opencv/interfaces/swig/python\'
  34. make[3]: *** [all-recursive] Error 1
  35. make[3]: Leaving directory `/home/opencv/interfaces/swig\'
  36. make[2]: *** [all-recursive] Error 1
  37. make[2]: Leaving directory `/home/opencv/interfaces\'
  38. make[1]: *** [all-recursive] Error 1
  39. make[1]: Leaving directory `/home/opencv\'
  40. make: *** [all] Error 2
复制代码
编译不通过,问题处在swig中
然后添加命令,去掉swig和python支持
  1. ./configure --build=i686-pc-linux-gnu --host=bfin-uclinux --without-swig --without-python
复制代码
通过,然后make,没有报错,编译成功
然后make install,没有报错,成功
为保证结果稳定,还有一些选项如gtk等也可以取消掉
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-1-10 19:52:24 | 显示全部楼层

OpenCV在Blackfin-uClinux下的移植&问题~

之后进行验证,想直接使用make check
  1. bfin-uclinux-g++ -Wall -fno-rtti -pipe -O3 -fomit-frame-pointer -o cxcoretest aarithm.o adatastruct.o adxt.o amath.o cxcoretest_main.o  ../../../tests/cxts/.libs/libcxts.a /home/opencv/cxcore/src/.libs/libcxcore.a -L/home/mhfan/devel/hhbf/toolchain/build/gcc_build-3.4/bfin-uclinux/libstdc++-v3/src -L/home/mhfan/devel/hhbf/toolchain/build/gcc_build-3.4/bfin-uclinux/libstdc++-v3/src/.libs -L/home/mhfan/devel/hhbf/toolchain/build/gcc_build-3.4/gcc -L/usr/local/gcc-bfin-3.4-uclinux/bfin-uclinux/bin -L/usr/local/gcc-bfin-3.4-uclinux/bfin-uclinux/lib -L/usr/local/gcc-bfin-3.4-uclinux/lib/../bfin-uclinux/lib -L/usr/local/gcc-bfin-3.4-uclinux/bfin-uclinux/runtime/lib -lc -lgcc ../../../cxcore/src/.libs/libcxcore.a /usr/local/gcc-bfin-3.4-uclinux/lib/gcc/bfin-uclinux/3.4.5/libstdc++.a -lpthread -lm/home/opencv/cxcore/src/.libs/libcxcore.a(cxswitcher.o)(.text+0x368): In function `icvUpdatePluginFuncTab(CvPluginFuncInfo*)\':
  2. cxswitcher.cpp: undefined reference to `_dlsym\'
  3. /home/opencv/cxcore/src/.libs/libcxcore.a(cxswitcher.o)(.text+0x55a): In function `_cvUseOptimized\':
  4. cxswitcher.cpp: undefined reference to `_dlopen\'
  5. /home/opencv/cxcore/src/.libs/libcxcore.a(cxswitcher.o)(.text+0x5d0):cxswitcher.cpp: undefined reference to `_dlclose\'
  6. collect2: ld returned 1 exit status
  7. make[4]: *** [cxcoretest] Error 1
  8. make[4]: Leaving directory `/home/opencv/tests/cxcore/src\'
  9. make[3]: *** [check-am] Error 2
  10. make[3]: Leaving directory `/home/opencv/tests/cxcore/src\'
  11. make[2]: *** [check-recursive] Error 1
  12. make[2]: Leaving directory `/home/opencv/tests/cxcore\'
  13. make[1]: *** [check-recursive] Error 1
  14. make[1]: Leaving directory `/home/opencv/tests\'
  15. make: *** [check-recursive] Error 1
复制代码
出现错误...
回复 支持 反对

使用道具 举报

发表于 2009-1-12 12:38:18 | 显示全部楼层

OpenCV在Blackfin-uClinux下的移植&问题~

make check的错误提示已经很清楚了,告诉你了,找不到dlsym、dlopen之类的函数,这些函数都是dl库中实现的,该库的主要功能就是实现动态库的管理。
所以,自己改下makefile或是在最后的链接命令中加上-ldl即可。如果你的uc没有dl库,那就要禁用程序的动态库功能,全部用静态链接,代码里边所有依赖动态库的地方也要全部改掉。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-1-13 19:57:55 | 显示全部楼层

OpenCV在Blackfin-uClinux下的移植&问题~

make check的错误提示已经很清楚了,告诉你了,找不到dlsym、dlopen之类的函数,这些函数都是dl库中实现的,该库的主要功能就是实现动态库的管理。
所以,自己改下makefile或是在最后的链接命令中加上-ldl即可。如果你的uc没有dl库,那就要禁用程序的动态库功能,全部用静态链接,代码里边所有依赖动态库的地方也要全部改掉。

太感谢了,刚开始进行跨平台开发,我重新加入命令,只生产静态库,看看效果
全部用静态链接,代码里边所有依赖动态库的地方也要全部改掉
这里的代码指的是测试代码,是吧?
回复 支持 反对

使用道具 举报

发表于 2009-1-14 00:03:02 | 显示全部楼层

OpenCV在Blackfin-uClinux下的移植&问题~

不明白你的问题。建议你先google,好好学习一下静态库和动态库的区别,记得我之前写过一篇文章,不过那篇文章重在理论,具体实现方面google可以找到很多。
我那篇文章链接如下:
<!-- l --><a class=\"postlink-local\" href=\"http://www.opencv.org.cn/forum/viewtopic.php?f=1&t=4647\">viewtopic.php?f=1&t=4647</a><!-- l -->
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|OpenCV中文网站

GMT+8, 2024-4-19 11:24 , Processed in 0.009357 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表