Skip to content
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-vendor: 0.1.13 -> 0.1.23 #57017

Merged
merged 3 commits into from Apr 21, 2019
Merged

cargo-vendor: 0.1.13 -> 0.1.23 #57017

merged 3 commits into from Apr 21, 2019

Conversation

akru
Copy link
Contributor

@akru akru commented Mar 7, 2019

Motivation for this change

Upgrade cargo-vendor to 0.1.23 is required for support build edition 2018 crates.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@akru
Copy link
Contributor Author

akru commented Mar 7, 2019

@GrahamcOfBorg build cargo-vendor

@akru akru changed the title cargo-vendor: 0.1.13 -> 0.1.23 WIP cargo-vendor: 0.1.13 -> 0.1.23 Mar 7, 2019
@@ -14,7 +14,7 @@ in
buildInputs = [ openssl zlib curl ]
++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation libiconv ];
# TODO: buildRustCrate seems to use incorrect default inference
crateBin = [ { name = "cargo"; path = "src/bin/cargo.rs"; } ];
crateBin = [ { name = "cargo"; path = "src/bin/cargo/main.rs"; } ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the path attribute. Since fc5e595 we are doing the right thing(tm) within buildRustCrate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, fixed

@akru
Copy link
Contributor Author

akru commented Mar 7, 2019

Unfortunately with big crate deps list (like a parity) cargo-vendor has segfault in libcurl.so. WIP

@andir
Copy link
Member

andir commented Mar 7, 2019

I am only seeing

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/glsy9j0x5j23sq1rqnazs1jvd9hd7mxl-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "installPhase" }
installing
    Updating git repository `https://github.com/cheme/heapsize.git`
    Updating crates.io index
    Updating git repository `https://github.com/paritytech/rust-secp256k1`
    Updating git repository `https://github.com/paritytech/app-dirs-rs`
    Updating git repository `https://github.com/paritytech/bn`
    Updating git repository `https://github.com/paritytech/jsonrpc.git`
    Updating git repository `https://github.com/paritytech/hidapi-rs`
    Updating git repository `https://github.com/paritytech/libusb-rs`
    Updating git repository `https://github.com/paritytech/trezor-sys`
    Updating git repository `https://github.com/paritytech/rust-ctrlc.git`
    Updating git repository `https://github.com/paritytech/libusb-sys`
    Updating git repository `https://github.com/tomusdrw/ws-rs`
 Downloading crates ...
  Downloaded digest v0.7.6
  Downloaded crossbeam-deque v0.5.2
Traceback (most recent call last):
  File "/nix/store/7qnming9jgiqb6hk2pqfmgp4dn60vs5r-cargo-vendor-normalise/bin/.cargo-vendor-normalise-wrapped", line 42, in <module>
    main()
  File "/nix/store/7qnming9jgiqb6hk2pqfmgp4dn60vs5r-cargo-vendor-normalise/bin/.cargo-vendor-normalise-wrapped", line 17, in main
    assert list(data.keys()) == ["source"]
AssertionError

When running nix-build -I nixpkgs=. -A parity.cargoDeps --check on this PR.
Is that what you are seeing?

EDIT: Now I see the segfault in dmesg: cargo-vendor[31122]: segfault at 576d ip 00007ffff7f93ac5 sp 00007ffffffee100 error 4 in libcurl.so.4.5.0[7ffff7f4e000+61000]

@akru
Copy link
Contributor Author

akru commented Mar 7, 2019

Traceback (most recent call last):
  File "/nix/store/7qnming9jgiqb6hk2pqfmgp4dn60vs5r-cargo-vendor-normalise/bin/.cargo-vendor-normalise-wrapped", line 42, in <module>
    main()
  File "/nix/store/7qnming9jgiqb6hk2pqfmgp4dn60vs5r-cargo-vendor-normalise/bin/.cargo-vendor-normalise-wrapped", line 17, in main
    assert list(data.keys()) == ["source"]
AssertionError

@andir This assertion is you catch because cargo vendor program fails with segmentation fault. You can see it in dmesg log.

Looks like:

[ 1277.594384] cargo-vendor[18115]: segfault at 318 ip 00007ffff7f93ac5 sp 00007ffffffedfe0 error 4 in libcurl.so.4.5.0[7ffff7f4e000+61000]

@dtzWill
Copy link
Member

dtzWill commented Mar 8, 2019

FWIW this seems to be working for me? If I'm the only one NOT seeing segfaults I can investigate further... I am building on top of staging's rust bump to 1.33-- no clue if that's relevant :).

@andir
Copy link
Member

andir commented Mar 8, 2019

@dtzWill how did you test it? I had to run --check on the cargoDeps attribute to actually re-run the whole cargo-vendor thing.

@dtzWill
Copy link
Member

dtzWill commented Mar 8, 2019 via email

@andir
Copy link
Member

andir commented Mar 8, 2019

@GrahamcOfBorg build parity.cargoDeps

Does ofBorg also have --check?

@dywedir dywedir mentioned this pull request Mar 10, 2019
10 tasks
@andir
Copy link
Member

andir commented Mar 14, 2019

@dtzWill I tried to again on a newly installed NixOS packet.net machine. Cloned nixpkgs and ran nix-build -I nixpkgs=. '<nixpkgs>' -A parity.cargoDeps --check. Segfaults like on all my other machines.

What differences are there between our systems?

@L-as
Copy link
Member

L-as commented Mar 14, 2019

FWIW I'm not seeing any failures with the command andir posted.

@flokli
Copy link
Contributor

flokli commented Mar 14, 2019

I was able to reproduce this after a second try:

⇒  nix-build -I nixpkgs=. -A parity.cargoDeps --check
checking outputs of '/nix/store/fvqwb3q1yf8kv2h4ld8v0ij92v51g7lw-parity-2.2.9-vendor.drv'...
unpacking sources
unpacking source archive /nix/store/glsy9j0x5j23sq1rqnazs1jvd9hd7mxl-source
source root is source
patching sources
installing
    Updating git repository `https://github.com/cheme/heapsize.git`
    Updating crates.io index
    Updating git repository `https://github.com/paritytech/rust-secp256k1`
    Updating git repository `https://github.com/paritytech/app-dirs-rs`
    Updating git repository `https://github.com/paritytech/bn`
    Updating git repository `https://github.com/paritytech/jsonrpc.git`
    Updating git repository `https://github.com/paritytech/hidapi-rs`
    Updating git repository `https://github.com/paritytech/libusb-rs`
    Updating git repository `https://github.com/paritytech/trezor-sys`
    Updating git repository `https://github.com/paritytech/rust-ctrlc.git`
    Updating git repository `https://github.com/paritytech/libusb-sys`
    Updating git repository `https://github.com/tomusdrw/ws-rs`
 Downloading crates ...
  Downloaded url v1.7.1
  Downloaded indexmap v1.0.2
Traceback (most recent call last):
  File "/nix/store/7qnming9jgiqb6hk2pqfmgp4dn60vs5r-cargo-vendor-normalise/bin/.cargo-vendor-normalise-wrapped", line 42, in <module>
    main()
  File "/nix/store/7qnming9jgiqb6hk2pqfmgp4dn60vs5r-cargo-vendor-normalise/bin/.cargo-vendor-normalise-wrapped", line 17, in main
    assert list(data.keys()) == ["source"]
AssertionError
builder for '/nix/store/fvqwb3q1yf8kv2h4ld8v0ij92v51g7lw-parity-2.2.9-vendor.drv' failed with exit code 1
error: build of '/nix/store/fvqwb3q1yf8kv2h4ld8v0ij92v51g7lw-parity-2.2.9-vendor.drv' failed

dmesg:

[333635.128291] cargo-vendor[4457]: segfault at 0 ip 00007ffff77c430e sp 00007ffffffed820 error 4 in libc-2.27.so[7ffff7778000+13d000]
[333635.128296] Code: 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 41 57 41 56 41 55 41 54 55 53 48 89 f3 48 0f af da 48 83 ec 08 48 85 db 0f 84 22 01 00 00 <8b> 01 49 89 fc 49 89 f2 49 89 c9 25 00 80 00 00 75 59 4c 8b 81 88

@dtzWill
Copy link
Member

dtzWill commented Mar 15, 2019

To be clear, I've been using this on top of my normal branch and not the exact tree here, and there are many reasons I'd be seeing different behavior-- but MOSTLY the bits that turn out well I send upstream so I don't think I'm sitting on anything relevant.

The most obvious difference is I'm using the rust 1.33 updates from our staging branch-- and I don't know what changed in 1.33 but "fixing things that cause crashes" sounds plausible enough to check it out ;).

When my builders have a chance I'll try the tree here and maybe on a few machines... heisenbug is lame!

@timokau timokau changed the title WIP cargo-vendor: 0.1.13 -> 0.1.23 [WIP] cargo-vendor: 0.1.13 -> 0.1.23 Apr 7, 2019
@akru akru changed the title [WIP] cargo-vendor: 0.1.13 -> 0.1.23 cargo-vendor: 0.1.13 -> 0.1.23 Apr 18, 2019
@akru
Copy link
Contributor Author

akru commented Apr 18, 2019

As I see it fixed in latest cargo-vendor.

@akru
Copy link
Contributor Author

akru commented Apr 18, 2019

@GrahamcOfBorg build cargo-vendor

@sondr3
Copy link
Contributor

sondr3 commented Apr 18, 2019

This would be really nice to have, just ran into issues with the old version of cargo-vendor with lto = "thin", fingers crossed this works out 😄

@lilyball
Copy link
Member

lilyball commented Apr 20, 2019

What's the current status of this? It looks like I can't update ffsend right now due to the current cargo-vendor not understanding a dependency of the form clip = { version = "0.5", optional = true, package = "clipboard" } (e.g. where the actual package name doesn't match the dependency name), and this update fixes that.

Incidentally, I can't build this on macOS. I tried merging it into current master and building, and rust_cargo-0.35.0 fails to build, saying it can't find the Security framework (which according to the .drv is not listed as a buildInput).

@@ -13,15 +13,15 @@ in
cargo = attrs: {
buildInputs = [ openssl zlib curl ]
++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation libiconv ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like my macOS build error can be fixed with

Suggested change
++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation libiconv ];
++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation Security libiconv ];

Of course, then I get the same error for cargo-vendor itself, so the same fix needs to be applied there too.

@@ -13,15 +13,15 @@ in
cargo = attrs: {
buildInputs = [ openssl zlib curl ]
++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation libiconv ];
# TODO: buildRustCrate seems to use incorrect default inference
crateBin = [ { name = "cargo"; path = "src/bin/cargo.rs"; } ];
};

cargo-vendor = attrs: {
buildInputs = [ openssl zlib curl ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
buildInputs = [ openssl zlib curl ];
buildInputs = [ openssl zlib curl ]
++ stdenv.lib.optionals stdenv.isDarwin [ Security ];

@lilyball lilyball mentioned this pull request Apr 20, 2019
10 tasks
@andir
Copy link
Member

andir commented Apr 20, 2019

I've been trying to reproduce the segfault we did observe with this rebased onto currentmaster. After 6 rebuilds there hasn't been a single segfault. Currently trying to reproduce it on another machine but that also succeeded for a few times. I hope this isn't due to the host being on nixos-19.03 now...

@lilyball can you apply the mentioned fix to cargo to figure out if this package (and the users) work on master for Darwin? I do not own any of that hardware :/

@lilyball
Copy link
Member

lilyball commented Apr 20, 2019

@andir I already applied the two fixes I suggested and successfully built cargo-vendor-0.1.23 (and ffsend-0.2.45) on Darwin.

akru and others added 3 commits April 21, 2019 12:11
This is supposedly fixing the build of the cargo crate on Drawin [1].

[1] NixOS#57017 (review)
This is supposedly fixing the build of the cargo crate on Drawin [1].

[1] NixOS#57017 (review)
@andir
Copy link
Member

andir commented Apr 21, 2019

@lilyball does this look alright now?

@lilyball
Copy link
Member

@andir Yes, it builds just fine on Darwin now.

@andir andir merged commit ee3b96c into NixOS:master Apr 21, 2019
c0bw3b pushed a commit to c0bw3b/nixpkgs that referenced this pull request Apr 22, 2019
This is supposedly fixing the build of the cargo crate on Drawin [1].

[1] NixOS#57017 (review)
c0bw3b pushed a commit to c0bw3b/nixpkgs that referenced this pull request Apr 22, 2019
This is supposedly fixing the build of the cargo crate on Drawin [1].

[1] NixOS#57017 (review)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants