Building for ARM with LDC

Kai Nacke via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Tue Aug 26 10:04:39 PDT 2014


On Tuesday, 26 August 2014 at 11:54:02 UTC, Joakim wrote:
> On Thursday, 14 August 2014 at 01:56:04 UTC, Joakim wrote:
>> On Wednesday, 13 August 2014 at 16:21:28 UTC, Kai Nacke wrote:
>>> Cross-compiling druntime/phobos is possible but untried. You
>>> could try to setup host and target compilers in CMakeList.txt 
>>> or
>>> you could build a small script to compile all .d modules into 
>>> a
>>> library. There is no out-of-the-box solution.
>>> (Currently I build ldc on an ARM box and avoid the cross
>>> compiling scenario.)
>>
>> OK, I figured.  I'll try something similar to what Dan did on 
>> iOS 
>> (http://forum.dlang.org/thread/m2txc2kqxv.fsf@comcast.net), as 
>> he didn't have that native compilation option either.
>
> An update: by simply following in Dan's footsteps for iOS, but 
> with slightly different flags for linux/ARM, I've been able to 
> build an x86 ldc binary and an ARM druntime/phobos in a 
> linux/x86 VM and deploy to a linux/ARM device. :)
>
> I'm able to build the dmd sample program sieve.d for ARMv7 with 
> all three combinations of ldc alone, ldc and druntime, and ldc 
> and phobos, with small modifications to sieve.d for writing 
> output for each case.  The first two combos produce an 
> executable that runs fine on linux/ARM, the one with phobos 
> seems to run and then prints out junk output.
>
> I had to apply the real/long-double pull #643 to get phobos to 
> compile for ARM.  Right now, I push the objects and static 
> libraries to the linux/ARM target and link them using the 
> native linker, as I didn't want to mess with trying to figure 
> out how to get the x86 linker to link for ARM yet.
>
> I'm going to try cross-compiling and running the unit tests 
> next.
>  What should I expect?

I still have trouble with binaries compiled without optimization. 
Using -O1 or higher works.

> I'll try merging David's old patch for ARM exception-handling 
> from issue #489 at some point.

I merged the easy part of the patch so expect some merge 
conflicts.

BTW: sounds real cool!

Regards,
Kai


More information about the digitalmars-d-ldc mailing list