Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 80 - socket.d - static assert unimplemented or raspberry pi
Summary: socket.d - static assert unimplemented or raspberry pi
Status: RESOLVED FIXED
Alias: None
Product: GDC
Classification: Unclassified
Component: libgdruntime (show other bugs)
Version: 4.8.x
Hardware: ARM Linux
: --- blocker
Assignee: Johannes Pfau
URL:
Depends on:
Blocks:
 
Reported: 2013-10-12 10:41 CEST by King_DuckZ
Modified: 2014-01-12 10:51 CET (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description King_DuckZ 2013-10-12 10:41:40 CEST
Following the wiki page for building gdc on raspberry pi, I configured it with:
../gcc-4.8.1/configure --with-bugurl="http://gdcproject.org/bugzilla" --enable-languages=d --prefix=/opt/gdc --enable-shared --enable-linker-build-id ---enable-threads=posix --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-sjlj-exceptionat=hard --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --enable-checking=release

After a couple of days of building, I get the following error:

/home/michele/dev/gdc_compiler/objdir/./gcc/gdc -B/home/michele/dev/gdc_compiler/objdir/./gcc/ -B/opt/gdc/arm-linux-gnueabihf/bin/ -B/opt/gdc/arm-linux-gnueabihf/lib/ -isystem /opt/gdc/arm-linux-gnueabihf/include -isystem /opt/gdc/arm-linux-gnueabihf/sys-include -o core/sys/posix/netdb.o -Wall -g -frelease -O2 -nostdinc -pipe -Wno-deprecated -I ../../../../gcc-4.8.1/libphobos/libdruntime -I ./arm-linux-gnueabihf -I .  -c ../../../../gcc-4.8.1/libphobos/libdruntime/core/sys/posix/netdb.d
/home/michele/dev/gdc_compiler/gcc-4.8.1/libphobos/libdruntime/core/sys/posix/sys/socket.d:314: Error: static assert  "unimplemented"
make[4]: *** [core/sys/posix/netdb.o] Errore 1
make[4]: Leaving directory `/home/michele/dev/gdc_compiler/objdir/arm-linux-gnueabihf/libphobos/libdruntime'
make[3]: *** [all-recursive] Errore 1

I'm using a model b raspberry pi with 512MiB ram, with up-to-date ArchLinux, gcc 4.7.2.
Comment 1 Stefan Frijters 2013-10-13 10:26:33 CEST
Heh, I was just going to file the exact same bug. I'm building on Raspbian, but otherwise the config is the same. I took a look at the file and it looks like commit 1dc4fd3 to druntime will fix this[1] when 2.0.64 is released and merged into GDC. I'm going to try and continue the build process with that version of socket.d and see where I get.

[1] https://github.com/D-Programming-Language/druntime/commit/1dc4fd3ba737a04839ecb178f11fbeea5509c0ce#diff-d166081dc3be2fcc23df34657359023c
Comment 2 Stefan Frijters 2013-10-13 11:53:29 CEST
(In reply to comment #1)
> Heh, I was just going to file the exact same bug. I'm building on Raspbian, but
> otherwise the config is the same. I took a look at the file and it looks like
> commit 1dc4fd3 to druntime will fix this[1] when 2.0.64 is released and merged
> into GDC. I'm going to try and continue the build process with that version of
> socket.d and see where I get.
> 
> [1]
> https://github.com/D-Programming-Language/druntime/commit/1dc4fd3ba737a04839ecb178f11fbeea5509c0ce#diff-d166081dc3be2fcc23df34657359023c

Ok, I investigated a bit further and a bunch of similar issues come up that are all fixed by copying from current druntime (explicit architecture checks were added some time ago, before the last frontend merge, but version(ARM) was added later). In particular, I had to update / add the following files:

core/sys/posix/sys/socket.d
core/sys/posix/signal.d
core/sys/posix/sys/stat.d
core/sys/posix/ucontext.d
core/sys/posix/sys/mman.d
core/sys/linux/sys/mman.d (new file, needs to be symlinked manually)
core/sys/linux/config.d
core/sys/posix/confid.d (not sure if either of these two config.d is enough).

So far the good news - easy to fix manually and will be fixed 'automatically' at the next frondend merge. But now I've run into an error beyond my meagre powers to fix:

/home/pi/objdir/./gcc/gdc -B/home/pi/objdir/./gcc/ -B/usr/local/stow/gdc-4.8.1/arm-linux-gnueabihf/bin/ -B/usr/local/stow/gdc-4.8.1/arm-linux-gnueabihf/lib/ -isystem /usr/local/stow/gdc-4.8.1/arm-linux-gnueabihf/include -isystem /usr/local/stow/gdc-4.8.1/arm-linux-gnueabihf/sys-include -o gcc/deh.o -Wall -g -frelease -O2 -nostdinc -pipe -Wno-deprecated -I ../../../../gcc-4.8.1/libphobos/libdruntime -I ./arm-linux-gnueabihf -I .  -c ../../../../gcc-4.8.1/libphobos/libdruntime/gcc/deh.d
../../../../gcc-4.8.1/libphobos/libdruntime/gcc/deh.d:116: error: static assert  (8u == 4u) is false
make[4]: *** [gcc/deh.o] Error 1
make[4]: Leaving directory `/home/pi/objdir/arm-linux-gnueabihf/libphobos/libdruntime'

Should I file a separate bug report for this?
Comment 3 Johannes Pfau 2013-10-13 13:19:24 CEST
I have fixes for most of those issues available here:
https://github.com/jpf91/GDC/tree/arm

I wanted to merge this into GDC as soon as the test suite is passing. Unfortunately there's some hard to track down codegen bug which only appears when using -O2 and I couldn't fix it yet.
Comment 4 Stefan Frijters 2013-10-14 07:32:31 CEST
Thanks, didn't know about that fork. Just wanted to report that I did another round of building overnight, now based on your fork / arm branch, and the build process completed without any errors or needed hacks.
Comment 5 Johannes Pfau 2014-01-12 10:51:40 CET
The 2.064 merge should have fixed this specific issue.

Druntime & Phobos should compile for ARM with upstream gdc. There are some small runtime issues left which are only fixed in my branch, but those are different issues and the fixes will be merged back soon anyway.