Hi Hartmut and Pjotr,

My feeling on this is that we should partner with the Rust community to make shared library support from cargo a priority.  Specifying an output directory is currently a nightly feature, that could be helpful.

In general Rust tooling does not compose with existing tools.  I believe they will be amenable to the thought that it should. If Rust wants to be used in the linux kernel, for instance, it should be easy to use with Make. 

Rust has a very well documented rfc process and we can at least bring it up that way.  I brought up the possibility of collaboration between rust and functional package managers on the rust Zulip, even.  They seemed to like the idea.

Another path we should checkout is to see what Debian does. My understanding is that they figured something out.  Worth a shot, but I’d rather the problem be fixed upstream. It will just take collaboration.

Kindly,

John




On Monday, Jun 07, 2021 at 5:04 AM, Hartmut Goebel <h.goebel@crazy-compilers.com> wrote:
Am 07.06.21 um 10:28 schrieb Pjotr Prins:
Exactly my idea. One challenge will be that the source of dependencies
need to be available - think of it as include files. One thing we
could do as ship them as part of the Guix package. Or have a separate
one for sources. We do that for include files already.

Well, the current cargo-build-system already handles the source
dependencies.

We need to aim towards pre-built libraries (rlib, much like .a files in
C, I assume)

When cargo calls rustc, the command looks like:

LD_LIBRARY_PATH='$PWD/target/release/deps:/gnu/store/…-rust-1.45.2/lib' \
rustc … src/lib.rs --crate-type lib \
-L dependency=$PWD/target/release/deps \
--extern
xmlparser=$PWD/target/release/deps/libxmlparser-53596ac1828b1c97.rmeta

Thus I assume one could pass the rlib's of all dependencies in -L and
the respective mata-data in --extern

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| https://urldefense.com/v3/__http://www.crazy-compilers.com__;!!IKRxdwAv5BmarQ!KvLeCSlBvF9faFS6qJxYA0Rl0AuuhxYx7oxMtZXdbILpmv_Rz4n8swX7_p74sQ$ | compilers which you thought are impossible |