I've been wanting to put together a programming to teach D. The raspberry pi seemed like a good computer to use so everyone could be guaranteed to have a computer to practice on. I've had some trouble, however, getting a test project to compile, and the first culprit lives in std.format.
I tried both LDC and GDC by using `sudo apt install ldc` and `sudo apt install gdc`
compiling my test file with ldc gives these errors
/usr/lib/ldc/arm-linux-gnueabihf/include/d/std/format.d(620): Error: can only * a pointer, not a 'int'
/usr/lib/ldc/arm-linux-gnueabihf/include/d/std/format.d(631): Error: can only * a pointer, not a 'int'
/usr/lib/ldc/arm-linux-gnueabihf/include/d/std/format.d(620): Error: using * on an array is no longer supported; use *(_param_2).ptr instead
/usr/lib/ldc/arm-linux-gnueabihf/include/d/std/format.d(631): Error: using * on an array is no longer supported; use *(_param_2).ptr instead
/usr/lib/ldc/arm-linux-gnueabihf/include/d/std/format.d(633): Error: template instance std.format.formattedRead!(char[], char, string) error instantiating
diceware.d(26): instantiated from here: formattedRead!(char[], char, int, string)
diceware.d(39): Error: template std.format.formattedRead cannot deduce function from argument types !()(string, string, int), candidates are:
/usr/lib/ldc/arm-linux-gnueabihf/include/d/std/format.d(588): std.format.formattedRead(R, Char, S...)(ref R r, const(Char)[] fmt, S args)
compiling with gdc gives these errors:
/usr/lib/gcc/arm-linux-gnueabihf/6/include/d/std/format.d:618:26: error: can only * a pointer, not a 'int'
alias A = typeof(*args[0]);
^
/usr/lib/gcc/arm-linux-gnueabihf/6/include/d/std/format.d:629:13: error: can only * a pointer, not a 'int'
*args[0] = unformatValue!(A)(r, spec);
^
/usr/lib/gcc/arm-linux-gnueabihf/6/include/d/std/format.d:618:26: error: using * on an array is no longer supported; use *(_param_2).ptr instead
alias A = typeof(*args[0]);
^
/usr/lib/gcc/arm-linux-gnueabihf/6/include/d/std/format.d:629:13: error: using * on an array is no longer supported; use *(_param_2).ptr instead
*args[0] = unformatValue!(A)(r, spec);
^
/usr/lib/gcc/arm-linux-gnueabihf/6/include/d/std/format.d:631:33: error: template instance std.format.formattedRead!(char[], char, string) error instantiating
return 1 + formattedRead(r, spec.trailing, args[1 .. $]);
^
/home/pi/diceware/diceware.d:26:22: note: instantiated from here: formattedRead!(char[], char, int, string)
formattedRead(line, "%d\t%s", dummy, word);
^
/home/pi/diceware/diceware.d:39:18: error: template std.format.formattedRead cannot deduce function from argument types !()(string, string, int), candidates are:
formattedRead(readln.strip, "%d", num_words);
^
/usr/lib/gcc/arm-linux-gnueabihf/6/include/d/std/format.d:586:6: note: std.format.formattedRead(R, Char, S...)(ref R r, const(Char)[] fmt, S args)
uint formattedRead(R, Char, S...)(ref R r, const(Char)[] fmt, S args)
You can find my test file and a text file that makes the program work at https://github.com/d-us-vb/diceware. It compiles without warning on my (x86) laptop.
Looking at format.d on the RPi and on my laptop, I noticed that the desktop version of phobos doesn't have those places of trying to dereference an array element, so I tried replacing format.d on my raspberry pi with the format.d I have on my laptop. This produced some other errors, which I won't bother posting yet.
What can I do to fix this and get the most recent version of phobos that will compile?
|