Statically linking C code into ECL

Faré fahree at gmail.com
Tue Dec 27 18:38:57 UTC 2016


On Tue, Dec 27, 2016 at 3:07 AM, Daniel Kochmański <daniel at turtleware.eu> wrote:
>> Unhappily, neither *user-cc-flags* nor *ld-flags* allows me to get the
>> desired result:
>> the former is not used by build-program, and the latter is only used
>> *after* passing the list of .a, too late for a -Wl,--whole-archive.
>> Moreover, on Darwin and/or with lld, I need to use -Wl,-force_load
>> before each individual .a instead, and the current interface won't
>> allow that.
>
> What about the proposed usage of :ld-flags passed to the builder?
>
Its behavior is the same as *ld-flags*, and cannot help for the same
reasons. I really need that -Wl,--whole-archive before all the .a's
and --no-whole-archive after, and/or -force_load flag before each of
them on Darwin (or lld).

>> PS: Regarding using c:build-program instead of c::builder :program,
>> when was the change made? Do I need to care about supporting older
>> versions of ECL?
>
> It's in place since 2001 (or earlier) according to git blame.
>
Whoa, so even the 2005 code of asdf-ecl was outdated. Well, thanks for that,
it will be fixed in 3.2.1 if not 3.2.0.

In other news, with a patch to ASDF in !66 and my latest cffi fork,
by linking all individual objects rather than .a files, I managed to
statically compile
an executable with C extension (hello/chello from the bazelisp example):
https://gitlab.common-lisp.net/asdf/asdf/merge_requests/66
https://github.com/fare/cffi
https://github.com/qitab/bazelisp

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
The real danger is that one day machines *will* become intelligent,
but we'll lack the mental equipment to notice.
               — Tiresias, in J.-P. Petit, "Run, Robot, Run"



More information about the ecl-devel mailing list