[fpc-pascal] Debugging a darwin cross-compiler

Brad Campbell brad at wasp.net.au
Wed Sep 24 14:51:26 CEST 2008


G'day all,

Still on the trail of the serial unit issue. Think I have it working (it's working perfectly on OSX 
PPC and all my variants of Linux) but I can't seem to generate valid OSX Intel binaries.

I've got a working cross compile setup where I can generate fully functional linux/win32/OSX-PPC 
binaries and they all work beautifully, but while all the open darwin tools tell me my OSX-Intel 
binaries are ok, when I actually put them on an Intel Mac and try to run them all I get is :

-bash: ./hello: cannot execute binary file

If I compile it with

fpc -Tdarwin -Ppowerpc hello.pas

It works perfectly (under Rosetta of course), but with

fpc -Tdarwin -Pi386 hello.pas

I get the above result.

My cross compilers were generated with the same command line, substituting i386 for powerpc when 
required, and my X86_64, Win32 and OSX-PPC compilers work perfectly.

The MacOS SDK is MacOSX10.4u.sdk which is a universal binary SDK.

I'm at a loss as to how to proceed to debug this one..

I'm in the process of downloading a native 2.2.2 compiler on my Intel Mac so I can do some 
comparisons of the asm/objects as I have no idea what to do next.

brad at bklaptop2:/tracks/devel/Projects/Pascal/Proploader$ i386-darwin-lipo hello -detailed_info
input file hello is not a fat file
Non-fat file: hello is architecture: i386

brad at bklaptop2:/tracks/devel/Projects/Pascal/Proploader$ file hello
hello: Mach-O executable i386

brad at bklaptop2:~$ fpc -i
Free Pascal Compiler version 2.2.3

Compiler Date      : 2008/09/24
Compiler CPU Target: i386

Supported targets:
   GO32 V2 DOS extender
   Linux for i386
   OS/2
   Win32 for i386
   FreeBSD/ELF for i386
   Solaris for i386 (under development)
   Beos for i386 (under development)
   NetBSD for i386 (under development)
   Netware for i386(clib)
   WDOSX DOS extender
   OpenBSD for i386 (under development)
   OS/2 via EMX
   Watcom compatible DOS extenders
   Netware for i386(libc)
   WinCE for i386
   Linux for x64_6432
   Darwin for i386
   Symbian OS for i386

Supported CPU instruction sets:
   386
   PENTIUM
   PENTIUM2
   PENTIUM3
   PENTIUM4
   PENTIUMM

Supported FPU instruction sets:
   X87
   SSE
   SSE2
   SSE3

Supported Optimizations:
   REGVAR
   UNCERTAIN
   STACKFRAME
   PEEPHOLE
   ASMCSE
   LOOPUNROLL
   TAILREC

I'll keep at it, but I'd appreciate any pointers from anyone who has done this before.

Regards,
Brad
-- 
Dolphins are so intelligent that within a few weeks they can
train Americans to stand at the edge of the pool and throw them
fish.



More information about the fpc-pascal mailing list