June 09, 2013
On Sunday, 9 June 2013 at 17:23:16 UTC, Andrei Alexandrescu wrote:
> On Sunday, 9 June 2013 at 17:22:36 UTC, Andrei Alexandrescu wrote:
>> On Wednesday, 5 June 2013 at 02:30:37 UTC, Jerry wrote:
>>> jlquinn@wyvern:~/re/test$ /home/jlquinn/dmd2/linux/bin64/dmd -v -w junk.d
>>> binary    /home/jlquinn/dmd2/linux/bin64/dmd
>>> version   v2.063
>> [snip]
>>
>> I've done a clean room attempt at reproducing the bug, was unable to. Jerry, anything you can think of that's unusual with your installation?
>
> Forgot to mention - details at
> http://d.puremagic.com/issues/show_bug.cgi?id=10274

One thought that comes to mind - you may want to double-check LD_LIBRARY_PATH to make sure there's no stray reference to an old libphobos.a dir.
June 10, 2013
"Andrei Alexandrescu" <SeeWebsiteForEmail@erdani.org> writes:

> On Sunday, 9 June 2013 at 17:23:16 UTC, Andrei Alexandrescu wrote:
>> On Sunday, 9 June 2013 at 17:22:36 UTC, Andrei Alexandrescu wrote:
>>> On Wednesday, 5 June 2013 at 02:30:37 UTC, Jerry wrote:
>>>> jlquinn@wyvern:~/re/test$ /home/jlquinn/dmd2/linux/bin64/dmd -v -w junk.d
>>>> binary    /home/jlquinn/dmd2/linux/bin64/dmd
>>>> version   v2.063
>>> [snip]
>>>
>>> I've done a clean room attempt at reproducing the bug, was unable
>>> to. Jerry, anything you can think of that's unusual with your installation?
>>
>> Forgot to mention - details at http://d.puremagic.com/issues/show_bug.cgi?id=10274
>
> One thought that comes to mind - you may want to double-check LD_LIBRARY_PATH to make sure there's no stray reference to an old libphobos.a dir.

LD_LIBRARY_PATH is empty.  I've now reproduced this segfault on a Debian testing machine as well as my Ubuntu one.  I'm pretty confused.

Jerry
June 10, 2013
On Monday, 10 June 2013 at 06:41:39 UTC, Jerry wrote:
> "Andrei Alexandrescu" <SeeWebsiteForEmail@erdani.org> writes:
>
>> On Sunday, 9 June 2013 at 17:23:16 UTC, Andrei Alexandrescu wrote:
>>> On Sunday, 9 June 2013 at 17:22:36 UTC, Andrei Alexandrescu wrote:
>>>> On Wednesday, 5 June 2013 at 02:30:37 UTC, Jerry wrote:
>>>>> jlquinn@wyvern:~/re/test$ /home/jlquinn/dmd2/linux/bin64/dmd -v -w junk.d
>>>>> binary    /home/jlquinn/dmd2/linux/bin64/dmd
>>>>> version   v2.063
>>>> [snip]
>>>>
>>>> I've done a clean room attempt at reproducing the bug, was unable
>>>> to. Jerry, anything you can think of that's unusual with your installation?
>>>
>>> Forgot to mention - details at
>>> http://d.puremagic.com/issues/show_bug.cgi?id=10274
>>
>> One thought that comes to mind - you may want to double-check LD_LIBRARY_PATH
>> to make sure there's no stray reference to an old libphobos.a dir.
>
> LD_LIBRARY_PATH is empty.  I've now reproduced this segfault on a Debian
> testing machine as well as my Ubuntu one.  I'm pretty confused.
>
> Jerry

I can't reproduce this anywhere. What's the output for these:

gcc --version
ldd --version

Also, check for any stray installations or config files:
find /usr /etc /opt /home/$(whoami) -name \*phobos\* -o -name \*druntime\* -o -name dmd\* 2>/dev/null

