Following this guide, http://www.a2p.it/wordpress/tech-stuff/development/remote-debugging-raspberrypi/ , I was able to cross compile from Windows to Raspberry Pi. But is it possible to cross compile with external libraries such as PCL and OpenCV. Can I just build a project using Cmake tool using the cross toolchain?
If whatever you are compiling links to, e.g.,
libfoobar, then libfoobar has to be:
In the library path when you compile. The easiest way to do that is to set up a basic hierarchy (
include) and install them to there. I'll refer to this as the "staging" directory.
Versions compiled for the pi. These could even be versions from the pi, although working out the linkage here can be much more trouble than it is worth, and you may easily end up banging your head against a wall. The ideal thing to do is get the library sources, cross-compile them, and install into the staging directory.
WRT the staging directory, you can use the cross-compiler's sysroot directory (which contains all the basic libs, e.g., glibc), however, it is probably a better idea to make one specifically for that purpose and add
LDFLAGS. I have not used the x-tool from your link, but I presume it uses crosstool-ng. If you look in the crosstool-ng docs at
5 - Using the toolchain.txt there are extensive notes about this. That pre-built x-tool may already have something configured along these lines.
If your library requirements are fairly straightforward, building them from source is not much of a hassle. However, one thing you could try is to mount the pi's root directory as an NFS share (or Samba? I don't know much about windows) and use that as a staging directory. Then you just need to install the '-dev' packages with