Problems with OpenCV on Angstrom 2012.05

Hey guys,

I have Angstrom 2012.05 running on my Beaglebone. It appears opencv is already installed on it version 2.3 I think. I wrote a script to compile my code with:

#adjust path to source code

cd /home/root/opencv



pkg-config --cflags opencv

echo ’ ’

pkg-config --libs opencv

echo ’ ’

#adjust name of output file and code file

gcc pkg-config --cflags opencv pkg-config --libs opencv -o tes2 tes2.c

When I run it the output is:


-lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lope

ncv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_leg

acy -lopencv_flann


eabi/bin/ld: /tmp/cccM3Ktd.o: undefined reference to symbol ‘lrint@@GLIBC_2.4


eabi/bin/ld: note: ‘lrint@@GLIBC_2.4’ is defined in DSO /lib/ so try ad

ding it to the linker command line

/lib/ could not read symbols: Invalid operation

collect2: ld returned 1 exit status

I tried re installing opencv with opkg it gets 2.4 but it doesn’t delete the old version of opencv and when I ran my script I get more errors where the files seem to clash.

Has anyone got this working? Is my approach correct? Any help would be appreciated.


Try adding '-lm' to the linker cmdline

Where exactly do I put -lm? I keep getting -lm command not found.

did you get the solution? I have similar issues of undefined references.

After playing around for awhile I got it to work with this:

#adjust path to source code
cd /home/root/files


#adjust name of output file and code file
gcc $(pkg-config --cflags --libs opencv) -lm -o image image.c