Be warned that will take a while (a few minutes on my machine).
Also, and I know this sounds stupidly simple, but have to tried re-downloading?
June 10, 2013
On 6/10/13 2:41 AM, Jerry wrote:
> "Andrei Alexandrescu"<SeeWebsiteForEmail@erdani.org>  writes:
>
>> On Sunday, 9 June 2013 at 17:23:16 UTC, Andrei Alexandrescu wrote:
>>> On Sunday, 9 June 2013 at 17:22:36 UTC, Andrei Alexandrescu wrote:
>>>> On Wednesday, 5 June 2013 at 02:30:37 UTC, Jerry wrote:
>>>>> jlquinn@wyvern:~/re/test$ /home/jlquinn/dmd2/linux/bin64/dmd -v -w junk.d
>>>>> binary    /home/jlquinn/dmd2/linux/bin64/dmd
>>>>> version   v2.063
>>>> [snip]
>>>>
>>>> I've done a clean room attempt at reproducing the bug, was unable
>>>> to. Jerry, anything you can think of that's unusual with your installation?
>>>
>>> Forgot to mention - details at
>>> http://d.puremagic.com/issues/show_bug.cgi?id=10274
>>
>> One thought that comes to mind - you may want to double-check LD_LIBRARY_PATH
>> to make sure there's no stray reference to an old libphobos.a dir.
>
> LD_LIBRARY_PATH is empty.  I've now reproduced this segfault on a Debian
> testing machine as well as my Ubuntu one.  I'm pretty confused.
>
> Jerry

Appreciate the work. (BTW nice to see you again, recall we talked at that NLP conference a while back.)

Let's focus on Ubuntu/64 because that's what I have on my end too.

1. Which Ubuntu version are you using?

2. Can you compile and run "hello, world" in C?

3. If you replace the D call to writeln() with a call to printf(), does that work?

4. If you make any other calls into the stdlib aside from I/O, do they work?

5. Does gdb reveal anything interesting?



Andrei
June 10, 2013
On Tuesday, 4 June 2013 at 18:03:53 UTC, Jerry wrote:
> Hi folks,
>
> I've downloaded the current dmd 2.063 zip and tried it out.  This is
> Ubuntu 12.10 x86_64.  Every program I compile segfaults when I try to
> run it.  As a simple example:
>
> jlquinn@wyvern:~/re/test$ cat junk.d
> import std.stdio;
> void main() {
>   writeln("Hi");
> }
> jlquinn@wyvern:~/re/test$ /home/jlquinn/dmd2/linux/bin64/dmd junk.d
> jlquinn@wyvern:~/re/test$ ./junk
> Segmentation fault (core dumped)
>
> The gdb backtrace is somewhere in __libc_start_main, before main() is
> run.
>
> I assume I'm not in the majority, but I literally can't compile and run
> anything.
>
> Any help would be appreciated
> Thanks
> Jerry

Can you upload somewhere your broken binary?
x86_64 EFL binary would be great!
June 10, 2013
"John Colvin" <john.loughran.colvin@gmail.com> writes:

> On Monday, 10 June 2013 at 06:41:39 UTC, Jerry wrote:
>>
>> LD_LIBRARY_PATH is empty.  I've now reproduced this segfault on a Debian testing machine as well as my Ubuntu one.  I'm pretty confused.
>>
>> Jerry
>
> I can't reproduce this anywhere. What's the output for these:
>
> gcc --version
> ldd --version

jlquinn@wyvern:~/dmd2/src/dmd$ gcc --version
gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

jlquinn@wyvern:~/dmd2/src/dmd$ ldd --version
ldd (Ubuntu EGLIBC 2.15-0ubuntu20.1) 2.15
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.


> Also, check for any stray installations or config files:
> find /usr /etc /opt /home/$(whoami) -name \*phobos\* -o -name \*druntime\* -o
> -name dmd\* 2>/dev/null

I ran and verified that there's no stray phobos or druntime libraries.

> Be warned that will take a while (a few minutes on my machine). Also, and I know this sounds stupidly simple, but have to tried re-downloading?

Already tried it.  I also get a segfault on my Debian x86_64 machine.

I've straced the dmd compile and it is using the correct libraries.

Compressed, the binary is 175K.  Is that OK to attach to the open bug?

Jerry
June 10, 2013
Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> writes:

