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_PATH=/usr/lib:${PKG_CONFIG_PATH}

export PKG_CONFIG_PATH

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:

-I/usr/include/opencv

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

ncv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_leg

acy -lopencv_flann

/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.5.4/…/…/…/…/arm-angstrom-linux-gnu

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

/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.5.4/…/…/…/…/arm-angstrom-linux-gnu

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

ding it to the linker command line

/lib/libm.so.6: 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.

Thanks,

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

PKG_CONFIG_PATH=/usr/lib/pkgconfig:${PKG_CONFIG_PATH}
export PKG_CONFIG_PATH

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