6

We're using eclipse on both windows and linux on pc's to program in C/C++ for the Raspberry Pi as geany's editor is too sluggish for us working on the RPi itself. We're now starting to get issues with the cross compiling when using libraries such as GTK+, mySQL etc where the compiler needs to use the library binaries but which aren't part of the cross compiler toolchains. One solution we've found is to simply hunt down the individual files the compiler wants on the RPI and copy them over to the libraries include directory on the windows or linux PC. Its worked so far so I'm wondering if there is a simple solution possible of just copying all of the library directories to the PC and avoiding having to find these individual files on the RPi and also removing future problems of library binaries changing after library updates. I'm no expert on cross compiling but can anyone see a problem with this approach and can anyone recommend which directories from the RPi to copy over?

I suppose an alternative would be to find a way of running some sort of NAS server on the RPi so it can appear as a network drive on the PC to remove the step of copying the libraries over at all - has anyone done this? Moving to tools such as Scratchbox and Buildroot seems to me to be over complicating the problem, but maybe I'm missing something which means they are needed?

Many thanks Adam

10
  • If you need to do this much cross-compilation work I would probably recommend just virtualising the environment with QEMU.
    – Jivings
    Sep 25, 2013 at 7:52
  • I've considered that but QEMU doesn't seem simple to setup, you can't copy and paste between it and the host OS (a big limitation when developing for us) and from what I've seen I don't think you can install Raspbian and assign it lots of RAM? I'd love to be wrong on these things as it would certainly be advantageous to be compiling on the target platform in this way, but the point of taking compiling off the RPi is to be using a platform that's as simple, efficient to use and powerful as possible and jumping through all sorts of hoops with QEMU doesn't seem to tick all those boxes to me?
    – Skanky
    Sep 25, 2013 at 8:25
  • Also I don't think eclipse is ported for ARM is it and one other requirement, for us at least, is to be using a really good IDE without needing to deal with manual makefiles etc.
    – Skanky
    Sep 25, 2013 at 8:31
  • Welcome to Raspberry Pi Stack Exchange! Please don't add "thanks" to your question. Upvote answers you like, this is the Raspberry Pi Stack Exchange way of saying thank you.
    – Piotr Kula
    Sep 25, 2013 at 11:44
  • 1
    Set up a NFS(linux/mac) or Samba(windows) network share will help you to share files between pcs. There is even a workaround for dropbox or google drive (search for grive) available.
    – Michael D.
    Jan 14, 2014 at 2:14

1 Answer 1

3

The compiler is looking for external files (I'm guessing includes amd libraries) to verify the function calls you make to them are valid. The former are essential. The latter is part of the compiler doing all it can to make sure the program will work so that if it fails, it's the user's fault. You can copy all of the files necessary across in one go, and then manually specify with gcc (and ld) -I and -L search directories for the files. As for which directories to copy, I'd suggest at least /usr/include, /lib, and /usr/lib. There may be others but those contain most of the stuff. Keep in mind that you need to have -dev packages installed for linking to most libraries because these contain the .a files necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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