> On 6/10/13 2:41 AM, Jerry wrote:
>> "Andrei Alexandrescu"<SeeWebsiteForEmail@erdani.org>  writes:
>>
>>> On Sunday, 9 June 2013 at 17:23:16 UTC, Andrei Alexandrescu wrote:
>>>> On Sunday, 9 June 2013 at 17:22:36 UTC, Andrei Alexandrescu wrote:
>>>>> On Wednesday, 5 June 2013 at 02:30:37 UTC, Jerry wrote:
>>>>>> jlquinn@wyvern:~/re/test$ /home/jlquinn/dmd2/linux/bin64/dmd -v -w junk.d
>>>>>> binary    /home/jlquinn/dmd2/linux/bin64/dmd
>>>>>> version   v2.063
>>>>> [snip]
>>>>>
>>>>> I've done a clean room attempt at reproducing the bug, was unable
>>>>> to. Jerry, anything you can think of that's unusual with your installation?
>>>>
>>>> Forgot to mention - details at http://d.puremagic.com/issues/show_bug.cgi?id=10274
>>>
>>> One thought that comes to mind - you may want to double-check LD_LIBRARY_PATH to make sure there's no stray reference to an old libphobos.a dir.
>>
>> LD_LIBRARY_PATH is empty.  I've now reproduced this segfault on a Debian testing machine as well as my Ubuntu one.  I'm pretty confused.
>>
>> Jerry
>
> Appreciate the work. (BTW nice to see you again, recall we talked at that NLP conference a while back.)

I do recall.  I'm glad you ended up someplace you enjoy.  That was a fun conference.

> Let's focus on Ubuntu/64 because that's what I have on my end too.
>
> 1. Which Ubuntu version are you using?

I'm running 12.10 x86_64.

> 2. Can you compile and run "hello, world" in C?

That works fine.

> 3. If you replace the D call to writeln() with a call to printf(), does that
> work?

No, same problem.  BTW, it's segfaulting in _d_dso_registry() before
main() gets run.

> 4. If you make any other calls into the stdlib aside from I/O, do they work?

It doesn't matter.  The following program segfaults:

void main() {}


> 5. Does gdb reveal anything interesting?

Unfortunately there's no debugging symbols in _d_dso_registry().  I assume the compiler is writing asm directly.

Jerry
June 10, 2013
On Monday, 10 June 2013 at 16:52:51 UTC, Jerry wrote:
> No, same problem.  BTW, it's segfaulting in _d_dso_registry() before
> main() gets run.
>
>> 4. If you make any other calls into the stdlib aside from I/O, do they
>> work?
>
> It doesn't matter.  The following program segfaults:
>
> void main() {}
>
>
>> 5. Does gdb reveal anything interesting?
>
> Unfortunately there's no debugging symbols in _d_dso_registry().  I
> assume the compiler is writing asm directly.
>
> Jerry

I got a similar issue when upgrading to 2.063 on arch linux, so I feel this may be relevant to the current problem. Heres the backtrace for me.

#0  0x00007ffff7286f54 in _d_arrayappendcd () from /usr/lib/libphobos2.so.0.63
#1  0x00007ffff721f5c4 in std.string.__T7toLowerTAyaZ.toLower() () from /usr/lib/libphobos2.so.0.63
#2  0x00007ffff72781a2 in _aApplycd1 () from /usr/lib/libphobos2.so.0.63
#3  0x00007ffff721f566 in std.string.__T7toLowerTAyaZ.toLower() () from /usr/lib/libphobos2.so.0.63
#4  0x00007ffff7278626 in _aApplycd2 () from /usr/lib/libphobos2.so.0.63
#5  0x00007ffff721f4b5 in std.string.__T7toLowerTAyaZ.toLower() () from /usr/lib/libphobos2.so.0.63
#6  0x00007ffff71b4f15 in std.encoding.EncodingScheme.register() () from /usr/lib/libphobos2.so.0.63
#7  0x00007ffff71b543a in std.encoding.EncodingSchemeASCII._sharedStaticCtor9() ()
   from /usr/lib/libphobos2.so.0.63
#8  0x00007ffff71bb351 in std.encoding.__modsharedctor() () from /usr/lib/libphobos2.so.0.63
#9  0x00007ffff7288c54 in rt.minfo.ModuleGroup.runCtors() () from /usr/lib/libphobos2.so.0.63
#10 0x00007ffff7288196 in rt.minfo.ModuleGroup.runCtors() () from /usr/lib/libphobos2.so.0.63
#11 0x00007ffff72884dd in rt.minfo.rt_moduleCtor() () from /usr/lib/libphobos2.so.0.63
#12 0x00007ffff72891ca in rt.sections_linux.DSO.opApply() () from /usr/lib/libphobos2.so.0.63
#13 0x00007ffff72884ae in rt_moduleCtor () from /usr/lib/libphobos2.so.0.63
#14 0x00007ffff72818ad in rt.dmain2._d_run_main() () from /usr/lib/libphobos2.so.0.63
#15 0x00007ffff72813cd in rt.dmain2._d_run_main() () from /usr/lib/libphobos2.so.0.63
#16 0x00007ffff7281387 in _d_run_main () from /usr/lib/libphobos2.so.0.63
#17 0x00007ffff72811d4 in main () from /usr/lib/libphobos2.so.0.63
#18 0x00007ffff653ca15 in __libc_start_main () from /usr/lib/libc.so.6
#19 0x000000000043f9d9 in _start ()

