SWI-Prolog on iOS

Matt Lilley <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
Hi Everyone,

I remember a few times that people have asked for this, but I’m not sure if anyone has done it successfully. I spent a little time last night and managed to hammer Xcode into shape (there seems to be an enormous chasm between People-Who-Use-Xcode and People-Who-Use-Autotools, and it was quite hard to build a bridge across it!), and now have SWi-Prolog running on my phone. Support is currently basic: No GMP, no readline (though what would you want readline for on iOS?) and no packages. Currently only targets arm64 and iOS7, as well. This could all probably be easily extended - I simply haven’t had time. The compilation is done via a script, which hopefully will survive going to a mailing list. Even without looking too closely, you might find the script a little frightening: Cross-compiling to iOS is a real nuisance because it’s not trivial to run the target binary. Compiling natively is basically impossible. Instead, I first compile for x64, then I make all sorts of assumptions that generated files are probably the same under both architectures (I recall Jan telling me this a couple of years ago. It seems to still be true), save the generated files, rebuild the binaries for iOS, and dump the host-generated files on top.

This works better than you might expect.

If anyone has ideas about how this could be integrated into the normal build process, please share! If it really is true that the generated files are invariant then it ought to be possible to abstract out the weird things in the script and just do a ‘host’ pass and a ‘target’ pass if cross-compiling (provided the host can really produce the right kinds of files). This might even be useful for cross-compiling to Windows from Linux, or OSX from Linux, or something similar. It might also be that this kind of thing is already catered to, and my lack of experience with cross-compiling means I didn’t notice it. 

Cheers,
Matt



-- 
_____________________________________________
Matt Lilley
Software Engineer
SecuritEase

Tel:    +64 4 917-6670
Fax:    +64 4 917-6671
E-mail: [email protected]


Visit us at:  http://www.securitease.com
_____________________________________________


This e-mail passed our content security scan.
It is covered by the confidentiality clauses at
http://www.securitease.com/content_and_confidentiality




-------------- next part --------------
HTML attachment scrubbed and removed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ios.sh
Type: application/octet-stream
Size: 3533 bytes
Desc: not available
URL: <https://lists.iai.uni-bonn.de/pipermail/swi-prolog/attachments/20131123/64842e3a/attachment.obj>
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.