www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Hope =?UTF-8?B?ZOOAgGhhcw==?= great development in Raspberry Pi

reply FrankLike <1150015857 qq.com> writes:
D is very good,I like LDC,but it's not use on Raspberry Pi,I hope 
D will have a great development in Raspberry Pi.
Now,I only work on GDC for  Raspberry Pi.
Will you don't like LDC work on  Raspberry Pi?

Thank you.
Jan 22 2016
next sibling parent Dicebot <public dicebot.lv> writes:
On Friday, 22 January 2016 at 13:53:09 UTC, FrankLike wrote:
 D is very good,I like LDC,but it's not use on Raspberry Pi,I 
 hope D will have a great development in Raspberry Pi.
 Now,I only work on GDC for  Raspberry Pi.
 Will you don't like LDC work on  Raspberry Pi?

 Thank you.
http://archlinuxarm.org has working LDC package AFAIK.
Jan 22 2016
prev sibling next sibling parent reply Kai Nacke <kai redstar.de> writes:
On Friday, 22 January 2016 at 13:53:09 UTC, FrankLike wrote:
 Will you don't like LDC work on  Raspberry Pi?
Hi FrankLike! Please, could you tell us what you are missing? LDC has support for Linux/ARM builtin. You should be able to compile on or cross-compile for the Raspberry Pi. Regards, Kai
Jan 23 2016
parent reply FrankLike <1150015857 qq.com> writes:
On Saturday, 23 January 2016 at 15:58:42 UTC, Kai Nacke wrote:
 Please, could you tell us what you are missing?
 LDC has support for Linux/ARM builtin. You should be able to 
 compile on or cross-compile for the Raspberry Pi.

 Regards,
 Kai
Sorry,I copy the 'ldc2-0.17.0-beta1-linux-x86_64.tar.xz' to Ubuntu 15.10 x64,that downloads from https://github.com/ldc-developers/ldc/releases/download/v0.17.0-beta1/ldc2-0.17.0-beta1-linu -x86_64.tar.xz,read the 'readme',and check the gcc,all is ok,but ldc2 not work,why? Why not make the ldc2-0.17.0-beta1-linux-x86_64.deb ? or 'apt-get install ldc2'? Thank you.
Jan 25 2016
parent reply Konstantinos Margaritis via digitalmars-d-ldc writes:
Στις 25-01-2016, ημέρα Δευ, και ώρα 15:28 +0000, ο/η
FrankLike via
digitalmars-d-ldc έγραψε:
 Sorry,I copy the 'ldc2-0.17.0-beta1-linux-x86_64.tar.xz' to 
 Ubuntu 15.10 x64,that downloads from
 https://github.com/ldc-developers/ldc/releases/download/v0.17.0-beta1
 /ldc2-0.17.0-beta1-linux-x86_64.tar.xz,read the 'readme',and check
 the gcc,all is ok,but ldc2 not work,why?
 
 Why not make the ldc2-0.17.0-beta1-linux-x86_64.deb ? or  
 'apt-get install ldc2'?
 
 Thank you.
