How to build a set of toolchains for cross-compiling for LDC?

Kai Nacke via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Tue Jul 14 09:38:50 PDT 2015


On Tuesday, 14 July 2015 at 12:26:53 UTC, Majestio wrote:
> Hi,Kai!
>
> On Sunday, 28 June 2015 at 18:14:13 UTC, Kai Nacke wrote:
>> I described cross-compiling for AArch64 here: 
>> http://forum.dlang.org/post/fhwvxatxezkafnalwhqr@forum.dlang.org
>
> I did as you wrote. But the problem with linking.
>

> What can be done?

Hi Majestio!

First, your link command is definitively incomplete.
At least libc and libpthread are missing. You are using ld so I 
miss the crt*.o files, too. I would recommend to use the 
cross-gcc for linking.

Symptons for this are:
> hello_d.obj:(.text[_main]+0x7): undefined reference to `__main'
> hello_d.obj:(.text[__D3std5stdio16__T7writelnTAyaZ7writelnFAyaZv]+0x3a): undefined reference to `__mingw_fprintf'

These are symbols from the MingW C library.

BTW: Can you cross-compile a C hello world without problems?

Did you compile druntime and phobos for the mingw target? If yes 
where did you place the libraries?

The other missing symbols are from druntime and phobos. This 
indicates that these libraries are not found. Did you also 
cross-compile the curl library?

You can use the -v command line option with ldc2 to see the call 
to gcc. This is useful for debugging.

Regards,
Kai



More information about the digitalmars-d-ldc mailing list