Is it possible to install cross compiler on Raspbian? I mean arm-linux-gcc. I would like to try compile cross platform project on Raspbian instead of on virtual machine with Ubuntu.

  • I can't think of any obvious technical reason why one could not compile a cross compiler and run it on Raspbian ... but I think you will be dissapointed by the results. Compilers are heavy users of the file system. They read and write files multiple times as we go fro source to assembler to object code and more. I/O operations on the PI using a micro SD card must be be a lot slower than corresponding I/O operations on a PC hard disk. – Kolban Jul 22 '16 at 13:05
  • @Kolban That's irrelevant. The bottleneck when compiling is almost always (including, or especially, in this case) the CPU; compiling is a CPU intensive activity, not an I/O intensive activity. "They read and write files multiple times..." -> Yes, in relatively small volumes. E.g. It might take upwards of an hour (perhaps, several) to compile a hundred MB or so worth of kernel and modules on a Pi 2. To copy the same volume back and forth to the SD card would take less than 1 minute, even with a slow card. – goldilocks Jul 22 '16 at 13:59

Is it possible to install cross compiler on rasbian? I mean arm-linux-gcc.

This does not make sense, particularly if you are using an ARMv7 Ubuntu distro.

"Cross-compiling" refers to compiling for one architecture (such as ARMv7) on a platform with a different architecture (such as x86-64, which is probably what your normal computer is).

If you want to compile code for a given platform on that platform, you are not cross-compiling, you are just compiling.

The arm-linux-gcc cross-compiler available on most mainstream linux distros targets ARMv7. However, if you are running on an ARMv7 platform already, all you need is the normal compiler. In other words:

apt install gcc

You now have an ARMv7 compiler installed. If you wish to compile code for the pi on the pi, that's what you should use, just the same as you would normally anywhere else.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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