Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.

v2.0.4 Build Error in openWRT #91

Closed
whlsxl opened this issue Jul 25, 2024 · 4 comments
Closed

v2.0.4 Build Error in openWRT #91

whlsxl opened this issue Jul 25, 2024 · 4 comments

Comments

@whlsxl
Copy link

whlsxl commented Jul 25, 2024

   Compiling tun2 v2.0.4
     Running `rustc --crate-name tun2 --edition=2021 /lede/dl/cargo/registry/src/index.crates.io-6f17d22bba15001f/tun2-2.0.4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=283 --crate-type staticlib --crate-type cdylib --crate-type lib --emit=dep-info,link -C opt-level=z -C codegen-units=1 -C overflow-checks=on --cfg 'feature="async"' --cfg 'feature="default"' --cfg 'feature="futures-core"' --cfg 'feature="tokio"' --cfg 'feature="tokio-util"' --cfg 'feature="wintun-dns"' -C metadata=335b9087992a3a79 -C extra-filename=-335b9087992a3a79 --out-dir /lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps --target aarch64-unknown-linux-musl -C linker=aarch64-openwrt-linux-musl-gcc -C strip=symbols -L dependency=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps -L dependency=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/release/deps --extern bytes=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libbytes-3e1433cd5bbb36d0.rlib --extern cfg_if=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libcfg_if-89fd22910ccdacf5.rlib --extern futures_core=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libfutures_core-e1534271e7b20532.rlib --extern libc=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/liblibc-4f96b045d43c3d3d.rlib --extern log=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/liblog-21587c054ada44ff.rlib --extern nix=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libnix-d9e54679135bec6d.rlib --extern thiserror=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libthiserror-49aaf06702ee2934.rlib --extern tokio=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libtokio-f181ef23a1f91e9a.rlib --extern tokio_util=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libtokio_util-b40649d6cddc22d7.rlib --cap-lints allow -Ctarget-feature=-crt-static -lssp_nonshared`
error[E0716]: temporary value dropped while borrowed
  --> /lede/dl/cargo/registry/src/index.crates.io-6f17d22bba15001f/tun2-2.0.4/src/platform/posix/split.rs:90:18
   |
87 |         let local_buf = if in_buf_len > STACK_BUF_LEN && self.offset != 0 {
   |             --------- borrow later stored here
...
90 |             &mut [0u8; STACK_BUF_LEN]
   |                  ^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
91 |         };
   |         - temporary value is freed at the end of this statement
   |
   = note: consider using a `let` binding to create a longer lived value

error[E0716]: temporary value dropped while borrowed
  --> /lede/dl/cargo/registry/src/index.crates.io-6f17d22bba15001f/tun2-2.0.4/src/platform/posix/split.rs:88:18
   |
87 |         let local_buf = if in_buf_len > STACK_BUF_LEN && self.offset != 0 {
   |             --------- borrow later stored here
88 |             &mut vec![0u8; in_buf_len][..]
   |                  ^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
89 |         } else {
   |         - temporary value is freed at the end of this statement
   |
   = note: consider using a `let` binding to create a longer lived value
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0716]: temporary value dropped while borrowed
   --> /lede/dl/cargo/registry/src/index.crates.io-6f17d22bba15001f/tun2-2.0.4/src/platform/posix/split.rs:155:18
    |
152 |         let local_buf = if in_buf_len > STACK_BUF_LEN && self.offset != 0 {
    |             --------- borrow later stored here
...
155 |             &mut [0u8; STACK_BUF_LEN]
    |                  ^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
156 |         };
    |         - temporary value is freed at the end of this statement
    |
    = note: consider using a `let` binding to create a longer lived value

error[E0716]: temporary value dropped while borrowed
   --> /lede/dl/cargo/registry/src/index.crates.io-6f17d22bba15001f/tun2-2.0.4/src/platform/posix/split.rs:153:18
    |
152 |         let local_buf = if in_buf_len > STACK_BUF_LEN && self.offset != 0 {
    |             --------- borrow later stored here
153 |             &mut vec![0u8; in_buf_len][..]
    |                  ^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
154 |         } else {
    |         - temporary value is freed at the end of this statement
    |
    = note: consider using a `let` binding to create a longer lived value
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0716`.
error: could not compile `tun2` (lib) due to 4 previous errors

Caused by:
  process didn't exit successfully: `rustc --crate-name tun2 --edition=2021 /lede/dl/cargo/registry/src/index.crates.io-6f17d22bba15001f/tun2-2.0.4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=283 --crate-type staticlib --crate-type cdylib --crate-type lib --emit=dep-info,link -C opt-level=z -C codegen-units=1 -C overflow-checks=on --cfg 'feature="async"' --cfg 'feature="default"' --cfg 'feature="futures-core"' --cfg 'feature="tokio"' --cfg 'feature="tokio-util"' --cfg 'feature="wintun-dns"' -C metadata=335b9087992a3a79 -C extra-filename=-335b9087992a3a79 --out-dir /lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps --target aarch64-unknown-linux-musl -C linker=aarch64-openwrt-linux-musl-gcc -C strip=symbols -L dependency=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps -L dependency=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/release/deps --extern bytes=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libbytes-3e1433cd5bbb36d0.rlib --extern cfg_if=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libcfg_if-89fd22910ccdacf5.rlib --extern futures_core=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libfutures_core-e1534271e7b20532.rlib --extern libc=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/liblibc-4f96b045d43c3d3d.rlib --extern log=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/liblog-21587c054ada44ff.rlib --extern nix=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libnix-d9e54679135bec6d.rlib --extern thiserror=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libthiserror-49aaf06702ee2934.rlib --extern tokio=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libtokio-f181ef23a1f91e9a.rlib --extern tokio_util=/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target/aarch64-unknown-linux-musl/release/deps/libtokio_util-b40649d6cddc22d7.rlib --cap-lints allow -Ctarget-feature=-crt-static -lssp_nonshared` (exit status: 1)
error: failed to compile `shadowsocks-rust v1.20.2 (/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2)`, intermediate artifacts can be found at `/lede/build_dir/target-aarch64_cortex-a53_musl/shadowsocks-rust-1.20.2/target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Not familiar with rust, when compiling shadowsocks-rust v1.20.2, get this error.

@ssrlive
Copy link
Owner

ssrlive commented Jul 25, 2024

What's your rustc --version? my result is rustc 1.79.0 (129f3b996 2024-06-10).

@ssrlive
Copy link
Owner

ssrlive commented Jul 26, 2024

I repeat, What's your rustc --version? my result is rustc 1.79.0 (129f3b996 2024-06-10) and rustc 1.82.0-nightly (7120fdac7 2024-07-25).

@ssrlive ssrlive reopened this Jul 26, 2024
@ssrlive
Copy link
Owner

ssrlive commented Jul 26, 2024

Emm, It's a new feature since rust 1.79. https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html#extending-automatic-temporary-lifetime-extension

@ssrlive ssrlive closed this as completed Jul 26, 2024
@whlsxl
Copy link
Author

whlsxl commented Jul 26, 2024

The toolchain Rust version is 1.78.0, I think that's the reason.

Thanks for your quick response & fix so fast!

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

No branches or pull requests

2 participants