wifi-connect icon indicating copy to clipboard operation
wifi-connect copied to clipboard

Difficulties building

Open plafer opened this issue 3 years ago • 5 comments

I tried 2 different ways to build, and both failed. What am I doing wrong?

On Ubuntu 20.04, x86_64.

Try 1

$ cargo build
...
error[E0713]: borrow may still be in use when destructor runs
--> /home/plafer/.cargo/registry/src/github.com-1ecc6299db9ec823/url-1.7.0/src/form_urlencoded.rs:261:40
|
259 | impl<'a> Target for ::UrlQuery<'a> {
    |      -- lifetime `'a` defined here
260 |     fn as_mut_string(&mut self) -> &mut String { &mut self.url.serialization }
261 |     fn finish(self) -> &'a mut ::Url { self.url }
      |                                        ^^^^^^^^ - here, drop of `self` needs exclusive access to `*self.url`, because the type `UrlQuery<'_>` implements the `Drop` trait
  |                                        |
  |                                        returning this value requires that `*self.url` is borrowed for `'a`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0713`.
error: could not compile `url`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

Try 2

$ ./scripts/local-build.sh x86_64-unknown-linux-gnu amd64
...
error: failed to parse lock file at: /work/Cargo.lock

Caused by:
invalid serialized PackageId for key `package.dependencies`

plafer avatar Jun 12 '21 00:06 plafer

Running cargo update updated the culprit: url from 1.7.0 to 1.7.2.

plafer avatar Jun 15 '21 18:06 plafer

@plafer I had the same issue on Alpine. Installing dbus helped me. I found this Issue https://github.com/greshake/i3status-rust/issues/194 so maybe that helps you.

HenrikWittemeier avatar Jul 15 '21 22:07 HenrikWittemeier

deleting the Cargo.lock helped me

tm-sanjay avatar Jun 05 '23 19:06 tm-sanjay

All of the previous solutions looked relevant at different points. Conclusion: must run cargo update before building and also have a recent version of cargo in the system that is running the build. I had 1.74 on my machine but scripts/local-build.sh runs an old Docker image with cargo 0.24. There is no release of the image in the last 6 years but it was possible to enter the image and (since regular rustup update did not affect the cargo version there) reinstall Rust.

docker run -it -v $PWD:/work majorz/rust-amd64:rust-1.24.1 bash
rustup self uninstall
curl https://sh.rustup.rs/ -sSf | sh
cargo --version # cargo 1.74.1 (ecb9851af 2023-10-18).
rustup target add x86_64-unknown-linux-gnu
cargo build --release --target=/x86_64-unknown-linux-gnu

local-build.sh does not seem worth much as-is. For anyone seeing this, I recommend sticking to basic cargo build and trying the last two lines on your host to build the desired target.

MBerka avatar Dec 22 '23 23:12 MBerka

I have made myself this build script for cross building for arm64 on Debian Bullseye. It doesn't use docker. Perhaps it is of use to someone. https://github.com/hupster/wifi-connect-build

hupster avatar Jan 30 '24 19:01 hupster