Cross-compiling a sample OpenCV cpp for BeagleBone

Hello there,

I am trying to cross compile a sample OpenCV cpp code for my beaglebone (ubuntu installed on it) by using my Ubuntu 12.04 desktop. However when I start the cross-compiling I get the following error:

/usr/local/lib/libopencv_calib3d.so: could not read symbols: File in wrong format collect2: ld returned 1 exit status

It seems like a linker error. I am pretty sure that there is nothing wrong with libopencv_calib3d.so. Because when I compile the program for my PC, everything works fine. Therefore maybe the problem is with the method that I am using for cross compiling. Here is what I do:

I wrote a script in the name of compile_opencvarm.sh:

Hello again!

I had toolchain problems when I was trying to compile OpenCV with ffmpeg. A usefull tool to compile it is scratchbox.

In this specific case, it seems that your lib /usr/local/lib/libopencv_calib3d.so doesn’t have debugging symbols, or something like it. Have you enabled debugging on OpenCV?

To check if a lib has symbols, use ‘file /path-to-rootfs/usr/local/lib/libopencv_calib3d.so’ in your PC. ‘Stripped’ means it doesn’t.

Att,

Fernando Akira Endo

Phi Innovations

Av. José Rocha Bomfim, 214 - Cj. 16
Cond. Praça Capital - Ed. Londres
Center Santa Genebra
13080-650 - Campinas - SP - Brasil
+55 19 3709-1358

2012/7/19 zero <satanasxentius@gmail.com>

Hello Fernando!

I am sorry that I could not reply to you, I was too sick on the weekend.

Seems like libopencv_calib3d.so.2.4.1 is not stripped:

zero@ghostrider:/usr/local/lib$ file libopencv_calib3d.so.2.4.1
libopencv_calib3d.so.2.4.1: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=0x08d2e143f640a34ab0adc10c5e980560c5dc6e87, not stripped

I am not sure if I enabled debugging on OpenCV. I installed it three times and now I forgot what I have done at the last time. Is there an easy way to check it?

Thank you so much for your help!

Hello,

Sorry, I was wrong when I said:

“In this specific case, it seems that your lib /usr/local/lib/libopencv_calib3d.so doesn’t have debugging symbols, or something like it. Have you enabled debugging on OpenCV?”

I hadn’t read your second message, the above error was related to the missing arm libraries, and you had already fixed it.

The undefined reference message means that your linker can’t find a library, even if it’s on your system. Check the makefile to see if the missing library is included (parameter -l, lower case L) and if its path is right (parameter -L).

Att,

Fernando Akira Endo

Phi Innovations

Av. José Rocha Bomfim, 214 - Cj. 16
Cond. Praça Capital - Ed. Londres
Center Santa Genebra
13080-650 - Campinas - SP - Brasil
+55 19 3709-1358

2012/7/23 Amadeus Bachmann <satanasxentius@gmail.com>

Hello Fernando!

Finally I could compile a OpenCV program for my beaglebone but the problem is that:

My program’s output is ought to be: 5 faces found in the photo (only one line)
But what I get is:

5 faces found in the photo
���<��|gc�iV�1�n~��ym^����6_�M���xd������D����:
5 faces found in the photo
qJY$rG�=:�����?��U�_1���"��V��OV^'���_�ءث�Wb��_�:
5 faces found in the photo
5
c�p�>/F��Gq_:
5 faces found in the photo
ħ�;�@:
5 faces found in the photo
X�,�v
��{�{�k��KހOxJW���8���:
5 faces found in the photo
keb��:r�����I����g{uG�x9��Un��ݻaV s)rjOb
5 faces found in the photo
��^e��5�7�S������V��)|M���G�/��u��MW�,��{�Z{g��12��eZ+|U(q��O��
-I4d8�����)
��6
늾�����r:��Y�h��?��B���T�S�x�H�V�,�$��
b��]��v��k�_����l�󏚴{}wT������f���frX�K��~V-��b����x.���y�a<~a�㰵ӣҴ<[Z-�8Is&�%���MG 7���6$$��P� ���T��6�dVw��L�s�4��_��0U22��~B�<�� ڽ��-޽s�,i"J�
t!�a���/�\5LL���X�v
�Դ�;X��Mխ!����ַ1��:�28 ��.��:
5 faces found in the photo
��v�U��:
5 faces found in the photo
������Ф������Yy�,��Q��d"��>�݀�¦��Y,?�_��`�f��~K�Z��:
5 faces found in the photo
�=�
�:&�Z�:ھ>��N+lWϺf�i�{��Zm��(>��F�����V��W@�?�6��:
5 faces found in the photo
�"��M�>��j���,U~�Uث�Wb��_�����Uث�Wb��]��v�Uث�Wb��]��v�Uث�Wb��]��v�Uث�Wb��]��v�Uث�Wb��]��v�Uث�Wb��]��v�Uث�Wb��]��v*�Uث�Wb��]����:
5 faces found in the photo

It keeps writing something meaningless like this for a while and then stops. Do you have an idea what could be root of this problem? By the way I am pretty sure that the program is OK. Because I executed on my PC and when I try to process the same photo it outputs: “5 faces found in the photo” only once and then stops execution.

This is very strange, unfortunately I have no idea…

Att,

Fernando Akira Endo

2012/7/25 Amadeus Bachmann <satanasxentius@gmail.com>