I'm not sure that I'm understanding your question correctly, so let me summarize the steps needed to cross-compile a lisp library in more details:

1. Cross-compile ECL itself. You can do this by essentially the same steps as for iOS/Android detailed in the INSTALL file: first build a "host ECL" (in your case a version of ECL that runs on Intel Macs), then run configure with `--host` and `--with-cross-config` options and make (this will use the host ECL to compile a target ECL, i.e. a version of ECL which will run on the M1).

2. Start the host ECL built in step 1, set up the compiler paths and flags as shown in the examples that I linked in my previous email.

3. Call compile-file, c:build-static-library or c:build-shared-library etc. as usual. This will produce a binary for the target system (in your case a M1 Mac) which is linked against the target ECL. Due to that, you can't directly load the fasl's that this compilation procedure produces into the host ECL. Thus if you have dependencies between files which necessitate loading files (for instance if you define a macro in one file and use it in another), the easiest option is to use the bytecompiler to load files. If this fails, you may compile fasls using the default configuration of the host ECL (that is restore all paths and flags set in step 2 to their default values) and then load that.

I hope this explains how everything works.

Best,
Marius

Am 27.06.21 um 23:00 schrieb Joshua Armenta:
Thanks, Marius.

So for Intel to M1, we’d need the binaries for M1 and use the byte compiler?

Sent from my iPhone

On Jun 27, 2021, at 11:32, Marius Gerbershagen <marius.gerbersha...@gmail.com> wrote:

 Dear Joshua,

it is possible to cross-compile lisp code using ECL. Basically, one
needs to set up paths the compiler and linker binaries as well as paths
to the include and library directories in the host compiler (built in
the first step of cross-compiling ECL itself, see the INSTALL file for
instructions) to point to the ones for the target system.

One can then call `compile-file` as usual, taking care to either load
files with the bytecompiler or compiling twice (once for the target and
once for the host) before loading.

For an example how this works, see the EQL5 project
https://gitlab.com/eql/EQL5-Android/ <https://gitlab.com/eql/EQL5-Android>. You could also look at https://gitlab.com/spaghettisalat/jffi_repl_example/blob/master/app/src/main/lisp/asdf_libs/compile.lisp <https://gitlab.com/spaghettisalat/jffi_repl_example/blob/master/app/src/main/lisp/asdf_libs/compile.lisp>
for an example with a basic asdf integration.

Best regards,
Marius Gerbershagen

Am 26.06.21 um 19:43 schrieb Joshua Armenta:
> Is there a flag to set another architecture type during the compilation
> process?
>
> For example I’m on an Intel Mac but I want to make a project build for
> ARM Mac (or a fat binary) to not use Rosetta 2 for that version.
>
> Or, I’m on a Mac but want to cross compile the lisp project/static
> library to windows.
>
> Trying to integrate some code into a CI platform. Thx!
>
> Sent from my iPhone
>
>
> *Disclaimer*
>
> The information contained in this communication from the sender is
> confidential. It is intended solely for use by the recipient and others
> authorized to receive it. If you are not the recipient, you are hereby
> notified that any disclosure, copying, distribution or taking action in
> relation of the contents of this information is strictly prohibited and
> may be unlawful.
>
> This email has been scanned for viruses and malware, and may have been
> automatically archived by Mimecast, a leader in email security and cyber
> resilience. Mimecast integrates email defenses with brand protection,
> security awareness training, web security, compliance and other
> essential capabilities. Mimecast helps protect large and small
> organizations from malicious activity, human error and technology
> failure; and to lead the movement toward building a more resilient
> world. To find out more, visit our website.
>


*Disclaimer*

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware, and may have been automatically archived by Mimecast, a leader in email security and cyber resilience. Mimecast integrates email defenses with brand protection, security awareness training, web security, compliance and other essential capabilities. Mimecast helps protect large and small organizations from malicious activity, human error and technology failure; and to lead the movement toward building a more resilient world. To find out more, visit our website.



Reply via email to