[CMake] Cross-compilation, CMake and Symlinks

fifo_thekid fifo_thekid at yahoo.com
Thu Oct 18 14:47:25 EDT 2018


So I'm using this guide to cross-compile OpenCV for Raspberry Pi:

https://visualgdb.com/tutorials/raspberry/opencv/build/ 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 at raspberrypi:~ $ sudo ldconfig

ldconfig: /usr/lib/libopencv_calib3d.so.4.0 is not a symbolic link

.....

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

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

-rwxr-xr-x 1 root root 9832912 Oct 17 18:17 libopencv_calib3d.so.4.0

-rwxr-xr-x 1 root root 9832912 Oct 17 18:16 libopencv_calib3d.so.4.0.0

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?



--
Sent from: http://cmake.3232098.n2.nabble.com/


More information about the CMake mailing list