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

Bumps cbindgen to 0.6.2 #112

Merged
merged 1 commit into from
Sep 18, 2018
Merged

Bumps cbindgen to 0.6.2 #112

merged 1 commit into from
Sep 18, 2018

Conversation

caugner
Copy link
Contributor

@caugner caugner commented Sep 6, 2018

  • Bump cbindgen version to 0.6.2 in accordance with bug 1485197.
  • Use rustc 1.26.0 or higher to compile cbindgen.

@caugner
Copy link
Contributor Author

caugner commented Sep 6, 2018

I tried to ./mach build on current mozilla-central (see below) in a nix-shell ~/git/nixpkgs-mozilla/release.nix -A gecko.x86_64-linux.gcc --pure, but got the following error:

$ ./mach build
(...)
 0:04.46 checking for rustc... /nix/store/zc2hk1ph861wfch8b8xzsnf7qjvsks94-rust-1.28.0-2018-07-30-9634041f0/bin/rustc
 0:04.46 checking for cargo... /nix/store/zc2hk1ph861wfch8b8xzsnf7qjvsks94-rust-1.28.0-2018-07-30-9634041f0/bin/cargo
 0:04.70 checking rustc version... 1.28.0
 0:04.74 checking cargo version... 1.28.0
 0:05.33 checking for rustdoc... /nix/store/zc2hk1ph861wfch8b8xzsnf7qjvsks94-rust-1.28.0-2018-07-30-9634041f0/bin/rustdoc
 0:05.33 checking for cbindgen... /nix/store/2yy52mncpx7hac6vxfr4b1dm5arx3sl3-rust-cbindgen-0.6.1/bin/cbindgen
 0:05.34 checking cbindgen version...
 0:05.34 DEBUG: Executing: `/nix/store/2yy52mncpx7hac6vxfr4b1dm5arx3sl3-rust-cbindgen-0.6.1/bin/cbindgen --version`
 0:05.34 ERROR: cbindgen version 0.6.1 is too old. At least version 0.6.2 is required.
 0:05.34 Please update using 'cargo install cbindgen --force' or running
 0:05.34 './mach bootstrap', after removing the existing executable located at
 0:05.34 /nix/store/2yy52mncpx7hac6vxfr4b1dm5arx3sl3-rust-cbindgen-0.6.1/bin/cbindgen.
 0:05.38 *** Fix above errors and then restart with\
 0:05.38                "/nix/store/cxgvqnp9cf8l1s58nplfzbwgwxnvkarc-gnumake-4.2.1/bin/make -f client.mk build"
 0:05.38 make: *** [client.mk:127: configure] Error 1
$ hg heads
hg heads
changeset:   435062:7569b575ea25
tag:         tip
fxtree:      central
parent:      435045:54cd02c97ed4
parent:      435061:fd88ac1e5391
user:        arthur.iakab <aiakab@mozilla.com>
date:        Thu Sep 06 19:48:04 2018 +0300
summary:     Merge inbound to mozilla-central.  a=merge

Bumping cbindgen to 0.6.2 (see this PR) should solve this, but unfortunately lead to the following error when entering/creating the nix-shell:

$ nix-shell ~/git/nixpkgs-mozilla/release.nix -A gecko.x86_64-linux.gcc --pure
these derivations will be built:
  /nix/store/kyk97z632r3lbgb18s89dry9caacl7sb-rust-cbindgen-0.6.2.drv
