** UPDATE** See http://funcall.posterous.com/ecl-on-iphone-redux for a more up-to-date description of how to get this to work. **
Common Lisp is finally on the iPhone! After waaaaay too much time in C and Makefile world, I have gotten ECL to cross-compile for the ARM processor and iPhone OS. The whole process required some changes to the ECL code itself, the ECL make process, and changes to the garbage collector.
To get ECL cross-compiling was a challenge for someone without much experience building C libraries and dealing with platform dependencies.
I made a script that should make this process easy at least 1000 times less painful than my experience. Just get ECL from the Floatopian repository and build it with a simple script:
The library files should be installed in install_iPhoneOS/lib/. If they are not, then something probably went wrong during the installation process. The build script is pretty dumb, so it will keep going even if individual steps encounter errors. So if you get problems look for the error highest up in the output.
THIS VERSION OF ECL does not have any extra bells and whistles. It is built without threads, bignum support, and ASDF. If you add any of these features, let me or the ECL list know so we can all share the wealth.
Some notes on ASDF:
> However, I still don’t have all the bells and whisltes working correctly.
> My current problem is getting ASDF to properly compile into ECL. I cannot
> get ECL to build, even for the i386 Darwin non-cross-compiled version of
> ECL, when I have ASDF enabled and the –disable-shared flag set in the
> configuration script. […]
> much about what’s going wrong. I am even more confused about why the
> –disable-shared flag makes any difference.
–disable-shared means you cannot compile code and load it. That is
why ASDF is not building. My question now is, does you iPhone have a C
compiler? If not then you will have to install a fake version of
COMPILE-FILE and COMPILE and try to teach ASDF to use it. It might be
a nice addition to ECL for environments without a C compiler but, as I
said, it is fake: there will be no compilation going on.
Some notes on cross-compiling GMP: http://gmplib.org/list-archives/gmp-bugs/2008-April/000997.html
Finally, I would like to get SLIME working on the iPhone to bring the advantages of REPL development to the iPhone. If you get that working, let me know.
SUMMARY OF CHANGES:
- Ported Boehm garbage collector to iPhone. I believe I ported everything necessary to get it to work in a threaded environment, but threading is currently broken so the GC part may not be functional. Look at the changes to gcconfig.h
- various fixes to ensure that the build and host ECLs use the same exact built-in symbol table. (The build ECL is the one with the i386 architecture that you use to cross-compile the ARMV6 architecture host ECL) ECL uses a tool called DPP to compile lispish C to something gcc can understand. If the build and host ECLs are not compiled with the same settings, then the symbol tables do not line up and you get strange runtime bugs. I changed a bunch of C #defines so to make sure the same symbol sets were used.
- fixed some problems assumptions that precluded cross-compilation and non-GMP builds