Debian ldc2 package will be uploaded soon (actually it's ldc not ldc2). Konstantinos
Jan 25 2016
parent reply FrankLike <1150015857 qq.com> writes:
On Monday, 25 January 2016 at 15:37:17 UTC, Konstantinos 
Margaritis wrote:
 Debian ldc2 package will be uploaded soon (actually it's ldc 
 not ldc2).

 Konstantinos
Good work,thank you very much! Frank
Jan 25 2016
parent reply Dan Olson <gorox comcast.net> writes:
FrankLike <1150015857 qq.com> writes:

 On Monday, 25 January 2016 at 15:37:17 UTC, Konstantinos Margaritis
 wrote:
 Debian ldc2 package will be uploaded soon (actually it's ldc not
 ldc2).

 Konstantinos
Good work,thank you very much! Frank
Do you know how long does it take for Debian packages to be available for Raspbian? The existing package has a useless ldc. Here is the current state of things. I updated my Pi to Jessie, did apt-get ldc which gives: LDC - the LLVM D compiler (0.14.0): based on DMD v2.065 and LLVM 3.5.0 A simple hello world program ends in: _Unwind_RaiseException failed with reason code: -1090604416 Aborted Not too suprising with version 0.14.0. There have been much exception handling improvements since then. -- Dan
Jan 28 2016
next sibling parent reply Dan Olson <gorox comcast.net> writes:
Quick status of LDC on Pi.  I made a build of ldc master on Raspbian
Jessie against LLVM 3.5 available with apt-get.  Everything builds ok,
but there are runtime problems.  Both Fibers and exceptions cause SEGV.

At least now I have a working and up-to-date Pi dev environment.
-- 
Dan
Jan 30 2016
parent reply Dan Olson <gorox comcast.net> writes:
Dan Olson <gorox comcast.net> writes:

 Quick status of LDC on Pi.  I made a build of ldc master on Raspbian
 Jessie against LLVM 3.5 available with apt-get.  Everything builds ok,
 but there are runtime problems.  Both Fibers and exceptions cause SEGV.

 At least now I have a working and up-to-date Pi dev environment.
Ironically, Fibers do work with optimize compile. Something does wrong with -O0, some bad codegen in spots. Simple phobos hello world works, just make sure you give -O to enable optimizer. pi raspberrypi:~ $ cat hellod.d import std.stdio; void main() { writeln("hi"); } pi raspberrypi:~ $ /mnt/usbhd/ldc-dev/build-llvm35/bin/ldc2 -O hellod.d pi raspberrypi:~ $ ./hellod hi pi raspberrypi:~ $ /mnt/usbhd/ldc-dev/build-llvm35/bin/ldc2 -version LDC - the LLVM D compiler (f94c34): based on DMD v2.068.2 and LLVM 3.5.0 Default target: arm-unknown-linux-gnueabihf Host CPU: arm1176jz-s http://dlang.org - http://wiki.dlang.org/LDC Registered Targets: aarch64 - AArch64 (little endian) aarch64_be - AArch64 (big endian) arm - ARM arm64 - AArch64 (little endian) arm64_be - AArch64 (big endian) armeb - ARM (big endian) cpp - C++ backend hexagon - Hexagon mips - Mips mips64 - Mips64 [experimental] mips64el - Mips64el [experimental] mipsel - Mipsel msp430 - MSP430 [experimental] nvptx - NVIDIA PTX 32-bit nvptx64 - NVIDIA PTX 64-bit ppc32 - PowerPC 32 ppc64 - PowerPC 64 ppc64le - PowerPC 64 LE r600 - AMD GPUs HD2XXX-HD6XXX sparc - Sparc sparcv9 - Sparc V9 systemz - SystemZ thumb - Thumb thumbeb - Thumb (big endian) x86 - 32-bit X86: Pentium-Pro and above x86-64 - 64-bit X86: EM64T and AMD64 xcore - XCore
Jan 30 2016
parent reply Dan Olson <gorox comcast.net> writes:
Dan Olson <gorox comcast.net> writes:
 Ironically, Fibers do work with optimize compile.  Something does wrong
 with -O0, some bad codegen in spots.

 Simple phobos hello world works, just make sure you give -O to enable
 optimizer.
Picking away at LDC on arm-linux. I am assuming that very few folks are trying LDC with target arm-unknown-linux-gnueabihf because LLVM really has a problem with simple global variables (__gshared). It is not LDC, but LLVM. The codegen to load a simple global variable is all wrong with optimizer disabled (-O0). // load x into a register ldr r0, .LCPI0_0 ldr r0, [r0] ldr r0, [r0] // what?! an extra load? SEGV! // elsewhere, x is defined as x: .long 0 .LCPI0_0: .long x Clang is ok at -O0. But if I take clang IR output (-emit-llvm) and generate code with llc -O0, it too has extra ldr instruction. Clang must be adding some optimization passes at -O0 that are different than llc -O0. I think LDC uses same passes as llc, so there is the problem. Next, see if LLVM has a bug filed for this and find that extra optimization pass for LDC. -- Dan
Jan 31 2016
next sibling parent Kai Nacke <kai redstar.de> writes:
On Sunday, 31 January 2016 at 22:17:43 UTC, Dan Olson wrote:
 Next, see if LLVM has a bug filed for this and find that extra 
 optimization pass for LDC.
If there is no bug report then it is easy to file one with the given information! Regards, Kai
Feb 01 2016
prev sibling parent reply Joakim <dlang joakim.fea.st> writes:
On Sunday, 31 January 2016 at 22:17:43 UTC, Dan Olson wrote:
 Dan Olson <gorox comcast.net> writes:
 Ironically, Fibers do work with optimize compile.  Something 
 does wrong with -O0, some bad codegen in spots.

 Simple phobos hello world works, just make sure you give -O to 
 enable optimizer.
Picking away at LDC on arm-linux. I am assuming that very few folks are trying LDC with target arm-unknown-linux-gnueabihf because LLVM really has a problem with simple global variables (__gshared). It is not LDC, but LLVM. The codegen to load a simple global variable is all wrong with optimizer disabled (-O0). // load x into a register ldr r0, .LCPI0_0 ldr r0, [r0] ldr r0, [r0] // what?! an extra load? SEGV! // elsewhere, x is defined as x: .long 0 .LCPI0_0: .long x Clang is ok at -O0. But if I take clang IR output (-emit-llvm) and generate code with llc -O0, it too has extra ldr instruction. Clang must be adding some optimization passes at -O0 that are different than llc -O0. I think LDC uses same passes as llc, so there is the problem.
I tried it out a couple summers ago, following in your footsteps with iOS, and Kai and I ran into the same issue, though we didn't look into the codegen like you have: http://forum.dlang.org/post/rdrhocrqfldcanrqxlgz forum.dlang.org I chipped away at it a little, but left it there as I wasn't particularly instructed in linux/ARM, only the much more popular Android/ARM.
 Next, see if LLVM has a bug filed for this and find that extra 
 optimization pass for LDC.
Llvm has a debug option for optimization passes that will dump all the info you could want about which passes are invoked and whether they actually modified the IR: https://github.com/llvm-mirror/llvm/blob/55307987a11d765a4741d319f3ea19b6433263fd/lib/IR/LegacyPassManager.cpp#L51 I've found it invaluable when debugging how optimizations are messing up the ldc-generated IR, by passing --debug-pass=Executions to ldc (should work with clang too) and dumping the extensive output to a log file. There are 2-3 places where optimization passes are called, which are demarcated in the log. That helps separate passes invoked by the frontend from architecture-specific codegen passes.
Feb 01 2016
parent reply Dan Olson <gorox comcast.net> writes:
Joakim <dlang joakim.fea.st> writes:
 I tried it out a couple summers ago, following in your footsteps with
 iOS, and Kai and I ran into the same issue, though we didn't look into
 the codegen like you have:

 http://forum.dlang.org/post/rdrhocrqfldcanrqxlgz forum.dlang.org
I didn't realize the history. That's a long time ago. I never ran into this specific problem because it seems to be unique to gnueabi targets, and only -relocation-model=dynamic-no-pic (the default for arm-linux-gnueabih). The problem is still in LLVM 3.8. I also found using triple thumb-linux-gnueabihf sidesteps this problem. Trying thumb on Pi (armv6) was good because I discovered that druntime is missing thumb support (original, not thumb-2) and am preparing a PR. I still think immediate solution for LDC is to see what clang is doing. We may have some wrong target options. -- Dan
Feb 02 2016
parent reply Dan Olson <gorox comcast.net> writes:
Dan Olson <gorox comcast.net> writes:

 Joakim <dlang joakim.fea.st> writes:
 I tried it out a couple summers ago, following in your footsteps with
 iOS, and Kai and I ran into the same issue, though we didn't look into
 the codegen like you have:

 http://forum.dlang.org/post/rdrhocrqfldcanrqxlgz forum.dlang.org
I didn't realize the history. That's a long time ago. I never ran into this specific problem because it seems to be unique to gnueabi targets, and only -relocation-model=dynamic-no-pic (the default for arm-linux-gnueabih). The problem is still in LLVM 3.8. I also found using triple thumb-linux-gnueabihf sidesteps this problem. Trying thumb on Pi (armv6) was good because I discovered that druntime is missing thumb support (original, not thumb-2) and am preparing a PR. I still think immediate solution for LDC is to see what clang is doing. We may have some wrong target options.
Follow up: -relocation-model=dynamic-no-pic is all wrong. Clang even emits an error if you try to use it on any other OS than darwin. $ clang++ -target arm-linux-gnueabihf -S -c fun.cpp -O0 -mdynamic-no-pic clang: error: unsupported option '-mdynamic-no-pic' for target 'arm--linux-gnueabihf' The source is tools/clang/lib/Driver/Tools.cpp function ParsePICArgs(): if (Arg *A = Args.getLastArg(options::OPT_mdynamic_no_pic)) { // This is a very special mode. It trumps the other modes, almost no one // uses it, and it isn't even valid on any OS but Darwin. if (!ToolChain.getTriple().isOSDarwin()) ToolChain.getDriver().Diag(diag::err_drv_unsupported_opt_for_target) << A->getSpelling() << ToolChain.getTriple().str(); There is a disconnect because llvm chooses dynamic-no-pic as default for all except darwin in lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp. That is really backwards. At least there is an explanation and now a fix. -- Dan
Feb 05 2016
parent David Nadlinger via digitalmars-d-ldc <digitalmars-d-ldc puremagic.com> writes:
On 6 Feb 2016, at 8:01, Dan Olson via digitalmars-d-ldc wrote:
 There is a disconnect because llvm chooses dynamic-no-pic as default 
 for
 all except darwin in lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp.
 That is really backwards.  At least there is an explanation and now a
 fix.
Ah, so that finally makes sense now (well, except that it doesn't). Thanks for the detective work! — David
Feb 06 2016
prev sibling parent reply FrankLike <1150015857 qq.com> writes:
On Thursday, 28 January 2016 at 16:15:59 UTC, Dan Olson wrote:
 Do you know how long does it take for Debian packages to be 
 available for Raspbian?  The existing package has a useless ldc.

 Here is the current state of things.  I updated my Pi to 
 Jessie, did apt-get ldc which gives:

 LDC - the LLVM D compiler (0.14.0):
   based on DMD v2.065 and LLVM 3.5.0

 A simple hello world program ends in:

 _Unwind_RaiseException failed with reason code: -1090604416 
 Aborted

 Not too suprising with version 0.14.0.  There have been much 
 exception handling improvements since then.
GDC is ok. Frank
Feb 02 2016
parent reply Dan Olson <gorox comcast.net> writes:
FrankLike <1150015857 qq.com> writes:
 GDC is ok.

 Frank
Yeah GDC is pretty solid with ARM targets and all sorts of others. Time for LDC to catchup, at least for ARM!
Feb 02 2016
parent reply FrankLike <1150015857 qq.com> writes:
On Tuesday, 2 February 2016 at 17:58:16 UTC, Dan Olson wrote:
 FrankLike <1150015857 qq.com> writes:
 GDC is ok.

 Frank
Yeah GDC is pretty solid with ARM targets and all sorts of others. Time for LDC to catchup, at least for ARM!
http://gdcproject.org/downloads/binaries/5.2.0/arm-linux-gnueabihf/gdc-5.2.0+2.066.1.tar.xz You can use it on Raspbian ,build your d codes ,it's ok. Frank
Feb 04 2016
parent Joakim <dlang joakim.fea.st> writes:
On Thursday, 4 February 2016 at 14:14:05 UTC, FrankLike wrote:
 On Tuesday, 2 February 2016 at 17:58:16 UTC, Dan Olson wrote:
 FrankLike <1150015857 qq.com> writes:
 GDC is ok.

 Frank
Yeah GDC is pretty solid with ARM targets and all sorts of others. Time for LDC to catchup, at least for ARM!
http://gdcproject.org/downloads/binaries/5.2.0/arm-linux-gnueabihf/gdc-5.2.0+2.066.1.tar.xz You can use it on Raspbian ,build your d codes ,it's ok.
I doubt he has much D code, he just likes getting new targets up and running, :) like Kai.
Feb 04 2016
prev sibling parent reply Kai Nacke <kai redstar.de> writes:
On Friday, 22 January 2016 at 13:53:09 UTC, FrankLike wrote:
 D is very good,I like LDC,but it's not use on Raspberry Pi,I 
 hope D will have a great development in Raspberry Pi.
 Now,I only work on GDC for  Raspberry Pi.
 Will you don't like LDC work on  Raspberry Pi?

 Thank you.
LDC build from ltsmaster branch can be used for development on Raspberry Pi boards. E.g. I currently develop a vibe.d application on an ARM based board with LDC. Regards, Kai
Mar 11 2016
parent reply Dan Olson <gorox concast.net> writes:
On Friday, 11 March 2016 at 23:45:59 UTC, Kai Nacke wrote:
 LDC build from ltsmaster branch can be used for development on 
 Raspberry Pi boards. E.g. I currently develop a vibe.d 
 application on an ARM based board with LDC.

 Regards,
 Kai
Can a pre-built binary release be made available?
Mar 11 2016
parent Kai Nacke <kai redstar.de> writes:
On Saturday, 12 March 2016 at 01:21:27 UTC, Dan Olson wrote:
 On Friday, 11 March 2016 at 23:45:59 UTC, Kai Nacke wrote:
 LDC build from ltsmaster branch can be used for development on 
 Raspberry Pi boards. E.g. I currently develop a vibe.d 
 application on an ARM based board with LDC.

 Regards,
 Kai
Can a pre-built binary release be made available?
Yes. I was thinking about dropping the *.gz binaries and instead producing a binary for ARM. Regards, Kai
Mar 12 2016