February 15, 2009
Anders F Björklund wrote:
> -mmacosx-version-min=10.4

I recompiled with that switch, and uploaded a new dmd.1.040.zip. Can you give it a try, please?
February 15, 2009
Walter Bright wrote:
> Anders F Björklund wrote:
>> -mmacosx-version-min=10.4
> 
> I recompiled with that switch, and uploaded a new dmd.1.040.zip. Can you give it a try, please?

You did add *both* the switches, right ? One for MDT, one for SDK.
(MDT is for choosing functions, SDK chooses headers and libraries)

-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk

It still fails on Mac OS X 10.4, maybe it still used native SDK ?
(if it matters, it gets a null dereference in _malloc_initialize)

--anders
February 15, 2009
Anders F Björklund wrote:
> Walter Bright wrote:
>> Anders F Björklund wrote:
>>> -mmacosx-version-min=10.4
>>
>> I recompiled with that switch, and uploaded a new dmd.1.040.zip. Can you give it a try, please?
> 
> You did add *both* the switches, right ? One for MDT, one for SDK.
> (MDT is for choosing functions, SDK chooses headers and libraries)
> 
> -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
> 
> It still fails on Mac OS X 10.4, maybe it still used native SDK ?
> (if it matters, it gets a null dereference in _malloc_initialize)

Ok, I tried it with both switches now. Please give it a try.
February 15, 2009
Walter Bright wrote:

>> It still fails on Mac OS X 10.4, maybe it still used native SDK ?
>> (if it matters, it gets a null dereference in _malloc_initialize)
> 
> Ok, I tried it with both switches now. Please give it a try.

No luck, same problem. Might want to add "requires Mac OS X 10.5"
or something for now ? Upgraded wxD CVS to support DMD on Mac too.

--anders
February 15, 2009
Anders F Björklund wrote:
> Walter Bright wrote:
> 
>>> It still fails on Mac OS X 10.4, maybe it still used native SDK ?
>>> (if it matters, it gets a null dereference in _malloc_initialize)
>>
>> Ok, I tried it with both switches now. Please give it a try.
> 
> No luck, same problem. Might want to add "requires Mac OS X 10.5"
> or something for now ? Upgraded wxD CVS to support DMD on Mac too.

Yeah, that looks like the best strategy for the moment. It seems odd that there is such confusion about something that should be documented and straightforward.
February 15, 2009
Walter Bright wrote:
> Now includes Mac OSX version!
> 
> http://www.digitalmars.com/d/1.0/changelog.html
> http://ftp.digitalmars.com/dmd.1.040.zip
> 
> 
> http://www.digitalmars.com/d/2.0/changelog.html
> http://ftp.digitalmars.com/dmd.2.025.zip
> 
> Expect bugs. Thread local storage isn't working on OSX, neither are sockets and memory mapped files (for unknown reasons).
> 
> Thanks to Sean Kelly for a lot of help on the runtime library with this.

That is terrific news
February 15, 2009
On 2009-02-15 04:30:28 -0500, Anders F Björklund <afb@algonet.se> said:

> Walter Bright wrote:
>> Anders F Björklund wrote:
>>> -mmacosx-version-min=10.4
>> 
>> I recompiled with that switch, and uploaded a new dmd.1.040.zip. Can you give it a try, please?
> 
> You did add *both* the switches, right ? One for MDT, one for SDK.
> (MDT is for choosing functions, SDK chooses headers and libraries)
> 
> -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
> 
> It still fails on Mac OS X 10.4, maybe it still used native SDK ?

If you specify a SDK for the compiler, you should also tell the linker to use the SDK.

	-syslibroot /Developer/SDKs/MacOSX10.4u.sdk

Or if you're passing the linker's argument through GCC instead of calling the linker directly:

	-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk

That's all explained in the document I linked to yesterday.


> (if it matters, it gets a null dereference in _malloc_initialize)

I made a diff of malloc.c (which contains _malloc_initialize) between 10.4 and 10.5, and it looks like the rewrote half of that file, so there may be some differences.

But even then, if Walter is using the 10.5 SDK and isn't using anything specific to 10.5, I don't see where the problem could be comming from; especially after setting -mmacosx-version-min=10.4. When using the 10.5 SDK, -mmacosx-version-min=10.4 will only make 10.5-only APIs weak-linked. When using the 10.4 SDK, it shoudn't do anything special, as 10.5's APIs are just not available.

I'd suggest to Walter to try adding the SDK flags to the linker. If that doesn't work, I'd suggest someone with 10.4 on an Intel Mac look for the crash report that should be in ~/Library/Logs/CrashReporter/dmd_<date>.crash and send it to Walter, or post it somewhere for everyone to analyse.

-- 
Michel Fortin
michel.fortin@michelf.com
http://michelf.com/

February 15, 2009
Michel Fortin wrote:

>> It still fails on Mac OS X 10.4, maybe it still used native SDK ?
> 
> If you specify a SDK for the compiler, you should also tell the linker to use the SDK.
> 
>     -syslibroot /Developer/SDKs/MacOSX10.4u.sdk
> 
> Or if you're passing the linker's argument through GCC instead of calling the linker directly:
> 
>     -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
> 
> That's all explained in the document I linked to yesterday.

I thought GCC 4.0.1 and later did that for you automatically ?
i.e. passed -syslibroot to the linker when using -isysroot

--anders
February 15, 2009
Walter Bright wrote:

>> No luck, same problem. Might want to add "requires Mac OS X 10.5"
>> or something for now ? Upgraded wxD CVS to support DMD on Mac too.
> 
> Yeah, that looks like the best strategy for the moment. It seems odd that there is such confusion about something that should be documented and straightforward.

Must have been unlucky, or doing things "outside the dotted lines",
or both... Because usually it does just work with the MDT and SDK.

I think cross-compilation is rather transparent on Mac OS X, on the
other platforms it usually involves a full chroot or virtual machine ?

--anders
February 15, 2009
On 2009-02-15 08:42:53 -0500, Anders F Björklund <afb@algonet.se> said:

> I thought GCC 4.0.1 and later did that for you automatically ?
> i.e. passed -syslibroot to the linker when using -isysroot
> 
> --anders

Hum, indeed, I think you're right. Seems like this Apple documentation is outdated: <http://developer.apple.com/documentation/developertools/conceptual/cross_development/Using/chapter_3_section_2.html#//apple_ref/doc/uid/20002000-1114311-BABGCAAB>

Sorry 

for the confusion.

-- 
Michel Fortin
michel.fortin@michelf.com
http://michelf.com/