www.digitalmars.com         C & C++   DMDScript  

D.gnu - Inquiring about cross compilation

reply "Ken Burgett via D.gnu" <d.gnu puremagic.com> writes:
I am looking at doing a D project and have installed the DMD compiler on my
64-bit Ubuntu dev system.  My target architecture to ARM, as used in the
Raspberry PI and other systems.  I need to know how I can develop code on
Linux x86 and run it on the RPI.  Any pointer to an article about this
topic is appreciated.

-- 
Regards,

Ken

Seek wisdom through disbelief
Feb 27 2016
parent reply Adrian Matoga <dlang.spam matoga.info> writes:
On Saturday, 27 February 2016 at 16:27:31 UTC, Ken Burgett wrote:
 I am looking at doing a D project and have installed the DMD 
 compiler on my 64-bit Ubuntu dev system.  My target 
 architecture to ARM, as used in the Raspberry PI and other 
 systems.  I need to know how I can develop code on Linux x86 
 and run it on the RPI.  Any pointer to an article about this 
 topic is appreciated.
Download x86_64-linux-gnu toolchain targeting arm-linux-gnueabihf from [1] (its the second row). For Raspberry Pi it works out of the box, try: $ /opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gdc hello.d -o hello $ file hello hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped To build with dub, you need to pass the --compiler flag, e.g. $ dub build --compiler=/opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gdc This can even build vibe.d apps for RPi, provided that you have all target .so files (AFAIK these are libevent, libevent_pthread, libssl and libcrypto). qemu-arm-static can execute statically linked ARM linux apps right on your PC. You can also build for bare metal ARM (even Cortex-M) with the same toolchain if you pass correct flags. See [2]. [1] http://gdcproject.org/downloads [2] http://wiki.dlang.org/Minimal_semihosted_ARM_Cortex-M_"Hello_World"
Feb 29 2016
next sibling parent "Iain Buclaw via D.gnu" <d.gnu puremagic.com> writes:
On 29 February 2016 at 09:35, Adrian Matoga via D.gnu <d.gnu puremagic.com>
wrote:

 On Saturday, 27 February 2016 at 16:27:31 UTC, Ken Burgett wrote:

 I am looking at doing a D project and have installed the DMD compiler on
 my 64-bit Ubuntu dev system.  My target architecture to ARM, as used in the
 Raspberry PI and other systems.  I need to know how I can develop code on
 Linux x86 and run it on the RPI.  Any pointer to an article about this
 topic is appreciated.
Download x86_64-linux-gnu toolchain targeting arm-linux-gnueabihf from [1] (its the second row). For Raspberry Pi it works out of the box, try: $ /opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gdc hello.d -o hello $ file hello hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped To build with dub, you need to pass the --compiler flag, e.g. $ dub build --compiler=/opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gdc This can even build vibe.d apps for RPi, provided that you have all target .so files (AFAIK these are libevent, libevent_pthread, libssl and libcrypto). qemu-arm-static can execute statically linked ARM linux apps right on your PC.
I totally forgot about this nice little feature of qemu. I have this in my old-old list of bookmarked lists for setting up a Raspbian qemu-chroot. https://superpiadventures.wordpress.com/ You can of course replace it with any derivative of Debian that supports RPI. Thanks!
Feb 29 2016
prev sibling parent Johannes Pfau <nospam example.com> writes:
Am Mon, 29 Feb 2016 08:35:52 +0000
schrieb Adrian Matoga <dlang.spam matoga.info>:

 $ dub build 
 --compiler=/opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gdc
 
 This can even build vibe.d apps for RPi, provided that you have 
 all target .so files (AFAIK these are libevent, libevent_pthread, 
 libssl and libcrypto).
It's also possible to access the libraries from a running RPi using sshfs: http://wiki.dlang.org/GDC/Cross_Compiler/Existing_Sysroot
Feb 29 2016