D on AArch64 CPU

Richard Delorme via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 14 08:05:08 PDT 2017


I recently bought the infamous Raspberry pi 3, which has got a 
cortex-a53 4 cores 1.2 Ghz CPU (Broadcom). After installing on it 
a 64 bit OS (a non official fedora 25), I was wondering if it was 
possible to install a D compiler on it.

I first try LDC 0.17.4
After modifying some phobos/runtime file to fake support of IEEE 
Quadruple precision floating point number available on this CPU, 
I got a compiler..
$ ldc2 --version
LDC - the LLVM D compiler (0.17.4):
   based on DMD v2.068.2 and LLVM 3.9.1
   Default target: aarch64-unknown-linux-gnu
   Host CPU: (unknown)
   http://dlang.org - http://wiki.dlang.org/LDC
[...]

I then try LDC 1.2.0, but fail to compile it. Whatever if I use 
clang (3.9) or gcc (6.3), the compilation stopped at some time, 
probably because of the lack of memory of the pi 3 (1 GB).

I finally try GDC, on 6.3 gcc, and with support of version 2.68 
of the D language. After struggling a little on a few 
phobos/druntime files, I got a compiler here too:
$ gdc --version
gdc (GCC) 6.3.0
Copyright © 2016 Free Software Foundation, Inc.

Unfortunately both are unable to compile the following program:
//-----8<--------------------
import std.conv, std.stdio;

void main() {
	double pi = to!double("3.1415926");
	writeln("pi = ", pi);
}
//-----8<--------------------
opt/ldc-0.17.4/include/d/std/conv.d(295): Error: template 
std.conv.toImpl cannot deduce function from argument types 
!(double)(string), candidates are:
/opt/ldc-0.17.4/include/d/std/conv.d(361):        
std.conv.toImpl(T, S)(S value) if (isImplicitlyConvertible!(S, T) 
&& !isEnumStrToStr!(S, T) && !isNullToStr!(S, T))
/opt/ldc-0.17.4/include/d/std/conv.d(475):        
std.conv.toImpl(T, S)(ref S s) if (isRawStaticArray!S)
/opt/ldc-0.17.4/include/d/std/conv.d(491):        
std.conv.toImpl(T, S)(S value) if (!isImplicitlyConvertible!(S, 
T) && is(typeof(S.init.opCast!T()) : T) && !isExactSomeString!T 
&& !is(typeof(T(value))))
/opt/ldc-0.17.4/include/d/std/conv.d(542):        
std.conv.toImpl(T, S)(S value) if (!isImplicitlyConvertible!(S, 
T) && is(T == struct) && is(typeof(T(value))))
/opt/ldc-0.17.4/include/d/std/conv.d(591):        
std.conv.toImpl(T, S)(S value) if (!isImplicitlyConvertible!(S, 
T) && is(T == class) && is(typeof(new T(value))))
/opt/ldc-0.17.4/include/d/std/conv.d(295):        ... (9 more, -v 
to show) ...
bug.d(4): Error: template instance std.conv.to!double.to!(string) 
error instantiating

and same for gdc:
/opt/gdc/lib/gcc/aarch64-unknown-linux-gnu/6.3.0/include/d/std/conv.d:295:24: erreur : template std.conv.toImpl cannot deduce function from argument types !(double)(string), candidates are:
          return toImpl!T(args);
                         ^
/opt/gdc/lib/gcc/aarch64-unknown-linux-gnu/6.3.0/include/d/std/conv.d:361:3: note : std.conv.toImpl(T, S)(S value) if (isImplicitlyConvertible!(S, T) && !isEnumStrToStr!(S, T) && !isNullToStr!(S, T))
  T toImpl(T, S)(S value)
    ^
/opt/gdc/lib/gcc/aarch64-unknown-linux-gnu/6.3.0/include/d/std/conv.d:475:3: note : std.conv.toImpl(T, S)(ref S s) if (isRawStaticArray!S)
  T toImpl(T, S)(ref S s)
    ^
/opt/gdc/lib/gcc/aarch64-unknown-linux-gnu/6.3.0/include/d/std/conv.d:491:3: note : std.conv.toImpl(T, S)(S value) if (!isImplicitlyConvertible!(S, T) && is(typeof(S.init.opCast!T()) : T) && !isExactSomeString!T && !is(typeof(T(value))))
  T toImpl(T, S)(S value)
    ^
/opt/gdc/lib/gcc/aarch64-unknown-linux-gnu/6.3.0/include/d/std/conv.d:542:3: note : std.conv.toImpl(T, S)(S value) if (!isImplicitlyConvertible!(S, T) && is(T == struct) && is(typeof(T(value))))
  T toImpl(T, S)(S value)
    ^
/opt/gdc/lib/gcc/aarch64-unknown-linux-gnu/6.3.0/include/d/std/conv.d:591:3: note : std.conv.toImpl(T, S)(S value) if (!isImplicitlyConvertible!(S, T) && is(T == class) && is(typeof(new T(value))))
  T toImpl(T, S)(S value)
    ^
/opt/gdc/lib/gcc/aarch64-unknown-linux-gnu/6.3.0/include/d/std/conv.d:295:24: note : ... (9 more, -v to show) ...
          return toImpl!T(args);
                         ^
bug.d:4:23: erreur : template instance 
std.conv.to!double.to!(string) error instantiating
   double pi = to!double("3.1415926");

I did not touch at std.conv nor std.stdio. On LDC, the only 
modification concerned math.d and gamma, missing support for 
128-bit floating points.



More information about the Digitalmars-d-learn mailing list