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

ffi: Cache cbindgen intermediates from build to build #13

Merged
merged 1 commit into from
Oct 19, 2020

Conversation

jrose-signal
Copy link
Contributor

No description provided.

@jrose-signal
Copy link
Contributor Author

Jack, were you seeing issues without this setting?

Copy link
Contributor

@jack-signal jack-signal left a comment

Choose a reason for hiding this comment

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

I found this necessary when running cbindgen from the command line - on the first build it would succeed, and then if run again without making any change to the source, you get an error like this

RROR: Parsing crate `libsignal-ffi`: couldn't run `cargo rustc --pretty=expanded`: Compile("       Fresh unicode-xid v0.2.1\n       Fresh cfg-if v0.1.10\n...

I assume this is some bug in cbindgen. However with the header generation integrated into build.rs this may not matter anymore. It was obnoxious at the time because I was doing fast iteration and sometimes would do things like

$ cbindgen
#oops forgot to redirect to a file
$ cbindgen > signal_ffi.h # fails
# make spurious edit to lib.rs
$ cbindgen > signal_ffi.h # works

@jrose-signal
Copy link
Contributor Author

Given that the integration into build.rs is slowing down the build, I might undo that…but regardless, I haven't seen the same error. Maybe it's a nightly vs. stable issue, or something fixed by a newer nightly rustc or cbindgen? What's the whole error message?

@jack-signal
Copy link
Contributor

ERROR: Parsing crate `libsignal-ffi`: couldn't run `cargo rustc --pretty=expanded`: Compile("       Fresh unicode-xid v0.2.1\n       Fresh cfg-if v0.1.10\n       Fresh version_check v0.9.2\n       Fresh autocfg v1.0.1\n       Fresh ppv-lite86 v0.2.9\n       Fresh remove_dir_all v0.5.3\n       Fresh unicode-segmentation v1.6.0\n       Fresh either v1.6.1\n       Fresh bytes v0.5.6\n       Fresh hashbrown v0.9.1\n       Fresh subtle v2.3.0\n       Fresh unicode-width v0.1.8\n       Fresh fixedbitset v0.2.0\n       Fresh strsim v0.8.0\n       Fresh multimap v0.8.2\n       Fresh ansi_term v0.11.0\n       Fresh opaque-debug v0.3.0\n       Fresh vec_map v0.8.2\n       Fresh itoa v0.4.6\n       Fresh cpuid-bool v0.1.2\n       Fresh block-padding v0.2.1\n       Fresh arrayref v0.3.6\n       Fresh heck v0.3.1\n       Fresh itertools v0.8.2\n       Fresh textwrap v0.11.0\n       Fresh proc-macro2 v1.0.24\n       Fresh libc v0.2.79\n       Fresh typenum v1.12.0\n       Fresh anyhow v1.0.33\n       Fresh log v0.4.11\n       Fresh byteorder v1.3.4\n       Fresh ryu v1.0.5\n       Fresh bitflags v1.2.1\n       Fresh quote v1.0.7\n       Fresh getrandom v0.1.15\n       Fresh which v3.1.1\n       Fresh atty v0.2.14\n       Fresh generic-array v0.14.4\n       Fresh indexmap v1.6.0\n       Fresh num-traits v0.2.12\n       Fresh syn v1.0.44\n       Fresh rand_core v0.5.1\n       Fresh digest v0.9.0\n       Fresh petgraph v0.5.1\n       Fresh block-cipher v0.8.0\n       Fresh clap v2.33.3\n       Fresh crypto-mac v0.9.1\n       Fresh block-buffer v0.9.0\n       Fresh rand_chacha v0.2.2\n       Fresh serde_derive v1.0.117\n       Fresh prost-derive v0.6.1\n       Fresh synstructure v0.12.4\n       Fresh num-derive v0.3.2\n       Fresh aes-soft v0.5.0\n       Fresh block-modes v0.6.1\n       Fresh hmac v0.9.0\n       Fresh rand v0.7.3\n       Fresh serde v1.0.117\n       Fresh sha2 v0.9.1\n       Fresh prost v0.6.1\n       Fresh zeroize_derive v1.0.1\n       Fresh aes v0.5.0\n       Fresh tempfile v3.1.0\n       Fresh serde_json v1.0.59\n       Fresh toml v0.5.7\n       Fresh prost-types v0.6.1\n       Fresh zeroize v1.1.1\n       Fresh prost-build v0.6.1\n       Fresh cbindgen v0.14.3\n       Fresh curve25519-dalek v3.0.0\n       Fresh x25519-dalek v1.1.0\n       Fresh libsignal-protocol-rust v0.1.0 (/home/jack/work/libsignal-client/rust/protocol)\n       Fresh libsignal-ffi v0.1.0 (/home/jack/work/libsignal-client/rust/bridge/ffi)\n    Finished dev [unoptimized + debuginfo] target(s) in 0.05s\n")
ERROR: Couldn't generate bindings for /home/jack/work/libsignal-client/rust/bridge/ffi.

This is rustc 1.47.0 and cbindgen 0.14.4. Looks like cbindgen 0.15 is out I'll see if that fixes it.

@jack-signal
Copy link
Contributor

Looks like cbindgen 0.15 is out I'll see if that fixes it.

Nope

@jrose-signal
Copy link
Contributor Author

It's your nightly compiler version that matters, since otherwise it'll reject the --pretty=expanded option altogether. rustc +nightly --version?

@jack-signal
Copy link
Contributor

rustc 1.49.0-nightly (8dae8cdcc 2020-10-12)

I was already seeing this in August though so it's not a recent regression.

@jrose-signal
Copy link
Contributor Author

I wonder what's different about your configuration vs. mine. Oh well, I'll put it back if we switch away from build.rs, then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants