Cross-compilation, CMake and Symlinks

So I'm using this guide to cross-compile OpenCV for Raspberry Pi: I'm doing that mainly because building anything on RPi is much slower than on Windows, and because I need the remote debugging tools of Visual Studio. Everything worked as expected especially with the advanced CMake subsystem of VisualGDB. However, when I reached the deployment step I faced some annoyances.

First, SmarTTY could not upload to the /usr directory because there is no way to apply the sudo command in the application. I could copy everything to the /home/pi directory and then I copied everything recursively to /usr, which worked like a charm! I got remote debugging working and compiled applications picked up all the required dependencies. I don't know if there is an alternative to manually copying the files though.

The second annoyance was when I did used the ldconfig command:

pi@raspberrypi:~ $ sudo ldconfig

ldconfig: /usr/lib/ is not a symbolic link


pi@raspberrypi:/usr/lib $ ls libopencv_calib3d.* -al

-rwxr-xr-x 1 root root 9832912 Oct 17 18:16

-rwxr-xr-x 1 root root 9832912 Oct 17 18:17

-rwxr-xr-x 1 root root 9832912 Oct 17 18:16

As you can see, instead of creating one .so file and several symbolic links, it creates multiple copies of the same file. This is basically because Windows does not support symlinks. Now there are several adhoc solutions, like scripts that convert duplicate files to symlinks but this doesn't really look like a reliable approach. How do you solve this kind of problem in your day to day cross-compilation tasks?
SmarTTY could not upload to the /usr directory because there is no way to apply the sudo command in the application

You should be able to install to a different place by configuring a prefix. IIRC, CMake does this with
cmake -DCMAKE_INSTALL_PREFIX:PATH=/my/install/prefix.

In any event, why not (temporarily) configure your RPi so that you can have VGDB log in as the root user?

I'm afraid I don't know how to help with your symlinks issue. I only use Linux computers nowadays.
Last edited on
well that make an interesting idea
but remember, I'm running CMake on Windows. So what would be the installation folder in this case?
Topic archived. No new replies allowed.