Weird OSX issue

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 27 06:54:48 PDT 2015


On 4/25/15 3:07 AM, Dan Olson wrote:
> Jacob Carlborg <doob at me.com> writes:
>
>> On 2015-04-24 20:37, Steven Schveighoffer wrote:
>>
>>> So am I going crazy? Or is dmd doing things differently depending on
>>> where its environment is? Any compiler gurus out there understand why
>>> the symbol is different?
>>>
>>> I don't want to file a bug with this, because it seems dependent on
>>> installation location, would possibly not be reproducible.
>>
>> I can't reproduce this with DMD from DVM (compiler is installed in the
>> user home directory).
>
> I have lots of version laying around and they all worked fine on the
> posted code.
>
> But maybe a clue here...
>
> $ ~/dmd2.066.0/osx/bin/dmd mod1.d
> $ nm mod1.o | grep start
>                   U _D4core6thread6Thread5startMFZv
> $ dmd mod1.d
> $ nm mod1.o | grep start
>                   U _D4core6thread6Thread5startMFNbZC4core6thread6Thread
>
> --- a/src/core/thread.d
> +++ b/src/core/thread.d
> @@ -587,7 +587,7 @@ class Thread
>        * Throws:
>        *  ThreadException if the thread fails to start.
>        */
> -    final Thread start()
> +    final Thread start() nothrow
>       in
>       {
>           assert( !next && !prev );
>
> I wonder if dmd -v will show where its picking up stuff.
>

Thank you. It is something I missed. Lo and behold:

dmd -v mod1.d:

...

import    core.thread	(/usr/share/dmd/src/druntime/import/core/thread.di)

...

~/Downloads/dmd2/osx/bin/dmd -v mod1.d:

...

import    core.thread 
(/Users/steves/Downloads/dmd2/osx/bin/../../src/druntime/import/core/thread.d)

...

Hm... thread.di vs thread.d (and I didn't notice before because all the 
other imports were .d, I just glanced over that detail).

And so, let's see here:

ls -l /usr/share/dmd/src/druntime/import/core/thread.*

-rw-rw-r--   1 steves  staff  157781 Mar 24 10:44 thread.d
-rw-rw-r--+  1 steves  staff   31382 Feb 24  2014 thread.di

Hey, looky there :)

So, looking at time machine (love that feature), I found that when I 
installed 2.066, back in October, we had switched to using thread.d 
instead of thread.di. But the installer did not erase the old thread.di.

BTW, found this: https://github.com/D-Programming-Language/druntime/pull/865

So I think the issue here is that the pkg installer on OSX does not 
clean up the target directory if it already exists (or at least 
purposely remove thread.di). Will look into fixing that. At least now, 
it works properly, thanks (did a rm -rf /usr/share/dmd and reinstall).

-Steve



More information about the Digitalmars-d-learn mailing list