2008-03-02 07:42:49     adding OpenCV to uClinux

Document created by Aaronwu Employee on Aug 5, 2013
Version 1Show Document
  • View in full screen mode

2008-03-02 07:42:49     adding OpenCV to uClinux

stop go (UNITED STATES)

Message: 51966    Hi,

 

I've followed the instructions on your wiki for adding my own library to the kernel.  When I compile, I choke on the following line:

 

bfin-linux-uclibc-g++ -DHAVE_CONFIG_H -I. -I../../../opencv-1.0.0/otherlibs/highgui -I../.. -I. -I../../../opencv-1.0.0/cxcore/include -I../../../opencv-1.0.0/cv/include -DNDEBUG -DEMBED -D__uClinux__ -I/home/stopgo/robot/uclinux/uclinux-dist -mcpu=bf537-0.2 -Wall -fno-rtti -pipe -O3 -fomit-frame-pointer -pipe -Wall -mcpu=bf537-0.2 -MT cvcap_v4l.lo -MD -MP -MF .deps/cvcap_v4l.Tpo -c ../../../opencv-1.0.0/otherlibs/highgui/cvcap_v4l.cpp  -fPIC -DPIC -o .libs/cvcap_v4l.o

bfin-linux-uclibc-g++ -DHAVE_CONFIG_H -I. -I../../../opencv-1.0.0/otherlibs/highgui -I../.. -I. -I../../../opencv-1.0.0/cxcore/include -I../../../opencv-1.0.0/cv/include -DNDEBUG -DEMBED -D__uClinux__ -I/home/stopgo/robot/uclinux/uclinux-dist -mcpu=bf537-0.2 -Wall -fno-rtti -pipe -O3 -fomit-frame-pointer -pipe -Wall -mcpu=bf537-0.2 -MT window.lo -MD -MP -MF .deps/window.Tpo -c ../../../opencv-1.0.0/otherlibs/highgui/window.cpp  -fPIC -DPIC -o .libs/window.o

../../../opencv-1.0.0/otherlibs/highgui/cvcap_v4l.cpp: In member function 'virtual bool MyMJpegReader::ReadHeader()':

../../../opencv-1.0.0/otherlibs/highgui/cvcap_v4l.cpp:1667: error: 'fmemopen' was not declared in this scope

 

This error is a little surprising to me, as it appears fmemopen() is included in uClibc.  When I try to build in the half-generated lib/opencv/build directory (which is the directory I've set up for the library's build output), I get an error complaining about an inability to find jpeglib.h:

 

bfin-linux-uclibc-g++ -DHAVE_CONFIG_H -I. -I../../../opencv-1.0.0/otherlibs/highgui -I../.. -I. -I../../../opencv-1.0.0/cxcore/include -I../../../opencv-1.0.0/cv/include -DNDEBUG -DEMBED -D__uClinux__ -I/home/stopgo/robot/uclinux/uclinux-dist -mcpu=bf537-0.2 -Wall -fno-rtti -pipe -O3 -fomit-frame-pointer -pipe -Wall -mcpu=bf537-0.2 -MT cvcap_v4l.lo -MD -MP -MF .deps/cvcap_v4l.Tpo -c ../../../opencv-1.0.0/otherlibs/highgui/cvcap_v4l.cpp  -fPIC -DPIC -o .libs/cvcap_v4l.o

../../../opencv-1.0.0/otherlibs/highgui/cvcap_v4l.cpp:1604:21: error: jpeglib.h: No such file or directory

 

I've added "depends LIB_LIBJPEG" to the Kconfig for OpenCV, but this didn't change anything.  Any idea which of the two is the actual problem, and what I can do to solve it?

QuoteReplyEditDelete

 

 

2008-03-03 12:59:51     Re: adding OpenCV to uClinux

Mike Frysinger (UNITED STATES)

Message: 51996    the glibc-specific function "fmemopen" is optional in uClibc and not included in the default build

 

the uClinux-dist build adds the include dir in the staging dir to the default include path which running outside of the build does not ... you will need to add -I yourself in that case

QuoteReplyEditDelete

 

 

2008-03-04 06:17:24     Re: adding OpenCV to uClinux

stop go (UNITED STATES)

Message: 52017    Thanks!  So I need to recompile my toolchain, passing uClib some flag telling it to build with fmemopen?  What would I pass it?

QuoteReplyEditDelete

 

 