Unfortunately, no debugging symbols for phobos.

program was compiled with dmd (2.063) using the following flags: -g -debug -unittest


June 10, 2013
On Monday, 10 June 2013 at 18:50:21 UTC, Brandon wrote:
> On Monday, 10 June 2013 at 16:52:51 UTC, Jerry wrote:
>> No, same problem.  BTW, it's segfaulting in _d_dso_registry() before
>> main() gets run.
>>
>>> 4. If you make any other calls into the stdlib aside from I/O, do they
>>> work?
>>
>> It doesn't matter.  The following program segfaults:
>>
>> void main() {}
>>
>>
>>> 5. Does gdb reveal anything interesting?
>>
>> Unfortunately there's no debugging symbols in _d_dso_registry().  I
>> assume the compiler is writing asm directly.
>>
>> Jerry
>
> I got a similar issue when upgrading to 2.063 on arch linux, so I feel this may be relevant to the current problem. Heres the backtrace for me.
>
> #0  0x00007ffff7286f54 in _d_arrayappendcd () from /usr/lib/libphobos2.so.0.63
> #1  0x00007ffff721f5c4 in std.string.__T7toLowerTAyaZ.toLower() () from /usr/lib/libphobos2.so.0.63
> #2  0x00007ffff72781a2 in _aApplycd1 () from /usr/lib/libphobos2.so.0.63
> #3  0x00007ffff721f566 in std.string.__T7toLowerTAyaZ.toLower() () from /usr/lib/libphobos2.so.0.63
> #4  0x00007ffff7278626 in _aApplycd2 () from /usr/lib/libphobos2.so.0.63
> #5  0x00007ffff721f4b5 in std.string.__T7toLowerTAyaZ.toLower() () from /usr/lib/libphobos2.so.0.63
> #6  0x00007ffff71b4f15 in std.encoding.EncodingScheme.register() () from /usr/lib/libphobos2.so.0.63
> #7  0x00007ffff71b543a in std.encoding.EncodingSchemeASCII._sharedStaticCtor9() ()
>    from /usr/lib/libphobos2.so.0.63
> #8  0x00007ffff71bb351 in std.encoding.__modsharedctor() () from /usr/lib/libphobos2.so.0.63
> #9  0x00007ffff7288c54 in rt.minfo.ModuleGroup.runCtors() () from /usr/lib/libphobos2.so.0.63
> #10 0x00007ffff7288196 in rt.minfo.ModuleGroup.runCtors() () from /usr/lib/libphobos2.so.0.63
> #11 0x00007ffff72884dd in rt.minfo.rt_moduleCtor() () from /usr/lib/libphobos2.so.0.63
> #12 0x00007ffff72891ca in rt.sections_linux.DSO.opApply() () from /usr/lib/libphobos2.so.0.63
> #13 0x00007ffff72884ae in rt_moduleCtor () from /usr/lib/libphobos2.so.0.63
> #14 0x00007ffff72818ad in rt.dmain2._d_run_main() () from /usr/lib/libphobos2.so.0.63
> #15 0x00007ffff72813cd in rt.dmain2._d_run_main() () from /usr/lib/libphobos2.so.0.63
> #16 0x00007ffff7281387 in _d_run_main () from /usr/lib/libphobos2.so.0.63
> #17 0x00007ffff72811d4 in main () from /usr/lib/libphobos2.so.0.63
> #18 0x00007ffff653ca15 in __libc_start_main () from /usr/lib/libc.so.6
> #19 0x000000000043f9d9 in _start ()
>
> Unfortunately, no debugging symbols for phobos.
>
> program was compiled with dmd (2.063) using the following flags: -g -debug -unittest

I suspected it may be the problem with shared libraries.
Can you try compiling that hello world with static libphobos?
Or can you attach your segfaulting binary?
June 10, 2013
On 6/10/2013 2:28 PM, nazriel wrote:
>> program was compiled with dmd (2.063) using the following flags: -g -debug
>> -unittest
>
> I suspected it may be the problem with shared libraries.
> Can you try compiling that hello world with static libphobos?
> Or can you attach your segfaulting binary?

Statically linking with libphobos2.a is the default.