I'm having problems getting DMD 2.061 to work on my configuration of Ubuntu 12.10.
When I first install it using the following script
if grep -qE "^deb http://d-apt.googlecode.com/files /" /etc/apt/sources.list; then
echo "Already there";
else
echo 'deb http://d-apt.googlecode.com/files /' | sudo tee -a /etc/apt/sources.list;
fi
sudo apt-get update -q=2;
sudo apt-get --yes --allow-unauthenticated install d-apt-keyring;
sudo apt-get update -q=2;
sudo apt-get install -y dmd;
sudo apt-get install -y libgtkd-dev libgtkd-doc;
sudo apt-get install -y libtango-dev libtango-doc;
sudo apt-get install -y libdcollections-dev libdcollections-doc;
sudo apt-get install -y liborange-dmd-dev liborange-dmd-doc;
sudo apt-get install -y libderelict-dev;
sudo apt-get install -y libgl3n-dev libgl3n-doc;
sudo apt-get install -y libdsqlite-dev libdsqlite-doc;
sudo apt-get install -y libspiritd-dev libspiritd-doc;
sudo apt-get install -y libdstats-dev libdstats-doc;
sudo apt-get install -y libmsgpack-dmd-dev libmsgpack-dmd-doc;
sudo apt-get install -y vibe vibe-doc;
Everything works fine.
But...
then suddently after I've installed my favorite software from some Ubuntu PPA's the code dmd generates segfaults. As I use a lot of extra PPAs it is not easy to find out which PPA causes the crash. I have tried this on a default (unmodified) user.
Specifically the commmand
strace -f dmd -run f.d
where f.d
contains
import std.stdio;
void main(string args[])
{
auto x = 0b10;
writeln(x);
}
crashes as
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
brk(0) = 0x1908000
brk(0x1929000) = 0x1929000
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV (core dumped) +++
The next I tried was to compare the sha1sum's of all the dynamic libraries used by dmd
and in turn my program:
linux-vdso.so.1 => (0x00007ffff53ff000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f87f0ba0000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f87f0983000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f87f0686000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f87f0470000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f87f00b1000)
/lib64/ld-linux-x86-64.so.2 (0x00007f87f0ecf000)
to the ones installed by default on my TV-system which have no extra PPAs.
It turned out that /usr/lib/x86_64-linux-gnu/libstdc++.so.6
and /lib/x86_64-linux-gnu/libgcc_s.so.1
differed.
So then I copied over these files to my original system and directed to them using
LD_PRELOAD=libstdc++.so.6:libgcc_s.so.1
But...I still get the same segfault...and there I'm lost. What on earth could cause this problem otherwise? Should I start to compare the files (collected by strace) that are read by dmd and my program?
My system works find elsewhere along with gcc, g++. So I'm posting this in the hope that my configuration may have spotted a vulnerability in the code generated from DMD.
Finally I print some defaults about the compiler version on my failing system
dummy@lappis:~$ gcc --version
gcc-4.7.real (Ubuntu/Linaro 4.7.2-5ubuntu1) 4.7.2
dummy@lappis:~$ dpkg -S /usr/bin/gcc-4.7
diversion by hardening-wrapper from: /usr/bin/gcc-4.7
diversion by hardening-wrapper to: /usr/bin/gcc-4.7.real
gcc-4.7, hardening-wrapper: /usr/bin/gcc-4.7
and on my working (Ubuntu 12.10 without extra PPAs)
per@buddha:~$ gcc --version
gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright © 2012 Free Software Foundation, Inc.
According to gdb rdmd
run with f.d
it crashes in gc_init()
:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000417fec in gc_init ()
(gdb) where
#0 0x0000000000417fec in gc_init ()
#1 0x0000000000416a22 in rt.dmain2._d_run_main() ()
#2 0x0000000000416546 in rt.dmain2._d_run_main() ()
#3 0x00000000004164fd in _d_run_main ()
#4 0x000000000041633b in main ()`
I've finally tried building dmd from source but with the same segfaulting result.