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

407 views
Skip to first unread message

Dhut C

unread,
Apr 18, 2012, 2:57:43 PM4/18/12
to beagl...@googlegroups.com
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



Dhut C

unread,
Apr 18, 2012, 4:19:16 PM4/18/12
to beagl...@googlegroups.com, Dhut C

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
flags.make

Vladimir Pantelic

unread,
Apr 19, 2012, 7:08:14 AM4/19/12
to beagl...@googlegroups.com
Dhut C wrote:

> 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

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/...

Koen Kooi

unread,
Apr 19, 2012, 7:14:35 AM4/19/12
to beagl...@googlegroups.com

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..

Dhut C

unread,
Apr 20, 2012, 1:31:12 AM4/20/12
to beagl...@googlegroups.com
Vladimir,
 I tried to use  /home/... . But I am ended up with this error http://pastebin.com/nHSBHab1.  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 ?

Vladimir Pantelic

unread,
Apr 20, 2012, 2:54:00 AM4/20/12
to beagl...@googlegroups.com
Dhut C wrote:

> Vladimir,
> I tried to use /home/... . But I am ended up with this error http://pastebin.com/nHSBHab1. 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.

Christophe Gimenez

unread,
Apr 20, 2012, 4:41:07 AM4/20/12
to beagl...@googlegroups.com
le 20/04/2012 08:54, Vladimir Pantelic nous a dit:

> Dhut C wrote:
>
>> Vladimir,
>> I tried to use /home/... . But I am ended up with this error
>> http://pastebin.com/nHSBHab1. 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 ?
>
> 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)

Dhut C

unread,
Apr 20, 2012, 2:53:19 PM4/20/12
to beagl...@googlegroups.com

Vladimir,
okay. I got your point. Can I skip Cmem option ? Does it affect next steps ?


Dhut C

unread,
Apr 20, 2012, 2:53:38 PM4/20/12
to beagl...@googlegroups.com

@ Christophe
What you did , if you couldn't fine CMEM shared library ? Did you disable Cmem option ? How did you get rid off this error message ?

Dhut C

unread,
Apr 20, 2012, 2:54:29 PM4/20/12
to beagl...@googlegroups.com
On Thu, Apr 19, 2012 at 4:14 AM, Koen Kooi <ko...@beagleboard.org> wrote:

Christophe Gimenez

unread,
Apr 20, 2012, 3:32:36 PM4/20/12
to beagl...@googlegroups.com
le 20/04/2012 20:53, Dhut C nous a dit:
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...

Dhut C

unread,
Apr 20, 2012, 4:18:50 PM4/20/12
to beagl...@googlegroups.com
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.

Len

unread,
Oct 24, 2012, 10:52:24 AM10/24/12
to beagl...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages