-
Notifications
You must be signed in to change notification settings - Fork 95
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
using vendorCargoDeps
leads to permission errors when building sqlite-sys
#249
Comments
I bet it's 18ef99b but I don't see how. |
@dpc Could you please provide a reproduction of the failure? I use |
Oh dear. :D Now that you mention it one difference might be that this is a cross-compilation to I'll try to minimize at some point, but it might take me a while before I can get to it. |
If it is of any help, here is the PR to our project that triggers it: fedimint/fedimint#1720 |
Cross compilation can get quite hairy, but I can try to take a quick look... @dpc what |
@ipetkov And yeah, it is. Though it's hairy outside of |
Fails to build with I also tried all other v.0.11.x and even some older versions for good measure, but it still fails to build, so I can't tell if this is a recent crane regression. |
|
Building with the latest commit on the master branch seems to work fine with v0.11.3
|
I don't understand how and why, but that command you're using does work for me, but when I run If you look at this PR (I just rebased it, but it didn't change anything): https://github.com/fedimint/fedimint/pull/1720/files I'm setting 😕 Will investigate more later. |
Oh. You're testing |
OK, so the root of the problem is removing
so I have to add that |
BTW. |
I have also confirmed that the problem is there with |
vendorCargoDeps
leads to permission errors when building sqlite-sys
|
@ipetkov OK. I think I've figured out the root cause. First, I've noticed that when I use
and doesn't have a So the problem is not the permissions, but the fact that Initially I suspected some timestamps, but that didn't seem like the case. Turns out the vedored > diff -u /nix/store/nvhhxpvphziaibzdgwbxa9k17hspp799-vendor-cargo-deps/config.toml /nix/store/xjp9wg7zqzcii8i29shwsijrb1fh3jd7-vendor-cargo-deps/config.toml
--- /nix/store/nvhhxpvphziaibzdgwbxa9k17hspp799-vendor-cargo-deps/config.toml 1969-12-31 16:00:01.000000000 -0800
+++ /nix/store/xjp9wg7zqzcii8i29shwsijrb1fh3jd7-vendor-cargo-deps/config.toml 1969-12-31 16:00:01.000000000 -0800
@@ -1,17 +1,17 @@
[source.nix-sources-c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0]
-directory = "/nix/store/nvhhxpvphziaibzdgwbxa9k17hspp799-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0"
+directory = "/nix/store/xjp9wg7zqzcii8i29shwsijrb1fh3jd7-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0"
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = "nix-sources-c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0"
[source.nix-sources-49a40141ec3504d7802b09cb1cadde46c2ab4d5c45cc1a77317d06cea31d69ad]
-directory = "/nix/store/nvhhxpvphziaibzdgwbxa9k17hspp799-vendor-cargo-deps/49a40141ec3504d7802b09cb1cadde46c2ab4d5c45cc1a77317d06cea31d69ad"
+directory = "/nix/store/xjp9wg7zqzcii8i29shwsijrb1fh3jd7-vendor-cargo-deps/49a40141ec3504d7802b09cb1cadde46c2ab4d5c45cc1a77317d06cea31d69ad"
[source.nix-sources-7b3ec600ad985a32a8367f459b9daa32421b08cf3f641c9eeed5b27bb8fe7916]
-directory = "/nix/store/nvhhxpvphziaibzdgwbxa9k17hspp799-vendor-cargo-deps/7b3ec600ad985a32a8367f459b9daa32421b08cf3f641c9eeed5b27bb8fe7916"
+directory = "/nix/store/xjp9wg7zqzcii8i29shwsijrb1fh3jd7-vendor-cargo-deps/7b3ec600ad985a32a8367f459b9daa32421b08cf3f641c9eeed5b27bb8fe7916"
[source.nix-sources-a68b9b47e08aa92cbe800ee65f8835d0ff8dc152cc7557a9e5dcbcffd188485d]
-directory = "/nix/store/nvhhxpvphziaibzdgwbxa9k17hspp799-vendor-cargo-deps/a68b9b47e08aa92cbe800ee65f8835d0ff8dc152cc7557a9e5dcbcffd188485d"
+directory = "/nix/store/xjp9wg7zqzcii8i29shwsijrb1fh3jd7-vendor-cargo-deps/a68b9b47e08aa92cbe800ee65f8835d0ff8dc152cc7557a9e5dcbcffd188485d"
[source.nix-sources-c6ac1166e8d5fb3cca134f5488fbc0796e323e56dab7b0dc4a84ae8cb361cdc3]
-directory = "/nix/store/nvhhxpvphziaibzdgwbxa9k17hspp799-vendor-cargo-deps/c6ac1166e8d5fb3cca134f5488fbc0796e323e56dab7b0dc4a84ae8cb361cdc3"
+directory = "/nix/store/xjp9wg7zqzcii8i29shwsijrb1fh3jd7-vendor-cargo-deps/c6ac1166e8d5fb3cca134f5488fbc0796e323e56dab7b0dc4a84ae8cb361cdc3"
[source."https://github.com/dpc/rust-secp256k1-zkp/?branch=sanket-pr"]
replace-with = "nix-sources-7b3ec600ad985a32a8367f459b9daa32421b08cf3f641c9eeed5b27bb8fe7916"
git = "https://github.com/dpc/rust-secp256k1-zkp/" As you can see the content is roughly the same, but the exact paths where the vendored dependencies are located are different, which (I think) is causing cargo to think that I don't know why content of that |
In addition the fact that this
It would probably be safest for |
Build scripts must not change any source files and only make changes to the |
I'm uncommenting these 3 lines, and commenting out the one right after:
Yes. But the build script is trying to overwrite a file that is already there as it's running again (it put this file there in the previous run), and now the file is ro because vendoring in /nix/store turned it into ro. |
@dpc here's what I noticed: Setting the following will break running commonArgsDepsOnly = commonArgsBase // {
cargoVendorDir = craneLib.vendorCargoDeps {
src = filterWorkspaceFiles ./.;
};
src = null;
# other args
}; BUT also setting the following fixes it again: commonArgs = commonArgsBase // {
src = filterWorkspaceFiles ./.;
cargoVendorDir = craneLib.vendorCargoDeps {
src = filterWorkspaceFiles ./.;
};
}; Clearly there is a difference between the explicit As to why this difference manifests in a build script failure I have absolutely no idea. I'd guess that if somehow the different filters are adding/omitting either a If you do manage to come up with a really small reproduction (both in terms of Nix configs and cargo dependencies) I'd love to see it! But until then, I've reached my limits in being able to debug your project given my lack of familiarity and its complexity. Hope this is useful! |
Well, the easy way to test it is to do:
(no filtering). And that also fails, all the same. So filtering is not an issue. I assume It seems to me that the difference is between my
I've described it couple of times, and I think it's important you understand:
The build script of
In normal (non
so overwriting it is not a problem, so the build script doesn't bother detecting if it exists, or deleting it. But in I don't know if it's necessary for |
Hmmm... just occurred to me that 18ef99b#diff-119bd89c89c2f9eb9fa8a9c1f9a1e98fb14f0d473bfe1d1061122fbb8053c178R42 is doing
when running recursive |
Alright, I found the issue: you are mixing artifacts from two different First apply this change to commonArgsDepsOnly = commonArgsBase // {
cargoVendorDir = craneLib.vendorCargoDeps {
src = filterWorkspaceFiles ./.;
};
src = null;
# other args
}; Then we check the vendored dependencies derivation this will create: nix show-derivation --accept-flake-config .#cross.aarch64-linux-android.client-pkgs | jq 'to_entries[].value.env.cargoVendorDir'
# "/nix/store/cy6498gn79brjz1mmpjp208q10kkk6v0-vendor-cargo-deps" Next we apply the second change to commonArgs = commonArgsBase // {
src = filterWorkspaceFiles ./.;
cargoVendorDir = craneLib.vendorCargoDeps {
src = filterWorkspaceFiles ./.;
};
}; Then we check the vendored dependencies derivation this will create: nix show-derivation --accept-flake-config .#cross.aarch64-linux-android.client-pkgs | jq 'to_entries[].value.env.cargoVendorDir'
# "/nix/store/vwgxblsq4z9c6hf0yaw7y53rfx4ykslb-vendor-cargo-deps" They are different! Let's compare their differences: diff -r /nix/store/cy6498gn79brjz1mmpjp208q10kkk6v0-vendor-cargo-deps /nix/store/vwgxblsq4z9c6hf0yaw7y53rfx4ykslb-vendor-cargo-deps
We can see that the vendoring is generating the same contents, except just Let's compare one of those vendored directories in more detail: diff -u \
<(nix show-derivation $(readlink /nix/store/cy6498gn79brjz1mmpjp208q10kkk6v0-vendor-cargo-deps/49a40141ec3504d7802b09cb1cadde46c2ab4d5c45cc1a77317d06cea31d69ad)) \
<(nix show-derivation $(readlink /nix/store/vwgxblsq4z9c6hf0yaw7y53rfx4ykslb-vendor-cargo-deps/49a40141ec3504d7802b09cb1cadde46c2ab4d5c45cc1a77317d06cea31d69ad)) The interesting thing this shows us is that the diff -u \
<(nix show-derivation /nix/store/h735ia59r947c75nca9hvdy74sh0gd0m-cargo-git) \
<(nix show-derivation /nix/store/y1xfjb5nqz1kv1r2jg51n9w50zz35dqy-cargo-git) Finally we see that one derivation depends on This highlights that the As to why vendoring with two different toolchains leads to different hashes |
Oh wow. I get it now. Thank you! Fixing this is going to be very inconvenient, as it requires parametrizing almost everything over |
Looked into this, although it is possible to build I'll document this limitation for the time being, thanks for reporting this! |
I fixed our flake.nix after all, it just requires parametrizing bunch of stuff over Closing and thanks for help! |
After upgrading crane:
and with some minor changes that are probably(?) unrelated cross-compiling sqlite is failing with:
The corresponding line in the build script: https://github.com/rusqlite/rusqlite/blob/9880cdef12c1b624e351ed077dd71a2f77978f77/libsqlite3-sys/build.rs#L101
The text was updated successfully, but these errors were encountered: