I’m trying to get our existing project to cross compile because it takes so long to compile on the target. I’ve looked through many articles and tutorials and it looks simple, but it just won’t work. I know the libraries are all correct because I copied them straight from the target.
The target is an IMX6 (armv7) board running Debian. We’re using CLANG 6.0 for the project, but at some point in troubleshooting I changed to GCC to see if I’d have an easier time.
Any help would be much appreciated. I’ve spent a lot of time on this so far and don’t feel I’ve really gotten anywhere and I’m pretty frustrated.
The sysroot should be setup like a normal Linux root filesystem when you remove the sysroot prefix. Your library was probably in /usr/lib on the target, but here it is in /.
Thank you for the response. I don’t 100% follow–could you please elaborate? Are there specific changes you would recommend? Any relevant documentation?
Yes, on the target libraries are at /usr/lib/arm-linux-gnueabihf/ and on the host I put them at /lib/arm-clearview/arm-linux-gnueabihf. What’s the problem? The articles I found just say to set CMAKE_FIND_ROOT_PATH to the location. I don’t think I quite follow “setup like a normal Linux root filesystem” or “remove the sysroot prefix”. Doesn’t CMAKE just need to know where to look for the files?
Ok thank you so much for the help–I think I figured out what you meant and what I need to do regarding the sysroot: I’ve taken the entire target filesystem, mounted it on the host, and set CMAKE_SYSROOT, CMAKE_PREFIX_PATH and CMAKE_FIND_ROOT_PATH to the mount location.
One problem I’m having now is that there are symlinks pointing to absolute paths which of course can’t be followed correctly when mounted on the host system. What’s the right way around this? An example:
CMake Error at /media/nate/sys-1Ah/usr/lib/arm-linux-gnueabihf/cmake/Qt5Gui/Qt5GuiConfig.cmake:27 (message):
The imported target "Qt5::Gui" references the file
"/media/nate/sys-1Ah/usr/lib/arm-linux-gnueabihf/libEGL.so"
nate@nate-ubuntuvm:~/hosthome/Documents/GitHub/clearview/cmake-cross$ ls -l /media/nate/sys-1Ah/usr/lib/arm-linux-gnueabihf/libEGL.so
lrwxrwxrwx 1 root root 44 Oct 16 2017 /media/nate/sys-1Ah/usr/lib/arm-linux-gnueabihf/libEGL.so -> /etc/alternatives/arm-linux-gnueabihf_libEGL