building '/nix/store/kyk97z632r3lbgb18s89dry9caacl7sb-rust-cbindgen-0.6.2.drv'...
unpacking sources
unpacking source archive /nix/store/9wjmf4lzimk76qh55nw3xvblx68f5dn4-source
source root is source
unpacking source archive /nix/store/bxz7vbibhyp2w4qi21a525ar7jxln9ha-rust-cbindgen-0.6.2-vendor
patching sources
configuring
building
Running cargo build --release
   Compiling cfg-if v0.1.3
   Compiling remove_dir_all v0.5.1
   Compiling libc v0.2.41
   Compiling vec_map v0.8.1
   Compiling quote v0.3.15
   Compiling strsim v0.7.0
   Compiling bitflags v1.0.3
   Compiling itoa v0.4.1
   Compiling unicode-width v0.1.5
   Compiling ansi_term v0.11.0
   Compiling unicode-xid v0.0.4
   Compiling unicode-xid v0.1.0
   Compiling dtoa v0.4.2
   Compiling serde v1.0.64
   Compiling log v0.4.1
   Compiling rand v0.4.2
   Compiling atty v0.2.10
   Compiling textwrap v0.9.0
   Compiling synom v0.11.3
   Compiling proc-macro2 v0.4.4
   Compiling log v0.3.9
   Compiling syn v0.11.11
   Compiling clap v2.31.2
   Compiling tempdir v0.3.7
   Compiling quote v0.6.3
   Compiling syn v0.14.1
   Compiling serde_derive_internals v0.17.0
   Compiling serde_derive v1.0.21
   Compiling serde_json v1.0.19
   Compiling toml v0.4.6
   Compiling cbindgen v0.6.2 (file:///build/source)
error: non-reference pattern used to match a reference (see issue #42640)
  --> src/bindgen/cargo/cargo_expand.rs:62:12
   |
62 |     if let Some(features) = expand_features {
   |            ^^^^^^^^^^^^^^ help: consider using a reference: `&Some(features)`

error: non-reference pattern used to match a reference (see issue #42640)
  --> src/bindgen/ir/cfg.rs:60:13
   |
60 |             Cfg::Boolean(key) => write!(f, "{}", key),
   |             ^^^^^^^^^^^^^^^^^ help: consider using a reference: `&Cfg::Boolean(key)`

error: non-reference pattern used to match a reference (see issue #42640)
  --> src/bindgen/ir/cfg.rs:61:13
   |
61 |             Cfg::Named(key, value) => write!(f, "{} = {:?}", key, value),
   |             ^^^^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&Cfg::Named(key, value)`

error: non-reference pattern used to match a reference (see issue #42640)
  --> src/bindgen/ir/cfg.rs:62:13
   |
62 |             Cfg::Any(cfgs) => {
   |             ^^^^^^^^^^^^^^ help: consider using a reference: `&Cfg::Any(cfgs)`

error: non-reference pattern used to match a reference (see issue #42640)
  --> src/bindgen/ir/cfg.rs:72:13
   |
72 |             Cfg::All(cfgs) => {
   |             ^^^^^^^^^^^^^^ help: consider using a reference: `&Cfg::All(cfgs)`

error: non-reference pattern used to match a reference (see issue #42640)
  --> src/bindgen/ir/cfg.rs:82:13
   |
82 |             Cfg::Not(cfg) => write!(f, "not({})", cfg),
   |             ^^^^^^^^^^^^^ help: consider using a reference: `&Cfg::Not(cfg)`

error: non-reference pattern used to match a reference (see issue #42640)
   --> src/bindgen/ir/cfg.rs:242:28
    |
242 |                     .find(|(key, ..)| DefineKey::Boolean(&cfg_name) == DefineKey::load(key));
    |                            ^^^^^^^^^ help: consider using a reference: `&(key, ..)`

error: non-reference pattern used to match a reference (see issue #42640)
   --> src/bindgen/ir/cfg.rs:254:58
    |
254 |                 let define = config.defines.iter().find(|(key, ..)| {
    |                                                          ^^^^^^^^^ help: consider using a reference: `&(key, ..)`

error: non-reference pattern used to match a reference (see issue #42640)
   --> src/bindgen/ir/ty.rs:179:13
    |
179 |             ArrayLength::Name(ref string) | ArrayLength::Value(ref string) => string,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&ArrayLength::Name(ref string)`

error: non-reference pattern used to match a reference (see issue #42640)
   --> src/bindgen/ir/ty.rs:179:45
    |
179 |             ArrayLength::Name(ref string) | ArrayLength::Value(ref string) => string,
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&ArrayLength::Value(ref string)`

error: non-reference pattern used to match a reference (see issue #42640)
   --> src/bindgen/ir/ty.rs:503:24
    |
503 |                 if let ArrayLength::Name(ref mut name) = len {
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&ArrayLength::Name(ref mut name)`

error: aborting due to 11 previous errors

error: Could not compile `cbindgen`.

To learn more, run the command again with --verbose.
builder for '/nix/store/kyk97z632r3lbgb18s89dry9caacl7sb-rust-cbindgen-0.6.2.drv' failed with exit code 101
error: build of '/nix/store/kyk97z632r3lbgb18s89dry9caacl7sb-rust-cbindgen-0.6.2.drv' failed

rust-lang/rust#42640 explains the background of the errors, but I'm not sure how to fix these in our context (especially given that simply bumping the version worked in NixOS/nixpkgs@cdf9025).

Do we maybe need to compile with a newer rustc or cargo?

I locally added a postUnpack to the cbindgen/default.nix:

postUnpack = ''
    rustc --version
    cargo --version
  '';

This produced the following output:

rustc 1.24.0
cargo 0.25.0

But we need at least rustc 1.26 according to harababurel/gcsf#12 (comment) and hyperledger-archives/indy-sdk#910 (comment).

@nbp
Copy link
Collaborator

nbp commented Sep 18, 2018

I am seeing the same issue.

But we need at least rustc 1.26 according to […]

The problem is that Nixpkgs is out-of-date, and we have to provide a rustPlatform dependency which has a newer version. makeRustPlaftorm should be the solution except that it does not work properly as rustc package does not have any idea of the location of the sysroot, to locate the std files.

@nbp
Copy link
Collaborator

nbp commented Sep 18, 2018

I managed to fix this issue locally, I will merge this changes before adding my changes on top to fix the second issue.

@nbp nbp merged commit 2704522 into mozilla:master Sep 18, 2018
@caugner caugner deleted the cbindgen-0.6.2 branch September 18, 2018 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants