www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - GDC on Mac - math linker errors for do-nothing program

reply Chris Pelling <chris inventivedingo.com> writes:
Hi there,

I've been using D for a while now, but only on Windows, and I'm
currently trying to get my project to compile on Mac OS X. I'm pretty
new to Macs, in general.

The machine is a classic iMac, one of the original ones from 1998; I
think it's a Revision B. (My workplace was going to throw it out so I
got it for free.) I installed a fresh copy of Mac OS X 10.3 "Panther" on
it (Tiger dropped support for the classic iMacs), downloaded and
installed Xcode Tools 1.5 as instructed, and then downloaded and
installed gdc from http://gdcmac.sf.net.

To test it I created a simple D file, like this:

void main() {
}

I tried to compile it (using either gdc test.d or gdmd test.d) and got this:

$ gdc test.d
ld: Undefined symbols:
_acosl
_asinl
_atan2l
_atanl
_cbrtl
_ceill
_copysignl
_coshl
_erfcl
_erfl
_exp2l
_expl
_expm1l
_fabsl
_floorl
_frexpl
_ilogbl
_ldexpl
_lgammal
_log10l
_log1pl
_log2l
_logbl
_logl
_modfl
_nanl
_nearbyintl
_powl
_remainderl
_roundl
_sinhl
_sqrtf
_sqrtl
_tanhl
_tgammal
_truncl

I have no idea what's causing this. I've tried reinstalling Xcode and
the BSD Subsystem, to no avail.

Any ideas?

Thanks in advance!

--Chris Pelling
Nov 20 2006
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Chris Pelling wrote:

 The machine is a classic iMac, one of the original ones from 1998; I
 think it's a Revision B. (My workplace was going to throw it out so I
 got it for free.) I installed a fresh copy of Mac OS X 10.3 "Panther" on
 it (Tiger dropped support for the classic iMacs), downloaded and
 installed Xcode Tools 1.5 as instructed, and then downloaded and
 installed gdc from http://gdcmac.sf.net.
Sounds reasonable. The math symbols you describe are being defined in /usr/lib/libSystem.dylib, so it should be able to find those easilly...
 I have no idea what's causing this. I've tried reinstalling Xcode and
 the BSD Subsystem, to no avail.
It works here, Mac OS X 10.3.9, Xcode 1.5. So it should for you too. Which GDC installation for Panther did you use ? (i.e. 0.19 or r20) --anders PS. You might try installing GDC from source code to see if that helps
Nov 20 2006
parent reply Chris Pelling <chris inventivedingo.com> writes:
Anders F Björklund wrote:
 The math symbols you describe are being defined in 
 /usr/lib/libSystem.dylib, so it should be able to find those easilly...
That's what I thought too...
 It works here, Mac OS X 10.3.9, Xcode 1.5. So it should for you too.
 Which GDC installation for Panther did you use ? (i.e. 0.19 or r20)
I used 0.19.
 PS. You might try installing GDC from source code to see if that helps
I'll look into that, thanks for the suggestion.
Nov 21 2006
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Chris Pelling wrote:

It works here, Mac OS X 10.3.9, Xcode 1.5. So it should for you too.
Which GDC installation for Panther did you use ? (i.e. 0.19 or r20)
I used 0.19.
OK. *scratches head*. That is the one I've used most. If you run with gdc --verbose it'll show all the steps, and if you run it with ktrace it'll dump a ktrace.out: gdc --verbose -c test.d 2> test.out ktrace gdc -c test.d Email those two outputs to me, and I'll have a look... (zip the test.out and ktrace.out up in an archive or so) --anders
Nov 21 2006
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
 If you run with gdc --verbose it'll show all the steps,
 and if you run it with ktrace it'll dump a ktrace.out:
 
 gdc --verbose -c test.d 2> test.out
 ktrace gdc -c test.d
Probably more interesting if we include the linker step too: gdc --verbose -o test test.d 2> test.out ktrace gdc -o test test.d BTW; you can view the ktrace.out using the "kdump" command. --anders
Nov 21 2006
parent reply Chris Pelling <chris inventivedingo.com> writes:
Anders F Björklund wrote:
 gdc --verbose -o test test.d 2> test.out
 ktrace gdc -o test test.d
I sent you test.out and ktrace.out. By the way, I should mention that my system isn't quite the same as yours. I'm not running OS X 10.3.9; I think it's 10.3.0 (all the version numbers I can find just say "10.3"). I suppose upgrading would be a good idea...
Nov 21 2006
parent reply Chris Pelling <chris inventivedingo.com> writes:
Chris Pelling wrote:
 I suppose upgrading would be a good
 idea...
A very good idea, as it turns out. Upgrading to 10.3.9 solved the problem. Thanks for your help Anders!
Nov 21 2006
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Chris Pelling wrote:

I suppose upgrading would be a good idea...
A very good idea, as it turns out. Upgrading to 10.3.9 solved the problem.
Okay, explains why I couldn't reproduce or find anything. I think I will maybe post a "warning" on the gdcmac site. --anders
Nov 21 2006
parent reply Chris Pelling <chris inventivedingo.com> writes:
Anders F Björklund wrote:
 I think I will maybe post a "warning" on the gdcmac site.
Yes, good idea. I was going to suggest that but forgot. :-) --Chris Pelling
Nov 21 2006
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Chris Pelling wrote:

I think I will maybe post a "warning" on the gdcmac site.
Yes, good idea. I was going to suggest that but forgot. :-)
Probably could have made a version with the MacOSX10.3.0.sdk, but it's better to force upgrading to 10.2.8 and 10.3.9... :-) Besides, you probably *want* Mac OS X 10.3.9 anyway for the security fixes, and for the compatibility with GCC/G++ 4.0 ? --anders
Nov 21 2006
parent reply Chris Pelling <chris inventivedingo.com> writes:
Anders F Björklund wrote:
 Probably could have made a version with the MacOSX10.3.0.sdk,
 but it's better to force upgrading to 10.2.8 and 10.3.9... :-)
 
 Besides, you probably *want* Mac OS X 10.3.9 anyway for the
 security fixes, and for the compatibility with GCC/G++ 4.0 ?
Yeah, upgrading isn't an issue, I just hadn't got around to it. By the way, will end-users have to be patched to 10.3.9 in order to run the compiled programs? (And what about 10.2.x and 10.4.x?)
Nov 21 2006
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Chris Pelling wrote:

 By the way, will end-users have to be patched to 10.3.9 in order to run
 the compiled programs? (And what about 10.2.x and 10.4.x?)
It's all about the libraries. End users shouldn't have to upgrade unless they encounter some issues like you had, but better put a disclaimer in. In general, the ready-made binaries will support the latest OS version. But I don't have any code that requires the new OS, just a side-effect. I don't think there will be any more explicit Mac OS X 10.2 versions of GDC, so you'll have to use Panther to develop for Jaguar in that case... --anders
Nov 22 2006