Thread overview
GDC on Mac OS X 10.2 - compat issues
Dec 06, 2005
David Friedman
Dec 06, 2005
David Friedman
Dec 06, 2005
David Friedman
December 04, 2005
Upon requests, I was trying to compile a GDC
version for (legacy) Mac OS X 10.2 "Jaguar",
using "Dec. 2002" Developer Tools with extra
"Aug 2003" gcc update to get GCC version 3.3...

(Tried to cross-compile it at first, but no luck.
Seems I always manage to trigger compiler crashes)


Here are the compatibility issues, that I ran into:

1) <wchar.h> is missing. ("wchar_t" is in <stdlib.h>)
    Think that this header is a C99 feature, perhaps?

2) <alloca.h> is missing (alloca is in <stdlib.h> too)

3) wcslen is missing, and has to be added from compat
    library. Only needed this function, so I hacked it

4) dlfcn.h is missing, but is available in "dlcompat"
    (See http://www.opendarwin.org/projects/dlcompat/)

5) socklen_t is *not* being defined by <sys/socket.h>

6) ldfuncs are all missing from System.dylib, and it
    seems that gphobos is "hardcoded" to assume them ?

Details are attached. (target is powerpc-apple-darwin6)


If the last issue can be resolved (a configure issue ?), then it should be OK to run GDC on Mac OS X 10.2 too...

Mac OS X 10.1 only has GCC 2.95, so it's not for GDC.
Mac OS X 10.0 aka Mac OS X Public Beta 2, is obsolete.

--anders

PS.
A more exciting project is building X86 cross-compiler,
mostly for targeting Mac OS X 10.4 - running on Intel:

i686-apple-darwin8-gdc-4.0.1 powerpc-apple-darwin8-gdc-4.0.1

But so far I haven't had any luck cross-compiling that either, and I don't have access to the Transition Kit.



December 06, 2005
Anders F Björklund wrote:
> 
> Upon requests, I was trying to compile a GDC
> version for (legacy) Mac OS X 10.2 "Jaguar",
> using "Dec. 2002" Developer Tools with extra
> "Aug 2003" gcc update to get GCC version 3.3...
> 
> (Tried to cross-compile it at first, but no luck.
> Seems I always manage to trigger compiler crashes)
> 
> 
> Here are the compatibility issues, that I ran into:
> 
> 1) <wchar.h> is missing. ("wchar_t" is in <stdlib.h>)
>    Think that this header is a C99 feature, perhaps?
> 
> 2) <alloca.h> is missing (alloca is in <stdlib.h> too)
> 
> 3) wcslen is missing, and has to be added from compat
>    library. Only needed this function, so I hacked it
> 
> 4) dlfcn.h is missing, but is available in "dlcompat"
>    (See http://www.opendarwin.org/projects/dlcompat/)
> 
> 5) socklen_t is *not* being defined by <sys/socket.h>
> 
> 6) ldfuncs are all missing from System.dylib, and it
>    seems that gphobos is "hardcoded" to assume them ?
> 
> Details are attached. (target is powerpc-apple-darwin6)
> 
> 
> If the last issue can be resolved (a configure issue ?),
> then it should be OK to run GDC on Mac OS X 10.2 too...

Can you try this fix for the ldfuncs problem?  It's a replacement for d/phobos/configure (also includes the configure.in)

http://home.earthlink.net/~dvdfrdmn/d/macosx102compat.tgz

I don't have a working 10.2 system right now (my iBook is giving off toxic fumes...)

> 
> Mac OS X 10.1 only has GCC 2.95, so it's not for GDC.
> Mac OS X 10.0 aka Mac OS X Public Beta 2, is obsolete.
> 
> --anders
> 
> PS.
> A more exciting project is building X86 cross-compiler,
> mostly for targeting Mac OS X 10.4 - running on Intel:
> 
> i686-apple-darwin8-gdc-4.0.1
> powerpc-apple-darwin8-gdc-4.0.1
> 
> But so far I haven't had any luck cross-compiling that
> either, and I don't have access to the Transition Kit.
> 
> 

The next release I make will be on SourceForge.  At that time, I'll put all of new cross-compilation stuff in CVS.

David
December 06, 2005
David Friedman wrote:

>> A more exciting project is building X86 cross-compiler,
>> mostly for targeting Mac OS X 10.4 - running on Intel:
>>
>> i686-apple-darwin8-gdc-4.0.1
>> powerpc-apple-darwin8-gdc-4.0.1
>>
>> But so far I haven't had any luck cross-compiling that
>> either, and I don't have access to the Transition Kit.
> 
> The next release I make will be on SourceForge.  At that time, I'll put all of new cross-compilation stuff in CVS.

Sounds good! (too bad SourceForge doesn't have any "newer"
Mac OS X machines in their build farm, like any Mac OS x86)

Q: Did you have any input on how to tweak the "configure"
for Mac OS X 10.2 that didn't seem to have the ldfuncs ?

