3

My problem is may be complicated, I'll try to detail

I cross compiled opencv for ARM (Raspberry Pi) from my host, and everything works fine. I also tried to cross compile an example and it also worked; I got an executable.

But once the executable transferred to the raspberry, I cannot execute it and I get the following error:

error while loading shared libraries: libopencv_core.so.3.0: can not open shared object file: No such file or directory.

On my host, in my opencv's build folder, I have an install folder in which there are four subfolders: bin, share, include, lib. What am I suposed to do with these folders? I think I must use their content but don't know how.

Where and how do I install the cross compiled libraries in raspberry? How could I fix that error?

2
  • You need to change CMAKE_INSTALL_PREFIX in the cmake build command which points to /usr/local to RPi_rootfs/usr/local where RPi_rootfs is the root file system path which is present in your SD Card. After Cross-Compilation when you press

    sudo make install
    

    all the SO files will be placed in your Raspberry Pi's root filesystem. You can then boot your RPi and check the opencv installation.

  • You can also make CMAKE_INSTALL_PREFIX to a local folder and do

    rsync -avz local_opencv_install_folder destination_root_filesystem/usr/local
    

    where local_opencv_install_folder is the path of the folder specified in CMAKE_INSTALL_PREFIX and destination_root_filesystem is the root file system of raspberry pi present in sd card. Check for appropriate permissions to write to root file system of raspberry pi's /usr/local folder, sudo might be needed here. This method is particularly helpful when making OpenCV installations in multiple SD Cards.

This problem can be solved in a different way like, How to build opencv in a host computer: How to install OpenCV on Raspberry Pi 3 in Raspbian Jessie?

In the above link Chrooting into raspberry Pi filesystem using qemu is done, once chroot is obtained all dependencies of opencv along with building and installing of opencv is done.

  • Please do include relevant parts of the information in the link here on this site. – Bex Aug 2 '17 at 12:55
  • @Bex added some details, is it okay now? – krishna chaitanya Aug 2 '17 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.