Thread overview
Cross build for RPi2(3)
Jun 07, 2017
Oleg B
Jun 07, 2017
Joakim
Jun 07, 2017
Oleg B
Jun 07, 2017
Joakim
June 07, 2017
Hi, how I can build my project for RPi2 or 3 (armv7, armv8)?

By default ldc2-1.3.0-beta1 has no arm targets.

LDC - the LLVM D compiler (1.3.0-beta1):
  based on DMD v2.073.2 and LLVM 4.0.0
  built with LDC - the LLVM D compiler (1.3.0-beta1)
  Default target: x86_64-unknown-linux-gnu
  Host CPU: skylake
  http://dlang.org - http://wiki.dlang.org/LDC

  Registered Targets:
    x86    - 32-bit X86: Pentium-Pro and above
    x86-64 - 64-bit X86: EM64T and AMD64

Where I can get prebuilded ldc2 with arm target or ldc2 for host arm?
And if I found ldc2 with arm target how to build for it's target?
I need gcc and libs for arm, right?
June 07, 2017
On Wednesday, 7 June 2017 at 18:20:11 UTC, Oleg B wrote:
> Hi, how I can build my project for RPi2 or 3 (armv7, armv8)?

You could build on the device itself, using the native ARM compiler here:

https://github.com/ldc-developers/ldc/releases/tag/v1.1.0

> By default ldc2-1.3.0-beta1 has no arm targets.
>
> LDC - the LLVM D compiler (1.3.0-beta1):
>   based on DMD v2.073.2 and LLVM 4.0.0
>   built with LDC - the LLVM D compiler (1.3.0-beta1)
>   Default target: x86_64-unknown-linux-gnu
>   Host CPU: skylake
>   http://dlang.org - http://wiki.dlang.org/LDC
>
>   Registered Targets:
>     x86    - 32-bit X86: Pentium-Pro and above
>     x86-64 - 64-bit X86: EM64T and AMD64
>
> Where I can get prebuilded ldc2 with arm target or ldc2 for host arm?

You'd have to build the former yourself, the latter is linked above.

> And if I found ldc2 with arm target how to build for it's target?

Depends how it's configured and packaged, but supplying the right llvm triple is usually what it takes.  See how it's done for Android (llvm triple not needed because llvm is built with it above):

https://wiki.dlang.org/Build_LDC_for_Android#Build_a_command-line_executable

> I need gcc and libs for arm, right?

Yes, you need those, depending on what you're trying to do.
June 07, 2017
Thank you, Joakim!

You know why is still no out-of-box solution? Why patches of ldc, phobos and druntime needed for android/arm compilation?


June 07, 2017
On Wednesday, 7 June 2017 at 21:52:50 UTC, Oleg B wrote:
> Thank you, Joakim!
>
> You know why is still no out-of-box solution? Why patches of ldc, phobos and druntime needed for android/arm compilation?

ldc doesn't require any patching, it just patches the CMake config for druntime and phobos that comes in the ldc repo.  As for the rest, still some small tweaks that need to be upstreamed, detailed here:

https://github.com/joakim-noah/android/releases

It is pretty easy to build an ldc cross-compiler from source, but it still requires a little patching, going to submit a pull for that soon.  However, that's just from source, making it possible to cross-compile a stdlib using the pre-built compiler is another challenge.