2

Is it possible to compile a Package on ARMv8 and run it on ARMv7 ?

I am not really experienced in the whole building thing (yet). I came to this question because my Odroid C1+ fails to compile icinga2 due to the very limited RAM. The C2 has 2 GB of RAM and will do probably better at this task.

But can I run a C2 (ARMv8) compiled package on my C1+ (ARMv7)?

Marcus Müller
  • 34,677
  • 4
  • 53
  • 94

1 Answers1

3

Is it possible to compile a Package on ARMv8 and run it on ARMv7 ?

That's called cross-compiling and is the usual way how ARM code is generated – only that most build machines for ARM binaries are probably x86_64 nowadays. But if you have a compiler that targets platform ARMv7 running on ARMv8, I don't see a problem.

I am not really experienced in the whole building thing (yet). I came to this question because my Odroid C1+ fails to compile icinga2 due to the very limited RAM. The C2 has 2 GB of RAM and will do probably better at this task.

You know what is much much better at compiling? A proper PC with more than 4GB of RAM, massive RAM bandwidth and a much higher storage bandwidth, with a heavily pipelined multicore CISC CPU rather than an energy-efficient ARM.

Really, software for embedded systems is usually built on non-embedded computers with cross-compilers. There's definitely different ways to cross-compile something for your C1+ on your PC; I'd generally recommend using the method your Linux distro (if you're using any) has for cross-compiling packages.

ARMv7 is a different platform from ARMv8, so compiling software from ARMv7 on v8 has no advantage over compiling software for ARMv7 on x86. You'll need a cross-compiling toolchain, anyway.

Marcus Müller
  • 34,677
  • 4
  • 53
  • 94
  • Oh well, with that being said... I will go learn cross compiling. Thank you very much for your informative answer! :) – Andrew Summer May 07 '16 at 22:48
  • "compiling software from ARMv7 on v8 has no advantage over compiling software for ARMv7 on x86" - no, it absolutely does, because with a sensible distro you should be able to just run a 32-bit compiler natively and use multilib. Would you equally say "compiling software from i386 has on x86_64 has no advantage over compiling software for i386 on POWER8"? After all, those run rings around a "proper PC" :P – Notlikethat May 07 '16 at 23:02
  • 1
    @Notlikethat exactly what you say. If you can chose between a 4GHz Power8 computer and a 400 MHz pentium II to compile software for your Intel 386SX, there's barely a reason to use the Pentium machine, though their architecture is so much more similar. Compilation needs absolutely no native code execution capabilities whatsoever! – Marcus Müller May 07 '16 at 23:08
  • It's a fair point in terms of raw performance; in terms of ease of use, though, given how resistant to cross-compilation I've found some projects to be (perf tools for example), the ability to simply mount the 32-bit filesystem on the 64-bit machine, chroot into it and run the 32-bit toolchain natively is highly valuable. – Notlikethat May 07 '16 at 23:37
  • @Notlikethat anything special about linux-tools (the source package that perf typically comes in) ? I've seen people build that for ARMv7; iirc, OpenEmbedded/Yocto has a working layer for that... – Marcus Müller May 07 '16 at 23:59