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

syb0rg
  • 8,188
  • 4
  • 37
  • 51
Skanky
  • 61
  • 2
  • If you need to do this much cross-compilation work I would probably recommend just virtualising the environment with QEMU. – Jivings Sep 25 '13 at 07: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 '13 at 08: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 '13 at 08: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 '13 at 11:44
  • There are methods to copy and paste to QEMU. You can install Raspbian, and you can assign it as many resources as you like. But you're right, this probably isn't the most efficient method of developing for the Pi. – Jivings Sep 25 '13 at 15:58
  • "I don't think eclipse is ported for ARM" Eclipse is written in java, no one had to do anything to port it to ARM, and it is listed in the raspbian repos. – goldilocks Sep 25 '13 at 19:28
  • I would really encourage you to learn how to compile stuff outside of the IDE. It allows you to make all these kinds of tweaks with very little effort. – Alex Chamberlain Sep 26 '13 at 07:20
  • Thanks I'll look again at QEMU but I'd still like to see if anyone has an answer to original question of copying the RPi binaries or setting up a NAS - I appreciate there are other ways to work and lots of opinions on favorites but for us its with a good IDE and not working at the command line and with makefiles. There are now quite a few resources out there on how to setup cross compiling for eclipse on windows and linux PC but I've not found anything for easily solving this problem of libraries not in the cross compiler and it seems is should be simple as the files are there on the RPi. – Skanky Sep 26 '13 at 08:13
  • Have you got anywhere on this problem? If so, please create a self-answer and mark it as such. We're (at least I) am going through the site to try and get the question:answer ratio up. Thanks! – RPiAwesomeness Jan 01 '14 at 16:01
  • 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 '14 at 02:14

1 Answers1

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.

Fred
  • 4,552
  • 18
  • 29