undefined reference to `CMEM_init',`CMEM_alloc',`CMEM_free' error in bitbake Opencv

Hello All,

When I did run bitbake Opencv, I got following errors. I tried most of options but giving same error.

…/…/lib/libopencv_core.so.2.
3.1: undefined reference to CMEM_init' ../../lib/libopencv_core.so.2.3.1: undefined reference to CMEM_alloc’
…/…/lib/libopencv_core.so.2.3.1: undefined reference to CMEM_free' collect2: ld returned 1 exit status make[2]: *** [bin/opencv_test_core] Error 1 make[2]: Leaving directory /home/metrans/setup-scripts/build/tmp-angstrom_2010_x-eglibc/work/armv7a-angstrom-linux-gnueabi/opencv-2.3.1-r3/opencv’
make[1]: *** [modules/core/CMakeFiles/opencv_test_core.dir/all] Error 2

This is details of error.

http://pastebin.com/vdKyDSXs

Looks like CMEM library is not able to link with OpenCV. I copied cmem.h & cmem.a470MV lib into Opencv lib folder. But no luck.
Anybody have any idea what’s going wrong ? I will appreciate your help.

Thanks,
Dhut

As I am following step 3 in http://code.google.com/p/opencv-dsp-acceleration/wiki/Instruction_For_Building_Examples

So I did

metrans@metrans:~/setup-scripts/build/tmp-angstrom_2010_x-eglibc/work/armv7a-angstrom-linux-gnueabi/opencv-2.3.1-r3$ sed -i ‘/^CXX_FLAGS/s:$: -I<home/metrans/setup-scripts/build/tmp-angstrom_2010_x-eglibc/sysroots/beagleboard/usr/share/ti/ti-linuxutils-tree/packages/ti/sdo/linuxutils/cmem/include:g’ opencv/modules/core/CMakeFiles/opencv_core.dir/flags.make

metrans@metrans:~/setup-scripts/build/tmp-angstrom_2010_x-eglibc/work/armv7a-angstrom-linux-gnueabi/opencv-2.3.1-r3$ sed -i ‘/^CXX_FLAGS/s:$: -I<home/metrans/setup-scripts/build/tmp-angstrom_2010_x-eglibc/sysroots/beagleboard/usr/share/ti/ti-linuxutils-tree/packages/ti/sdo/linuxutils/cmem/lib/cmem.a470MV:g’ opencv/modules/core/CMakeFiles/opencv_core.dir/link.txt

bitbake opencv

This time I got different error
http://pastebin.com/TyBQ6q2D

I have also attached flags.make and link.txt

Please guide me.

link.txt (1.77 KB)

flags.make (3.27 KB)

Dhut C wrote:

As I am following step 3 in Google Code Archive - Long-term storage for Google Code Project Hosting.

So I did

metrans@metrans:~/setup-scripts/build/tmp-angstrom_2010_x-eglibc/work/armv7a-angstrom-linux-gnueabi/opencv-2.3.1-r3$ sed
-i '/^CXX_FLAGS/s:$:
-I<home/metrans/setup-scripts/build/tmp-angstrom_2010_x-eglibc/sysroots/beagleboard/usr/share/ti/ti-linuxutils-tree/packages/ti/sdo/linuxutils/cmem/include:g'
opencv/modules/core/CMakeFiles/opencv_core.dir/flags.make

metrans@metrans:~/setup-scripts/build/tmp-angstrom_2010_x-eglibc/work/armv7a-angstrom-linux-gnueabi/opencv-2.3.1-r3$ sed
-i '/^CXX_FLAGS/s:$:
-I<home/metrans/setup-scripts/build/tmp-angstrom_2010_x-eglibc/sysroots/beagleboard/usr/share/ti/ti-linuxutils-tree/packages/ti/sdo/linuxutils/cmem/lib/cmem.a470MV:g'
opencv/modules/core/CMakeFiles/opencv_core.dir/link.txt

bitbake opencv

This time I got different error
New error bitbake opencv - Pastebin.com

which says:

/bin/sh: cannot open

