07.07.2013, 00:17, "Yuri Albuquerque" <yuridenom...@gmail.com>:
>>> But what about the build process? Should I simply load my code using ASDF?
>>
>> I do not understand this. There are about 30 threads discussing how to build 
>> shared libraries or statically linked libraries from user code using ASDF's 
>> MAKE-BUILD.
>
> But this assumes the target arch to be similar to the development machine, 
> doesn't this? I'm talking about producing a library for android. Does a 
> thread about this exist?

This is an interesting area of ECL application - building libraries for a 
different platform than you develop on.
For example if your development machine (aka host machine) is x86 and the 
target is Android.

This is called cross-compilation.

I was able to cross compile Lisp libraries (ASDF systems) with ECL.
Not for Android, but for some ARM system.
It was some years ago. Here is what I remember.

When you want to cross-compile some Lisp library, you of course don't just load 
ASDF.
You must understand how things work.

ECL generates C source code files from Lisp code, and then invokes C compiler 
on these generated C files.

Therefore, to cross compile a Lisp library, you need to ensure that the C 
compiler invoked by ECL
is a C cross compiler - one which is able to produce binaries for the target 
platform. In case of Android
that would be the C compiler coming with Android NDK.

What C compiler is invoked by ECL is controlled by a bunch of special 
variables, like
cmp::*cc* cmp::*cc-flags  *cmp::*cc-format*.

The details of the compilation process may be found in the ECL source code,
file new-cmp\cmpmain.lsp, functions compiler-cc, compile, compile-file.

After you configured the special variables so that ECL invokes C cross compiler,
you can compile an ASDF system and ECL starts producing binaries for the target 
platform.

The next problem, is that while compiling an ASDF system, ASDF not only 
produces output binaries,
but also tries to load the binary for each .lisp file, before continuing to the 
next .lisp file.
And of course, the binaries we now produce are incompatible with the host ECL 
where compilation is running.

As far as I remember I solved it by customizing an ASDF operation, so that 
after compiling .lisp file,
ASDF loads not the binary produced (.fas file), but the original .lisp file.
I think this ASDF customization was a simple one-liner.

Other people solved this problem by making ASDF to produce binaries for both 
platforms:
host and target; and during the compilation process ECL loads the binary for 
the host platform.
I saw this approach in this post: 
http://sourceforge.net/mailarchive/message.php?msg_id=27333062

Basically that's all. In the end you have a bunch of binaries (.fas files) 
which can be loaded by ECL
on the target platform.

I think people do not often cross compile Lisp code for other platforms.
Therefore not so many information is published. You can search the mailing list.
But also, as I said, you should understand how the build process works.

Best regards,
- Anton

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list

Reply via email to