[fpc-pascal] Debugging a darwin cross-compiler

Brad Campbell brad at wasp.net.au
Wed Sep 24 20:51:34 CEST 2008

Jonas Maebe wrote:
> On 24 Sep 2008, at 14:51, Brad Campbell wrote:
>> 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
> Open Darwin and Mac OS X/i386 are not entirely equivalent. I've seen 
> these kind of results in the past from people who tried this. I don't 
> know what the actual difference or workaround is. Maybe it works if you 
> can compile cctools from 
> http://www.opensource.apple.com/darwinsource/DevToolsJun2008/
> At least when building those on a native Mac OS X, you end up with 
> cctools that produce binaries which also run on Mac OS X.

Yeah, it certainly has to do with the linker and assembler.

I've copied the .o files across from my linux compiler box and tried to link them with the OSX tools 
and it has failed with unknown stabs sections in system.o. I've tried to cross compile the 
compiler/rtl with -gw rather than -gs and it fails to assemble/link with unknown sections. So it's 
certainly a problem with the odcctools/ccutils tools. (Mine are dated 13/04/2006!)

For now, I've figured out how to make the PPC binaries work "properly" on Intel OSX under Rosetta 
(tcflush was hanging).. so I'll work around it and use PPC binaries for now, but I'd love to be able 
to properly cross compile for OSX Intel in addition to OSX PPC (which works _perfectly_), so I'll 
keep at the linker issues until I get it solved.

Apple have bolloxed cctools _so_ badly they just won't compile on anything other than OSX..

Looks like I can compile everything *except* OSX-Intel binaries on my devel box, then I actually 
have to reboot into OSX to compile the OSX-Intel Binaries... ugh.. thanks Apple..

I really appreciate the help, I'm _way_ outa my comfort zone here.

Dolphins are so intelligent that within a few weeks they can
train Americans to stand at the edge of the pool and throw them

More information about the fpc-pascal mailing list