I'm trying to explore building ECL as a static library with the eventual goal of cross compiling the library to run it on a homebrew Nintendo Switch.
For starters, I wanted to see if it's possible to run example `embed` by linking ECL built as a static library rather than the system installation.
I tried to do this by uninstalling ECL from my system, and then running the following from the git repo:
./configure --disable-shared --prefix=`pwd`/mystaticlib
Then built ECL, I copied the headers and lib/libecl.a from the `mystaticlib` folder to the `embed` example directory, and tried modifying the Makefile to link the static library:
hello.exe: hello.c hello-lisp.a $(CC) -Iinclude -o $@ hello.c hello-lisp.a \ -Llib -lecl
Running the resulting executable gives a lot of undefined references, so I'm not sure if not everything gets built into libecl.a or if it's even possible to do what I'm trying to do. I'm not very proficient with C so sorry if this a dumb question, but any pointers would be greatly appreciated.
Hello,
Thanks for raising this question. It is a feature that was requested a few times already. ECL works when cross-compiled, but you need to compile it against the target's libc.
Currently ECL always (even when statically linked) links dynamically against the target libc (if you've ever seen an error for executables that glibc is not compatible - that's this sort of issue).
In the future (but not in the imminent release) I want to add the possibility to link with libc statically (i.e musl), so the executable may be moved between machines with incompatible libc libraries.
Best regards, Daniel
-- Daniel Kochmański ;; aka jackdaniel | Przemyśl, Poland TurtleWare - Daniel Kochmański | www.turtleware.eu
"Be the change that you wish to see in the world." - Mahatma Gandhi