Compiling DMD for the iPhone simulator

Michel Fortin michel.fortin at michelf.com
Thu Apr 26 03:20:20 PDT 2012


On 2012-04-26 06:56:02 +0000, Jacob Carlborg <doob at me.com> said:

> It turned out to be a problem with DMD. It had declared a type as 
> "unsigned int" instead of "size_t". stat.st_size appears to be 64bit in 
> the iPhone simulator SDK.

:-)

> Then I got a new problem. When I compile druntime it complains about 
> conflicting module names. Somehow it seems the package name disappears.

:-(

>> Are you running it straight from the command line? I suspect libraries
>> in the simulator SDK need the simulator's environment to work, which is
>> a pile of undocumented things.
> 
> Yes, just as you can, I assume, with the compilers already present in 
> <path>/iPhoneSimulator.platform.

You are assuming those compilers linked to the iOS SDK, but they could 
be "cross compilers" in the sense that the compiler is linked to Mac 
libraries (just like a normal Mac compiler) but creates executables for 
the iOS Simulator platform. (Obviously, the ARM ones are true cross 
compilers.)

My suspicion is that you could use the same Mac DMD compiler as long as 
all the generated code is linked with the iOS SDK. As far as I know, 
the only ABI difference is that the Objective-C runtime for the 
simulator is the Modern runtime while the Mac is still using the Legacy 
runtime for 32-bit. So you can't use the same Objective-C compiler, but 
beside Objective-C I'd expect all the generated code to be the same.

>> I'm also quite curious about what you're trying to achieve.
> 
> I was planning to try and run a D program in the iPhone simulator. As a 
> first step, I thought it would be much easier then running it on the 
> real device. The simulator runs 32bit code and not ARM.
> 
> If we eventual can run D program on iOS devices I'm pretty sure we also 
> want to run them on the simulator.
> 
> Can't hurt to try and see what it takes :)

Indeed, it's the first logical step.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list