On Fri, Jan 22, 2021 at 12:59:34PM +0100, Iain Buclaw wrote: > > (mipsel-chroot)$ printf 'import std.stdio;\nvoid main() { writeln("Hello, > > World!"); }\n' > hello.d ; gdc hello.d && ./a.out > > qemu: uncaught target signal 11 (Segmentation fault) - core dumped > > Segmentation fault > > > > This is with host running Buster with qemu-user 1:5.2+dfsg-3~bpo10+1 > > but the other not-too-complicated D programs fail on Debian buildd > > infrastructure too: > > https://buildd.debian.org/status/fetch.php?pkg=ironseed&arch=mipsel&ver=0.3.6-4&stamp=1610676343&raw=0 > > Building current gdc-master on a MIPS server (running Debian Jessie, I > don't seem to have access to the Buster node), I can't reproduce the > segfault. What are the chances of it being QEMU that's the cause?
I would be first to blame qemu in my virtual chroot on amd64, but I was under impression the Debian buildd machine that failed was real hardware? I could be wrong though, this is information for buildd machine referenced in bug report where gdc failed: https://db.debian.org/machines.cgi?host=eberlin The program there segfaulted there was more complex than simple "hello world", though. (but it does work without any problems on all other architectures with gdc) > Also, are you linking to the static or shared libphobos library? shared (default): (mipsel-chroot):/tmp/w$ dpkg -l gdc | grep gdc ii gdc 4:10.2.1-1 mipsel D compiler (language version 2), based on the GCC backend (mipsel-chroot):/tmp/w$ printf 'import std.stdio;\nvoid main() { writeln("Hello, World!"); }\n' > hello.d ; gdc hello.d && ./a.out qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault (mipsel-chroot):/tmp/w$ file a.out a.out: ELF 32-bit LSB pie executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, BuildID[sha1]=36c5576b94519b416c1996018760159ae925bc34, for GNU/Linux 3.2.0, not stripped (mipsel-chroot):/tmp/w$ ldd a.out libgphobos.so.1 => /lib/mipsel-linux-gnu/libgphobos.so.1 (0x7f1a3000) libgcc_s.so.1 => /lib/mipsel-linux-gnu/libgcc_s.so.1 (0x7f16b000) libc.so.6 => /lib/mipsel-linux-gnu/libc.so.6 (0x7efd1000) libm.so.6 => /lib/mipsel-linux-gnu/libm.so.6 (0x7ef52000) libpthread.so.0 => /lib/mipsel-linux-gnu/libpthread.so.0 (0x7ef21000) libdl.so.2 => /lib/mipsel-linux-gnu/libdl.so.2 (0x7ef0d000) libz.so.1 => /lib/mipsel-linux-gnu/libz.so.1 (0x7eee2000) /lib/ld.so.1 (0x7ffc9000) But good point, when I try to link this "hello world" example statically, it throws warnings, but works! (mipsel-chroot):/tmp/w$ printf 'import std.stdio;\nvoid main() { writeln("Hello, World!"); }\n' > hello.d ; gdc -static hello.d && ./a.out /usr/bin/ld: /usr/lib/gcc/mipsel-linux-gnu/10/libgphobos.a(elf_shared.o): in function `_D3gcc8sections10elf_shared18pinLoadedLibrariesFNbNiZPv': /build/gcc-10-XdUysA/gcc-10-10.2.1/build/mipsel-linux-gnu/libphobos/libdruntime/../../../../src/libphobos/libdruntime/gcc/sections/elf_shared.d:250: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/bin/ld: /usr/lib/gcc/mipsel-linux-gnu/10/libgphobos.a(stdio.o): in function `_D3std5stdio11openNetworkFAyatZS3std5stdio4File': /build/gcc-10-XdUysA/gcc-10-10.2.1/build/mipsel-linux-gnu/libphobos/src/../../../../src/libphobos/src/std/stdio.d:5137: warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking Hello, World! (mipsel-chroot):/tmp/w$ file a.out a.out: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1 (GNU/Linux), statically linked, BuildID[sha1]=2da3a20d4fe083f1c33f79e4d259f91f8ed7696d, for GNU/Linux 3.2.0, with debug_info, not stripped (mipsel-chroot):/tmp/w$ dpkg -l "libgphobos*" | grep '^ii' ii libgphobos-10-dev:mipsel 10.2.1-6 mipsel Phobos D standard library ii libgphobos-dev:mipsel 10.2.1-1 mipsel Phobos D standard library ii libgphobos1:mipsel 10.2.1-6 mipsel Phobos D standard library (runtime library) > Running the testsuite now, to see if there's any reported failures, but > none so far... However, when I try to build and run the more complex program Data_Generators/makedata/logmake.d from this version: http://snapshot.debian.org/archive/debian/20210115T023714Z/pool/main/i/ironseed/ironseed_0.3.6-4.dsc it still fails with segfault on my qemu mipsel chroot, even when '-static' is added (as it did on Debian buildd machine "eberlin.debian.org"): (mipsel-chroot):/tmp/w/is/ironseed-0.3.6$ gdc -static -o Data_Generators/makedata/logmake Data_Generators/makedata/logmake.d Data_Generators/makedata/data.d && Data_Generators/makedata/logmake Data_Generators/makedata/logs.txt data/titles.dta data/log.dta /usr/bin/ld: /usr/lib/gcc/mipsel-linux-gnu/10/libgphobos.a(elf_shared.o): in function `_D3gcc8sections10elf_shared18pinLoadedLibrariesFNbNiZPv': /build/gcc-10-XdUysA/gcc-10-10.2.1/build/mipsel-linux-gnu/libphobos/libdruntime/../../../../src/libphobos/libdruntime/gcc/sections/elf_shared.d:250: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/bin/ld: /usr/lib/gcc/mipsel-linux-gnu/10/libgphobos.a(stdio.o): in function `_D3std5stdio11openNetworkFAyatZS3std5stdio4File': /build/gcc-10-XdUysA/gcc-10-10.2.1/build/mipsel-linux-gnu/libphobos/src/../../../../src/libphobos/src/std/stdio.d:5137: warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault (mipsel-chroot):/tmp/w/is/ironseed-0.3.6$ file Data_Generators/makedata/logmake Data_Generators/makedata/logmake: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1 (GNU/Linux), statically linked, BuildID[sha1]=73dc65478408cfd9c17fba098575b7fe4078dbc7, for GNU/Linux 3.2.0, with debug_info, not stripped If unable to reproduce elsewhere, perhaps you could try to get "dget -x http://snapshot.debian.org/archive/debian/20210115T023714Z/pool/main/i/ironseed/ironseed_0.3.6-4.dsc" and build on your real MIPS hardware and see it if builds? (note that ironseed version 0.3.6-4 is required, as 0.3.6-5 and newer versions contain a workaround, so they do not try to use gdc on mipsel architecture as it is is not working) -- Opinions above are GNU-copylefted.