home/metrans/setup-scripts/build/tmp-angstrom_2010_x-eglibc/sysroots/beagleboard/usr/share/ti/ti-linuxutils-tree/packages/ti/sdo/linuxutils/cmem/include: No such file

should be easy to check if that is the correct place where you
have linuxutils...

I would suggest you use /home/... and not home/...

I would suggest sticking to http://www.angstrom-distribution.org/building-angstrom and build opencv without cmem to start with. Or just use the opencv binaries..

Vladimir,
I tried to use /home/… . But I am ended up with this error . I don’t know what’s going wrong ? Why I am getting following errors

…/…/lib/libopencv_core.so.2.3.1: undefined reference to CMEM_init' ../../lib/libopencv_core.so.2.3.1: undefined reference to CMEM_alloc’ …/…/lib/libopencv_core.so.2.3.1: undefined reference to `CMEM_free’

Does anybody have solution for this ?

Koen,
I am trying to implement Opencv DSP Accelration Project http://code.google.com/p/opencv-dsp-acceleration/wiki/Instruction_For_Building_Examples

I am following the steps given in above tutorial. How come I build opencv without cmem to start with Or just use the opencv binaries ?
Could you explain little bit more ?

Dhut C wrote:

Vladimir,
  I tried to use /home/... . But I am ended up with this error New error bitbake opencv 1 - Pastebin.com. I don't know what's going
wrong ? Why I am getting following errors

  ../../lib/libopencv_core.so.2.3.1: undefined reference to `CMEM_init' ../../lib/libopencv_core.so.2.3.1: undefined
reference to `CMEM_alloc' ../../lib/libopencv_core.so.2.3.1: undefined reference to `CMEM_free'

Does anybody have solution for this ?

the instructions you are following are almost 2 years old, so they could
be slightly outdated or stuff could have changed. Unless somebody else
sites down and tries to re-do what you did, It's hard to tell what
is going wrong in your case. Otherwise, the usual guidelines about
"making stuff compile" apply here, but please understand there is no
definite guide.

As for the error: undefined reference to `CMEM_free'
it looks like you are not linking against the CMEM library.

Yes, I'm having the same error when I try to compile onboard omapfbplay with cmem option enabled. The cmem kernel module is installed and running but I can't find a trace of the cmem shared library, nor in my system neither in the cmem bitbake recipe (that I've used to build the module)

Yeah, I disabled the CMEM option at compile time, but because omapfbplay does not rely on it (it’s just an addon, a better way to do the stuff)

I don’t know if you can disable this option with opencv, maybe you shoud have a look to the makefile (or the oe recipe)

But I really want to understand how to get a CMEM shared lib…

Hello Everybody,
Finally, I am able tot run bitbake opencv successfully. I solved this problem. I was doing stupid mistake. If you look at these two commands. These are different, not the same.
I wasn’t focusing on difference between start of these commands which is bold here. I was using sed -i '/^CXX_FLAGS/s:$: -I in second command which should have only sed -i '/^/s:$:

sed -i '/^CXX_FLAGS/s:$: -I</home/metrans/setup-scripts/build/tmp-angstrom_2010_x-eglibc/sysroots/beagleboard/usr/share/ti/ti-linuxutils-tree/packages/ti/sdo/linuxutils/cmem/include:g’ opencv/modules/core/CMakeFiles/opencv_core.dir/flags.make

sed -i '/^/s:$: /home/metrans/setup-scripts/build/tmp-angstrom_2010_x-eglibc/sysroots/beagleboard/usr/share/ti/ti-linuxutils-tree/packages/ti/sdo/linuxutils/cmem/lib/cmem.a470MV:g’ opencv/modules/core/CMakeFiles/opencv_core.dir/link.txt

Thanks everybody for your pointers. I hope this will help other people.

Thanks so much for the help.
This was my problem also. I had to fix a number of issues to get OpenCV to build and I ended up manually editing those two files.
At first I had added the cmem.a.a470MV file as an include “-I” rather than an object.
It built, but then the ‘undefined reference’ error results, eventually.
I went back, added that file at the end of the long string of colons, rebuilt, copied the library over, and it works.
-Len