-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo install <library_name> --library #2552
Comments
Thanks for the report! I'm a little confused as to what's going on here as I'm not very familiar with nix, however. Are you basically thinking that we could benefit from a crate cache of some form, and that specifically comes up here where everything is in a new directory? Are you using Cargo and somehow just running cargo with a different target directory each time right now? |
The problem I'm trying to solve is improving compile times for Fractalide components. Ah okay, let me go into more detail:
Basically I'm using Now we have created a modular dataflow framework where every component is a Rust shared object with defined inputs and outputs. Each component is a As I mentioned earlier, should a component have crates.io deps which are large ie This is a super niche feature, that "we" as in the greater rust community probably won't benefit much from atm. I created this issue as I'd like to sound this idea to see if it can be incorporated upstream thus I do not have to maintain a specialized version of |
Here is an example of where we copy the output to the (I just noticed the indentation on those sections is buggered, I'll fix it shortly.) |
Ok, thanks the explanation! Unfortunately right now binary distribution of Rust libraries is pretty hard due to the super-unstable ABI and the ways that Cargo manages dependencies. We haven't currently provided Perhaps the output directories could be cached between builds and overlaid with each other to produce the final artifact in your build tool? That may have the effect of caching dependencies, but I admit to still not fully understand how the underlying build is working :( |
Alex, appreciate it, I'll find a way to hack this one. Bit of a nasty
problem.
I also wanted to say, you're doing a really fine job working on Rust and
with the community.
|
Ok, feel free to keep this issue updated with your progress! |
Just happened to drop by (I was looking around for a rust package importer for Nix) and will offer my two cents: In the case of Nix, an unstable ABI is not an issue, as each package instance is hard-coded to depend on a specific binary, with specific build tools and any other input factors. Whether versions differ in major, minor or patchlevel doesn't matter -- bash 4.3.46 compiled with gcc 5.0.1 and glibc 2.23.1 is a different package instance from bash 4.3.46 compiled with gcc 5.0.2 or glibc 2.23.2. The semantic contents of each package is deterministic and reproducible, and the byte contents of a majority of packages is deterministic and reproducible. The same goes for Guix. So in the Nix/Guix case, installation of libraries would be worthwhile, and the package manager would handle the distribution. |
Yeah, i'd make use of that rust package importer in a heartbeat for
fractalide.
We've worked a way around this issue on nix actually, but an importer would
mean we don't have to hit crate.io so many times for each component in
fractalide.
Do let me know if you're going to build one please.
|
My use case for this is to wrap a built library from Python. I would like to issue a The Python wheel format encodes the platform information that it is building for, so this should allow the end user to pip install and pip will choose the one that matches their platform. My WIP is here: https://github.com/davidblewett/rure-python . This Python package expects the static shared object built for |
Is there any progress on this? Would love to have this for Nix builds as well. |
FWIW I think GHC, the haskell compiler, has the same concerns around ABI stability, they solve this by essentially requiring the installed libraries to be using the same compiler and settings etc. As mentioned above, for Nix specifically this isn't a problem. |
Platform: Nixos
It would be really nice to be able to issue the command
cargo install <library name>
Or at least allow for installing of libraries by explicitly appending
--library
i.e.cargo install <library_name> --library
We currently have an issue, in that a crate and all its dependencies are compiled to a unique folder name, in the form of
/nix/store/<hash>-shared_object_name
.Now if we change a single line of the code, the code and all the dependencies will be recompiled and put in a new folder i.e.
/nix/store/<new-hash>-shared_object_name
.Thus it makes using crates with large dependencies such as
piston
, a pain, as each time we change code, the resulting compile time can be over a minute.Hence I'd like to split out the dependencies of each crate and put them into their own folder i.e.
/nix/store/<hash>-dependency1_name
and make use of the.cargo/config
to override the.toml
dependencies to/nix/store/<hash>-dependency1_name
, so that they are not recompiled each time I change a line of code in myshared object
.The text was updated successfully, but these errors were encountered: