bottlerocket-os / bottlerocket

An operating system designed for hosting containers
https://bottlerocket.dev
Other
8.78k stars 519 forks source link

Build does not work with hyper versions >= 0.14.3 #1471

Closed webern closed 2 years ago

webern commented 3 years ago

We build most Bottlerocket binaries with RUSTFLAGS=-Cprefer-dynamic so that we can dynamically link to the Rust std library and reduce the size of our binaries.

Hyper 0.14.3 adds this line to its Cargo.toml to emit a c interface in a dynamic library: https://github.com/hyperium/hyper/blob/48d4594930da4e227039cfa254411b85c98b63c5/Cargo.toml#L23

This, in conjunction with reqwest and prefer-dynamic causes cargo/rustc to try to link using the emitted hyper c library and the linker fails with missing symbols. The problem is described precisely here: https://github.com/rust-lang/rust/issues/82151#issuecomment-779368017

As it stands right now, this means that the highest version of hyper we can use with Bottlerocket is 0.14.2.

webern commented 3 years ago

I want to link this to the underlying issue, which is this: https://github.com/rust-lang/rust/issues/82151

And specifically this comment explains it well: https://github.com/rust-lang/rust/issues/82151#issuecomment-779368017

webern commented 3 years ago

Note, this PR attempts to fix the underlying issue, but appears to be stuck https://github.com/rust-lang/rust/pull/88101

webern commented 2 years ago

Good news! This RFC was has been created, accepted and implemented in nightly: https://rust-lang.github.io/rfcs/3180-cargo-cli-crate-type.html

@seanmonstar reports that this will allow the removal of cdylib from Hyper's Cargo.toml and allow builds to instead opt-in to the creation of the cdylib. Once that change to Hyper's Cargo.toml is released, we should be able to update.

webern commented 2 years ago

It will be ready soon! https://github.com/hyperium/hyper/commit/1c6637060e36654ddb2fdfccb0d146c7ad527476

webern commented 2 years ago

Fixed by #2019