2008-03-04 06:30:42     Re: adding OpenCV to uClinux

Mike Frysinger (UNITED STATES)

Message: 52018    you would have to create your own uClibc .config file using the uClibc configuration system and pass that to the toolchain build script

QuoteReplyEditDelete

 

 

2008-03-07 04:26:43     Re: adding OpenCV to uClinux

stop go (UNITED STATES)

Message: 52192    I see that I need to toggle UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y, but I would prefer not to reconfigure from scratch (I'm not particularly confident in my ability to do so correctly, at the moment).  I see a number of similar config files in the uClibc directory, apparently generated by my previous build.  They're named like:

 

.config-used-for_., .config-used-for_bf532-none, .config-used-for_mid-shared-library, etc.

 

I don't know why there are more than one of them, but I'd like to modify one and pass it to BuildToolChain.  Is there an easy way for me to find out which of them was used for my previous build?

QuoteReplyEditDelete

 

 

2008-03-07 11:29:40     Re: adding OpenCV to uClinux

Mike Frysinger (UNITED STATES)

Message: 52200    they were all used ... the suffix indicates what configuration it was targeting in general

QuoteReplyEditDelete

 

 

2008-03-08 00:36:12     Re: adding OpenCV to uClinux

stop go (UNITED STATES)

Message: 52210    Thanks for all your help, Mike.

 

So in order to minimize chance of error, I just modified the default blackfin configs in my copy of uClibc to include glib's custom streams.

 

Now I'm choking here:

 

bfin-linux-uclibc-g++ -shared -nostdlib /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/bf532-0.3/usr/lib/crtreloc.o /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/bf532-0.3/usr/lib/crti.o /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../lib/gcc/bfin-linux-uclibc/4.1.2/bf532-0.3/crtbeginS.o  .libs/dummy.o -Wl,--whole-archive ./.libs/lib_cxcore.a -Wl,--no-whole-archive  -Wl,--rpath -Wl,/home/stopgo/robot/uclinux/build/-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2 -Wl,--rpath -Wl,/home/stopgo/robot/uclinux/build/-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2 -L/home/stopgo/robot/uclinux/gcc-build/gcc_build-4.1/bfin-linux-uclibc/libstdc++-v3/src -L/home/stopgo/robot/uclinux/gcc-build/gcc_build-4.1/bfin-linux-uclibc/libstdc++-v3/src/.libs -L/home/stopgo/robot/uclinux/gcc-build/gcc_build-4.1/./gcc -L/home/stopgo/robot/uclinux/build/-linux-uclibc/bfin-linux-uclibc/bin -L/home/stopgo/robot/uclinux/build/-linux-uclibc/bfin-linux-uclibc/lib -L/home/stopgo/robot/uclinux/build/-linux-uclibc/lib/../bfin-linux-uclibc/lib -L/home/stopgo/robot/uclinux/build/-linux-uclibc/bfin-linux-uclibc/runtime/lib -L/home/stopgo/robot/uclinux/build/-linux-uclibc/bfin-linux-uclibc/runtime/usr/lib -lpthread -ldl -L/home/stopgo/robot/uclinux/build/linux-uclibc/bin/../lib/gcc/bfin-linux-uclibc/4.1.2/bf532-0.3 -L/home/stopgo/robot/uclinux/build/-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/bf532-0.3 -L/home/stopgo/robot/uclinux/build/linux-uclibc/bin/../lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/lib/bf532-0.3 -L/home/stopgo/robot/uclinux/build/-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/lib/bf532-0.3 -L/home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/bf532-0.3/lib -L/home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/bf532-0.3/usr/lib /home/stopgo/robot/uclinux/build/-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/libstdc++.so -lm -lc -lgcc_s /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../lib/gcc/bfin-linux-uclibc/4.1.2/bf532-0.3/crtendS.o /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/bf532-0.3/usr/lib/crtn.o  -mcpu=bf537-0.2 -mcpu=bf537-0.2 -mcpu=bf537-0.2 -Wl,-soname -Wl,libcxcore.so.1 -o .libs/libcxcore.so.1.0.0

/home/stopgo/robot/uclinux/build/linux-uclibc/bin/../lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/bin/ld: cannot find /lib//libc.so.0

 

Originally I had passed a custom config to uClibc, and I thought somehow I had botched some prefix setting, but now that I've only modified it as described above, I think this might be a new issue.  It's also curious to me that the kernel compilation goes fine until it hits opencv, as other parts of the kernel must surely try to use libc.so.0.

 

This (http://blackfin.uclinux.org/gf/project/toolchain/tracker/?action=TrackerItemEdit&tracker_item_id=2661) looks slightly different, but could it be related?

QuoteReplyEditDelete

 

 

2008-03-10 15:07:45     Re: adding OpenCV to uClinux

Mike Frysinger (UNITED STATES)

Message: 52275    smells like the linker script / sysroot troubles ...

 

if you run:

bfin-linux-uclibc-g++ -nostdlib -lc -Wl,--verbose

 

do you get the same error ?  it should be finding libc.so and friends just fine ... here's what mine looks like:

 

........

==================================================

attempt to open /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/libc.so failed

attempt to open /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/libc.a failed

attempt to open /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/lib/libc.so failed

attempt to open /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/lib/libc.a failed

attempt to open /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/bfin-linux-uclibc/runtime/lib/libc.so failed

attempt to open /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/bfin-linux-uclibc/runtime/lib/libc.a failed

attempt to open /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/lib/libc.so succeeded

opened script file /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/lib/libc.so

opened script file /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/lib/libc.so

attempt to open /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/bfin-linux-uclibc/runtime/lib//libc.so.0 succeeded

/lib//libc.so.0 (/usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/bfin-linux-uclibc/runtime/lib//libc.so.0)

attempt to open /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/lib//uclibc_nonshared.a succeeded

attempt to open /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/bfin-linux-uclibc/runtime/lib//ld-uClibc.so.0 succeeded

/lib//ld-uClibc.so.0 (/usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/bfin-linux-uclibc/runtime/lib//ld-uClibc.so.0)

ld-uClibc.so.0 needed by /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/bfin-linux-uclibc/runtime/lib//libc.so.0

found ld-uClibc.so.0 at /usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/bfin-linux-uclibc/runtime/lib//ld-uClibc.so.0

/usr/local/src/blackfin/toolchains/20080309/bfin-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/bin/ld: warning: cannot find entry symbol __start; not setting start address

QuoteReplyEditDelete

 

 

2008-03-12 04:07:20     Re: adding OpenCV to uClinux

stop go (UNITED STATES)

Message: 52372    It looks similar to your output.

 

attempt to open /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../lib/gcc/bfin-linux-uclibc/4.1.2/libc.so failed

attempt to open /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../lib/gcc/bfin-linux-uclibc/4.1.2/libc.a failed

attempt to open /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../lib/gcc/libc.so failed

attempt to open /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../lib/gcc/libc.a failed

attempt to open /home/stopgo/robot/uclinux/build/-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/libc.so failed

attempt to open /home/stopgo/robot/uclinux/build/-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/libc.a failed

attempt to open /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/lib/libc.so failed

attempt to open /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/lib/libc.a failed

attempt to open /home/stopgo/robot/uclinux/build/-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/lib/libc.so failed

attempt to open /home/stopgo/robot/uclinux/build/-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/lib/libc.a failed

attempt to open /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/lib/libc.so failed

attempt to open /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/lib/libc.a failed

attempt to open /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/usr/lib/libc.so succeeded

opened script file /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/usr/lib/libc.so

opened script file /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/usr/lib/libc.so

attempt to open /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/lib//libc.so.0 succeeded

/lib//libc.so.0 (/home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/lib//libc.so.0)

attempt to open /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/usr/lib//uclibc_nonshared.a succeeded

attempt to open /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/lib//ld-uClibc.so.0 succeeded

/lib//ld-uClibc.so.0 (/home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/lib//ld-uClibc.so.0)

ld-uClibc.so.0 needed by /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/lib//libc.so.0

found ld-uClibc.so.0 at /home/stopgo/robot/uclinux/build/linux-uclibc/bin/../bfin-linux-uclibc/runtime/lib//ld-uClibc.so.0

/home/stopgo/robot/uclinux/build/linux-uclibc/bin/../lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/bin/ld: warning: cannot find entry symbol __start; not setting start address

QuoteReplyEditDelete

 

 

2008-03-16 09:23:02     Re: adding OpenCV to uClinux

stop go (UNITED STATES)

Message: 52570    I kludged around this by making symlinks for the places the linker was demanding, but that's a pretty ugly solution (in particular because I had to move some legitimate libraries out of the way).  Do you know of a better one?

Attachments

    Outcomes