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

cargo install cargo-binutils failed #151

Open
ruiqurm opened this issue Apr 11, 2022 · 1 comment
Open

cargo install cargo-binutils failed #151

ruiqurm opened this issue Apr 11, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@ruiqurm
Copy link

ruiqurm commented Apr 11, 2022

欢迎提出任何问题

环境

  • rustc 1.62.0-nightly
  • wsl2 Ubuntu 20.04

遇到问题

安装环境时,cargo install cargo-binutils 失败。
安装依赖clap v2.34.0时,提示:

error[E0658]: `if` is not allowed in a `const fn`
  --> /home/ruiqurm/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/clap-2.34.0/src/app/settings.rs:7:1
   |
7  | / bitflags! {
8  | |     struct Flags: u64 {
9  | |         const SC_NEGATE_REQS       = 1;
10 | |         const SC_REQUIRED          = 1 << 1;
...  |
51 | |     }
52 | | }
   | |_^
   |
   = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information
   = help: add `#![feature(const_if_match)]` to the crate attributes to enable
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0658]: `if` is not allowed in a `const fn`
  --> /home/ruiqurm/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/clap-2.34.0/src/args/settings.rs:6:1
   |
6  | / bitflags! {
7  | |     struct Flags: u32 {
8  | |         const REQUIRED         = 1;
9  | |         const MULTIPLE         = 1 << 1;
...  |
28 | |     }
29 | | }
   | |_^
   |
   = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information
   = help: add `#![feature(const_if_match)]` to the crate attributes to enable
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

   Compiling addr2line v0.17.0
   Compiling regex v1.5.5
error: aborting due to 2 previous errors

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

尝试添加标志-Z minimal-versions : cargo install cargo-binutils -Z minimal-versions
在编译backtrace v0.3.5处失败:

Compiling backtrace v0.3.5
error[E0425]: cannot find value `RTLD_LAZY` in crate `libc`
  --> /home/ruiqurm/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/backtrace-0.3.5/src/dylib.rs:30:70
   |
30 |         let ptr = libc::dlopen(name.as_ptr() as *const c_char, libc::RTLD_LAZY);
   |                                                                      ^^^^^^^^^ not found in `libc`

error: aborting due to previous error

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

(可能的)解决方案

切换nightly到stable:

rustup override set stable
@ruiqurm ruiqurm added the bug Something isn't working label Apr 11, 2022
@infdahai
Copy link

infdahai commented Jun 10, 2022

It seems to be caused by the clap issue#2734 and some similar api-outdated cases.

So we only need to use the rust-toolchain version greater than 1.51.0 (such as nightly-2022-06-09) in the file rust-toolchain .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants