www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - LDC cross compilation wiki

reply Andre Pany <andre s-e-a-p.de> writes:
Hi,
While searching for LDC and cross compile, google shows as first 
hit https://wiki.dlang.org/LDC_cross-compilation_for_ARM_GNU/Linux
Which is perfect.

I just wonder whether the details are still valid:
Llvm 3.8.0
LDC 1.0
ARM patch needed?

Could someone with knowledge on this topic have a look?

Kind regards
André
Aug 07 2017
parent reply Joakim <dlang joakim.fea.st> writes:
On Monday, 7 August 2017 at 13:34:09 UTC, Andre Pany wrote:
 Hi,
 While searching for LDC and cross compile, google shows as 
 first hit 
 https://wiki.dlang.org/LDC_cross-compilation_for_ARM_GNU/Linux
 Which is perfect.

 I just wonder whether the details are still valid:
 Llvm 3.8.0
 LDC 1.0
 ARM patch needed?

 Could someone with knowledge on this topic have a look?
No, it's outdated and shouldn't be followed. The next ldc 1.4 beta will support cross-compiling the stdlib for arbitrary platforms, provided the requisite llvm CPU backend is included: https://github.com/ldc-developers/ldc/pull/2253 I'm going to submit a PR so that all the flags there can be boiled down to two options, OS and arch, for platforms that we support. You'll still be able to override anything with custom flags or configure it yourself for unsupported platforms. We'll add some docs for all this on the wiki when it's done, and redirect this page to those new instructions.
Aug 07 2017
parent reply Andre Pany <andre s-e-a-p.de> writes:
On Monday, 7 August 2017 at 15:49:02 UTC, Joakim wrote:
 On Monday, 7 August 2017 at 13:34:09 UTC, Andre Pany wrote:
 Hi,
 While searching for LDC and cross compile, google shows as 
 first hit 
 https://wiki.dlang.org/LDC_cross-compilation_for_ARM_GNU/Linux
 Which is perfect.

 I just wonder whether the details are still valid:
 Llvm 3.8.0
 LDC 1.0
 ARM patch needed?

 Could someone with knowledge on this topic have a look?
No, it's outdated and shouldn't be followed. The next ldc 1.4 beta will support cross-compiling the stdlib for arbitrary platforms, provided the requisite llvm CPU backend is included: https://github.com/ldc-developers/ldc/pull/2253 I'm going to submit a PR so that all the flags there can be boiled down to two options, OS and arch, for platforms that we support. You'll still be able to override anything with custom flags or configure it yourself for unsupported platforms. We'll add some docs for all this on the wiki when it's done, and redirect this page to those new instructions.
I would try to use the ldc-build-runtime tool to cross compile to my Raspberry Pi (From Windows). But by reading this wiki page "https://wiki.dlang.org/Building_LDC_runtime_libraries" it is not clear for me what to do. What is already working: Executing this command seems to finish without error: C:\D\ldc2-1.4.0-beta1-win32-msvc\bin>ldc-build-runtime --ldcSrcDir "ldc-1.4.0-beta1-src" --ninja But I think I have to call this command with specific parameters for the Raspberry Pi. Where do I find this parameters? Kind regards André
Sep 09 2017
parent reply Joakim <dlang joakim.fea.st> writes:
On Saturday, 9 September 2017 at 12:16:58 UTC, Andre Pany wrote:
 On Monday, 7 August 2017 at 15:49:02 UTC, Joakim wrote:
 On Monday, 7 August 2017 at 13:34:09 UTC, Andre Pany wrote:
 Hi,
 While searching for LDC and cross compile, google shows as 
 first hit 
 https://wiki.dlang.org/LDC_cross-compilation_for_ARM_GNU/Linux
 Which is perfect.

 I just wonder whether the details are still valid:
 Llvm 3.8.0
 LDC 1.0
 ARM patch needed?

 Could someone with knowledge on this topic have a look?
No, it's outdated and shouldn't be followed. The next ldc 1.4 beta will support cross-compiling the stdlib for arbitrary platforms, provided the requisite llvm CPU backend is included: https://github.com/ldc-developers/ldc/pull/2253 I'm going to submit a PR so that all the flags there can be boiled down to two options, OS and arch, for platforms that we support. You'll still be able to override anything with custom flags or configure it yourself for unsupported platforms. We'll add some docs for all this on the wiki when it's done, and redirect this page to those new instructions.
I would try to use the ldc-build-runtime tool to cross compile to my Raspberry Pi (From Windows). But by reading this wiki page "https://wiki.dlang.org/Building_LDC_runtime_libraries" it is not clear for me what to do. What is already working: Executing this command seems to finish without error: C:\D\ldc2-1.4.0-beta1-win32-msvc\bin>ldc-build-runtime --ldcSrcDir "ldc-1.4.0-beta1-src" --ninja But I think I have to call this command with specific parameters for the Raspberry Pi. Where do I find this parameters? Kind regards André
There are tutorials like this that seem to have some info: http://gnutoolchains.com/raspberry/tutorial/ I've never used the RPi so I don't know what toolchains are out there. You need a C toolchain for the RPi, then you specify the C compiler using CC, and the flags they tell you to use for compiling and linking get passed to ldc-build-runtime. Hopefully, we'll eventually have a preset configuration for some popular RPi toolchain, but someone will have to submit a pull for that once my pull to keep a bunch of preset configurations for common platforms is in: https://github.com/ldc-developers/ldc/pull/2301
Sep 09 2017
next sibling parent Andre Pany <andre s-e-a-p.de> writes:
On Saturday, 9 September 2017 at 19:27:38 UTC, Joakim wrote:
 There are tutorials like this that seem to have some info:

 http://gnutoolchains.com/raspberry/tutorial/

 I've never used the RPi so I don't know what toolchains are out 
 there.  You need a C toolchain for the RPi, then you specify 
 the C compiler using CC, and the flags they tell you to use for 
 compiling and linking get passed to ldc-build-runtime.

 Hopefully, we'll eventually have a preset configuration for 
 some popular RPi toolchain, but someone will have to submit a 
 pull for that once my pull to keep a bunch of preset 
 configurations for common platforms is in:

 https://github.com/ldc-developers/ldc/pull/2301
Thanks, I am still trying to get it running but no success so far. Visual Studio 14: There is a batch file "vcvarsall.bat" which can be called with parameter x86_arm. While executing ldc-build-runtime there is an error from Visual Studio that desktop app cannot be build for architecture ARM. Next I tried GCC from your link. If I understand the error log correctly, CMake tries to create a windows executable using the cross compiler for linux/arm. I created an issue for this https://github.com/ldc-developers/ldc/issues/2322. Kind regards André
Sep 10 2017
prev sibling parent Andre Pany <andre s-e-a-p.de> writes:
On Saturday, 9 September 2017 at 19:27:38 UTC, Joakim wrote:
 On Saturday, 9 September 2017 at 12:16:58 UTC, Andre Pany wrote:
 [...]
There are tutorials like this that seem to have some info: http://gnutoolchains.com/raspberry/tutorial/ I've never used the RPi so I don't know what toolchains are out there. You need a C toolchain for the RPi, then you specify the C compiler using CC, and the flags they tell you to use for compiling and linking get passed to ldc-build-runtime. Hopefully, we'll eventually have a preset configuration for some popular RPi toolchain, but someone will have to submit a pull for that once my pull to keep a bunch of preset configurations for common platforms is in: https://github.com/ldc-developers/ldc/pull/2301
With the toolchain mentioned by you and the help of kinke I got it working. Cross compiling from Windows to Raspberry Pi looks quite promising. I still waiting on the testrunner results, to validate wheter it is working 100%. Kind regards André
Sep 11 2017