--anders
December 06, 2005
Anders F Björklund wrote:
> David Friedman wrote:
> 
>>> A more exciting project is building X86 cross-compiler,
>>> mostly for targeting Mac OS X 10.4 - running on Intel:
>>>
>>> i686-apple-darwin8-gdc-4.0.1
>>> powerpc-apple-darwin8-gdc-4.0.1
>>>
>>> But so far I haven't had any luck cross-compiling that
>>> either, and I don't have access to the Transition Kit.
>>
>>
>> The next release I make will be on SourceForge.  At that time, I'll put all of new cross-compilation stuff in CVS.
> 
> 
> Sounds good! (too bad SourceForge doesn't have any "newer"
> Mac OS X machines in their build farm, like any Mac OS x86)
> 
> Q: Did you have any input on how to tweak the "configure"
> for Mac OS X 10.2 that didn't seem to have the ldfuncs ?
> 
> --anders

Yep, here is a replacement for d/phobos/configure:

http://home.earthlink.net/~dvdfrdmn/d/macosx102compat.tgz

I don't have 10.2 system to test it, though.  If it works for you, I'll put it in the next release.

David
December 06, 2005
David Friedman wrote:

>> Q: Did you have any input on how to tweak the "configure"
>> for Mac OS X 10.2 that didn't seem to have the ldfuncs ?

> http://home.earthlink.net/~dvdfrdmn/d/macosx102compat.tgz
> 
> I don't have 10.2 system to test it, though. If it works for you, I'll put it in the next release.

Thanks,
I'll give it a spin (or more of a "slow rotation", at 500Mhz)


If it works, I'll do the same thing for the "gdcmac" binaries.

Mac OS X 10.2 and GCC 3.3 will be the minimum, though.

There are limits on how far through the layers even
an archelogically interested person is willing to dig :-)

--anders
December 06, 2005
David Friedman wrote:

> Yep, here is a replacement for d/phobos/configure:
> 
> http://home.earthlink.net/~dvdfrdmn/d/macosx102compat.tgz
> 
> I don't have 10.2 system to test it, though. 

Closer...

ld: Undefined symbols:
_strtold

So just that one left now. :-)


Might be from std.c.stdlib ? Looks duplicated:

version (darwin)
{
    private import std.c.darwin.ldblcompat;
    real strtold(char *, char **); pragma(GNU_asm,strtold,"strtold"~__DARWIN_LDBL_COMPAT);
}
else
{
    private import gcc.config;
    alias gcc.config.cstrtold strtold;
}

--anders
December 06, 2005
Anders F Björklund wrote:
> David Friedman wrote:
> 
>> Yep, here is a replacement for d/phobos/configure:
>>
>> http://home.earthlink.net/~dvdfrdmn/d/macosx102compat.tgz
>>
>> I don't have 10.2 system to test it, though. 
> 
> 
> Closer...
> 
> ld: Undefined symbols:
> _strtold
> 
> So just that one left now. :-)
> 
> 
> Might be from std.c.stdlib ? Looks duplicated:
> 
> version (darwin)
> {
>     private import std.c.darwin.ldblcompat;
>     real strtold(char *, char **); pragma(GNU_asm,strtold,"strtold"~__DARWIN_LDBL_COMPAT);
> }
> else
> {
>     private import gcc.config;
>     alias gcc.config.cstrtold strtold;
> }
> 
> --anders

Try replacing that fragment with this one:

-----
version (darwin)
    version (GNU_Have_strtold)
	version = darwin_strtold;
version (darwin_strtold)
{
    private import std.c.darwin.ldblcompat;
    real strtold(char *, char **); pragma(GNU_asm,strtold,"strtold"~__DARWIN_LDBL_COMPAT);
}
else
{
    private import gcc.config;
    alias gcc.config.cstrtold strtold;
}
-----


Thanks for putting up with all of this!

David
December 06, 2005
> Might be from std.c.stdlib ? Looks duplicated:
> 
> version (darwin)
> {
>     private import std.c.darwin.ldblcompat;
>     real strtold(char *, char **); pragma(GNU_asm,strtold,"strtold"~__DARWIN_LDBL_COMPAT);
> }
> else
> {
>     private import gcc.config;
>     alias gcc.config.cstrtold strtold;
> }

Yeah, that was it... And D "Hello, World!" now works :-D


Changed to:

version (darwin)
{
    private import std.c.darwin.ldblcompat;
}
else
{
    private import gcc.config;
}
alias gcc.config.cstrtold strtold;


gdc-0.17-mac-10.2 going up as soon as packaging completes.

--anders
December 06, 2005
David Friedman wrote:

> Try replacing that fragment with this one:
> 
> -----
> version (darwin)
>     version (GNU_Have_strtold)
>     version = darwin_strtold;
> version (darwin_strtold)
> {
>     private import std.c.darwin.ldblcompat;
>     real strtold(char *, char **); pragma(GNU_asm,strtold,"strtold"~__DARWIN_LDBL_COMPAT);
> }
> else
> {
>     private import gcc.config;
>     alias gcc.config.cstrtold strtold;
> }
> -----

Okay, will use this new code instead.

> Thanks for putting up with all of this!

Np, seems to be complete for this time.

--anders