Here is a patch that will make CFFI play better with ASDF bundles. This allows delivery with a single .so and/or .a file for all the wrappers in a system, which can be automatically linked into ECL (and in the future, in SBCL or other implementations, for application delivery).
Also, report for a bug, not fixed in the attached patch: compiling, linking, etc., should be atomic, by using temporary pathnames; otherwise, there is a race condition when multiple processes try to execute a script that depends on a CFFI library. Recent-enough ASDF 3.1.2 provides with-temporary-file to help, and 3.1.5 uses it internally for its own targets, but some implementations still lag behind with ASDF 3.0.x, and ASDF can't backwards-compatibly use with-temporary-file for you, so you must use it yourself.
This patch also drops support for ASDF 2 or earlier, because backwards compatibility is hard, and not necessary: today, all implementations provide ASDF 3.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org The least deviation from truth will be multiplied later. — Aristotle
PING.
Here's an updated version of my patch, with fixes for monolithic-lib-op.
Should I create a pull request on github instead?
Note that the static linking magic works on Windows and Linux but not BSD (but that's no regression).
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org Paradoxes only exist in language, not reality. — Eric S. Raymond
On Wed, Sep 16, 2015 at 11:29 PM, Faré fahree@gmail.com wrote:
Here is a patch that will make CFFI play better with ASDF bundles. This allows delivery with a single .so and/or .a file for all the wrappers in a system, which can be automatically linked into ECL (and in the future, in SBCL or other implementations, for application delivery).
Also, report for a bug, not fixed in the attached patch: compiling, linking, etc., should be atomic, by using temporary pathnames; otherwise, there is a race condition when multiple processes try to execute a script that depends on a CFFI library. Recent-enough ASDF 3.1.2 provides with-temporary-file to help, and 3.1.5 uses it internally for its own targets, but some implementations still lag behind with ASDF 3.0.x, and ASDF can't backwards-compatibly use with-temporary-file for you, so you must use it yourself.
This patch also drops support for ASDF 2 or earlier, because backwards compatibility is hard, and not necessary: today, all implementations provide ASDF 3.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org The least deviation from truth will be multiplied later. — Aristotle
Should I create a pull request on github instead?
Note that the static linking magic works on Windows and Linux but not BSD (but that's no regression).
OK, I created a pull request on github. It also includes a bug fix as compared to my previous email.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org He who says he will die for a cause will probably lie for it and may kill for it. — John McCarthy
On Thu, Sep 24, 2015 at 7:02 AM, Faré fahree@gmail.com wrote:
OK, I created a pull request on github. It also includes a bug fix as compared to my previous email.
Sorry, busy times. A pull request is indeed more convenient. Thanks!
I've kept working on that pull request, and added support for statically linked executables on sbcl, as well as moved basic C toolchain support to its own file.
Maybe grovel/c-toolchain.lisp and grovel/sbcl.lisp should be moved to ASDF itself, but that's not going to happen for many months at least — and even if it were done today, it'd be years before you may rely on it to be ubiquitous.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org You live and learn. Or you don't live long. — Robert Heinlein, "Time Enough For Love"
On Thu, Sep 24, 2015 at 5:22 AM, Luís Oliveira luismbo@gmail.com wrote:
On Thu, Sep 24, 2015 at 7:02 AM, Faré fahree@gmail.com wrote:
OK, I created a pull request on github. It also includes a bug fix as compared to my previous email.
Sorry, busy times. A pull request is indeed more convenient. Thanks!
-- Luís Oliveira http://kerno.org/~luis/
On Tue, Sep 29, 2015 at 1:54 PM, Faré fahree@gmail.com wrote:
I've kept working on that pull request, and added support for statically linked executables on sbcl, as well as moved basic C toolchain support to its own file.
Maybe grovel/c-toolchain.lisp and grovel/sbcl.lisp should be moved to ASDF itself, but that's not going to happen for many months at least — and even if it were done today, it'd be years before you may rely on it to be ubiquitous.
For cross-reference purposes, the pull request I'm talking about is at: https://github.com/cffi/cffi/pull/73
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org The common argument that crime is caused by poverty is a kind of slander on the poor. — H. L. Mencken
For cross-reference purposes, the pull request I'm talking about is at: https://github.com/cffi/cffi/pull/73
I've worked at it some more, as you can see in the pull request.
I understand you're busy. If you have time, please tell me at least whether I'm on the right track, or if I'm wasting my time on something you're never going to merge.
In the mean time, I've got a proof of concept of making static linking work not just on sbcl, but also on clisp (though sbcl requires a patch that isn't upstream yet, and the clisp support is not expected to be portable as is).
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org The most urgent, is not that Government should teach, but that it should let teach. All monopolies are despicable, but the worst of them all, is the monopoly on education. — F. Bastiat
Dear CFFI developers,
do you think c-toolchain and static-link belong in CFFI, or in ASDF (or in a new system to be spawned)?
If you believe they belong in ASDF, I could try to move them there — but that means CFFI-grovel will have a dependency on a recent ASDF (or on that new system).
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org The ultimate result of shielding men from the effects of folly is to fill the world with fools. — Herbert Spencer
On Wed, Oct 7, 2015 at 6:35 AM, Faré fahree@gmail.com wrote:
Dear CFFI developers,
do you think c-toolchain and static-link belong in CFFI, or in ASDF (or in a new system to be spawned)?
If you believe they belong in ASDF, I could try to move them there — but that means CFFI-grovel will have a dependency on a recent ASDF (or on that new system).
cffi-grovel is a good home for this new functionality, as it nicely complements the groveller's functionality for building helper libraries. Perhaps a separate system (even if it's included in the CFFI repo) would make sense too since the two functionalities are orthogonal, AFAICT.
I don't fully see the repercussions of extracting c-toolchain and static-link out off cffi-grovel. If it's easy and you think it's a good idea, then please go ahead. In any case, as I mentioned in the pull request, I think User Manual documentation and tests have higher priority at this point.
Cheers,