www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - compiling i386 on a ppc mac

reply Moritz Warning <moritzwarning _nospam_web.de> writes:
I try to compile a program with gdc on a ppc mac:

gdc -o main main.d -arch i386 -fversion=Tango -fversion=Posix -L/SDKs/
MacOSX10.4u.sdk/usr/lib -L/SDKs/MacOSX10.4u.sdk/usr/lib/system -lgtango -
lz -lssl

But i get these errors on linking:

/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning /usr/lib/
libcrypto.0.9.7.dylib cputype (18, architecture ppc) does not match 
cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning fat file: /usr/lib/
system/libmathCommon.A.dylib does not contain an architecture that 
matches the specified -arch flag: i386 (file ignored)
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
_fegetround referenced from libSystem expected to be defined in /usr/lib/
system/libmathCommon.A.dylib


The libraries in /usr/lib are indeed not for i386, but ppc only.
But they are also in /SDKs/MacOSX10.4u.sdk/usr/lib for i386 (and ppc, 
universal binaries from xcode).

Anyone knows how to convince gdc to look in the given include paths first
for these files, too?
It seems to work for other includes.

I tried to specify them explicitly (e.g.: -L/SDKs/MacOSX10.4u.sdk/usr/lib/
libcrypto.0.9.7.dylib), but nothing changed.

:(
May 05 2008
parent reply =?UTF-8?B?QW5kZXJzIEYgQmrDtnJrbHVuZA==?= <afb algonet.se> writes:
Moritz Warning wrote:

 The libraries in /usr/lib are indeed not for i386, but ppc only.
 But they are also in /SDKs/MacOSX10.4u.sdk/usr/lib for i386 (and ppc, 
 universal binaries from xcode).
 
 Anyone knows how to convince gdc to look in the given include paths first
 for these files, too?
 It seems to work for other includes.
gdc -o main main.d -arch i386 -fversion=Tango -fversion=Posix \ -isysroot /Developer/SDKs/MacOSX10.4u.sdk -lgtango -lz -lssl As a one-time setup thing (and for convenience), you need to set up symbolic links for libgphobos.a and libgtango.a to the SDK dir too: sudo ln -s /usr/lib/libgphobos.a /Developer/SDKs/MacOSX10.4u.sdk/usr/lib sudo ln -s /usr/lib/libgtango.a /Developer/SDKs/MacOSX10.4u.sdk/usr/lib --anders PS. You can also build universal binaries, by using "-arch ppc -arch i386"
May 05 2008
parent Moritz Warning <moritzwarning _nospam_web.de> writes:
On Mon, 05 May 2008 21:07:09 +0200, Anders F Björklund wrote:

[..]
 gdc -o main main.d -arch i386 -fversion=Tango -fversion=Posix \
      -isysroot /Developer/SDKs/MacOSX10.4u.sdk -lgtango -lz -lssl
 
[..] "-isysroot /Developer/SDKs/MacOSX10.4u.sdk" did it. Thank you!
May 05 2008