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 installation on Mac (lurk-cli doesn't compile) #56

Closed
bsodmike opened this issue Sep 29, 2024 · 4 comments
Closed

Cargo installation on Mac (lurk-cli doesn't compile) #56

bsodmike opened this issue Sep 29, 2024 · 4 comments
Assignees
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@bsodmike
Copy link

Describe the bug

Running cargo install binsider

   Compiling regex v1.10.6
   Compiling clap v4.5.18
   Compiling comfy-table v7.1.1
   Compiling lurk-cli v0.3.6
error[E0432]: unresolved import `libc::user_regs_struct`
 --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/arch/mod.rs:3:33
  |
3 | use libc::{c_long, c_ulonglong, user_regs_struct};
  |                                 ^^^^^^^^^^^^^^^^ no `user_regs_struct` in the root

error[E0432]: unresolved import `nix::sys::ptrace::Options`
 --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/arch/mod.rs:5:5
  |
5 | use nix::sys::ptrace::Options;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^ no `Options` in `sys::ptrace`

error[E0432]: unresolved import `libc::user_regs_struct`
 --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/syscall_info.rs:3:25
  |
3 | use libc::{c_ulonglong, user_regs_struct};
  |                         ^^^^^^^^^^^^^^^^ no `user_regs_struct` in the root

error[E0432]: unresolved imports `libc::user_regs_struct`, `libc::PTRACE_SYSCALL_INFO_EXIT`
  --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:77:12
   |
77 | use libc::{user_regs_struct, PTRACE_SYSCALL_INFO_EXIT};
   |            ^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^ no `PTRACE_SYSCALL_INFO_EXIT` in the root
   |            |
   |            no `user_regs_struct` in the root

error[E0432]: unresolved imports `linux_personality::personality`, `linux_personality::ADDR_NO_RANDOMIZE`
  --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:78:25
   |
78 | use linux_personality::{personality, ADDR_NO_RANDOMIZE};
   |                         ^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^ no `ADDR_NO_RANDOMIZE` in the root
   |                         |
   |                         no `personality` in the root
   |
   = help: consider importing one of these variants instead:
           crate::Sysno::personality
           syscalls::Sysno::personality
           syscalls::arm::Sysno::personality
           syscalls::mips64::Sysno::personality
           syscalls::mips::Sysno::personality
           syscalls::powerpc64::Sysno::personality
           syscalls::powerpc::Sysno::personality
           syscalls::riscv32::Sysno::personality
           syscalls::riscv64::Sysno::personality
           syscalls::s390x::Sysno::personality
           syscalls::sparc64::Sysno::personality
           syscalls::sparc::Sysno::personality
           syscalls::x86::Sysno::personality
           syscalls::x86_64::Sysno::personality

error[E0432]: unresolved import `nix::sys::ptrace::Event`
  --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:79:30
   |
79 | use nix::sys::ptrace::{self, Event};
   |                              ^^^^^ no `Event` in `sys::ptrace`

error[E0432]: unresolved imports `crate::arch::TRACE_CLOCK`, `crate::arch::TRACE_CREDS`, `crate::arch::TRACE_DESC`, `crate::arch::TRACE_FILE`, `crate::arch::TRACE_FSTAT`, `crate::arch::TRACE_FSTATFS`, `crate::arch::TRACE_IPC`, `crate::arch::TRACE_LSTAT`, `crate::arch::TRACE_MEMORY`, `crate::arch::TRACE_NETWORK`, `crate::arch::TRACE_PROCESS`, `crate::arch::TRACE_PURE`, `crate::arch::TRACE_SIGNAL`, `crate::arch::TRACE_STAT`, `crate::arch::TRACE_STATFS`, `crate::arch::TRACE_STATFS_LIKE`, `crate::arch::TRACE_STAT_LIKE`
 --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/args.rs:2:5
  |
2 |     TRACE_CLOCK, TRACE_CREDS, TRACE_DESC, TRACE_FILE, TRACE_FSTAT, TRACE_FSTATFS, TRACE_IPC,
  |     ^^^^^^^^^^^  ^^^^^^^^^^^  ^^^^^^^^^^  ^^^^^^^^^^  ^^^^^^^^^^^  ^^^^^^^^^^^^^  ^^^^^^^^^ no `TRACE_IPC` in `arch`
  |     |            |            |           |           |            |
  |     |            |            |           |           |            no `TRACE_FSTATFS` in `arch`
  |     |            |            |           |           no `TRACE_FSTAT` in `arch`
  |     |            |            |           no `TRACE_FILE` in `arch`
  |     |            |            no `TRACE_DESC` in `arch`
  |     |            no `TRACE_CREDS` in `arch`
  |     no `TRACE_CLOCK` in `arch`
3 |     TRACE_LSTAT, TRACE_MEMORY, TRACE_NETWORK, TRACE_PROCESS, TRACE_PURE, TRACE_SIGNAL, TRACE_STAT,
  |     ^^^^^^^^^^^  ^^^^^^^^^^^^  ^^^^^^^^^^^^^  ^^^^^^^^^^^^^  ^^^^^^^^^^  ^^^^^^^^^^^^  ^^^^^^^^^^
  |     |            |             |
  |     |            |             no `TRACE_NETWORK` in `arch`
  |     |            no `TRACE_MEMORY` in `arch`
  |     no `TRACE_LSTAT` in `arch`
4 |     TRACE_STATFS, TRACE_STATFS_LIKE, TRACE_STAT_LIKE,
  |     ^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^

error[E0425]: cannot find function `setoptions` in module `ptrace`
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/arch/mod.rs:103:13
    |
103 |     ptrace::setoptions(
    |             ^^^^^^^^^^ not found in `ptrace`

error[E0425]: cannot find function `setoptions` in module `ptrace`
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/arch/mod.rs:110:13
    |
110 |     ptrace::setoptions(
    |             ^^^^^^^^^^ not found in `ptrace`

error[E0425]: cannot find value `SYSCALLS` in this scope
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/arch/mod.rs:125:5
    |
125 |     SYSCALLS
    |     ^^^^^^^^ not found in this scope

error[E0425]: cannot find value `length` in this scope
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/arch/mod.rs:152:75
    |
152 |         SyscallArgType::Bytes => SyscallArg::Bytes(read_bytes(pid, value, length)),
    |                                                                           ^^^^^^ not found in this scope

error[E0425]: cannot find function `getevent` in module `ptrace`
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:227:41
    |
227 |                     let event = ptrace::getevent(pid)? as u8;
    |                                         ^^^^^^^^ not found in `ptrace`

error[E0425]: cannot find value `code` in this scope
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:382:23
    |
382 |                 match code {
    |                       ^^^^ not found in this scope

error[E0425]: cannot find value `code` in this scope
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:386:17
    |
386 |                 code
    |                 ^^^^ not found in this scope

error[E0425]: cannot find function `syscall` in module `ptrace`
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:426:17
    |
426 |         ptrace::syscall(pid, signal)
    |                 ^^^^^^^ not found in `ptrace`
    |
help: consider importing one of these items
    |
72  + use libc::syscall;
    |
72  + use syscalls::mips::Sysno::syscall;
    |
72  + use syscalls::syscall;
    |
help: if you import `syscall`, refer to it directly
    |
426 -         ptrace::syscall(pid, signal)
426 +         syscall(pid, signal)
    |

error[E0425]: cannot find function `getregs` in module `ptrace`
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:432:17
    |
432 |         ptrace::getregs(pid).map_err(|_| anyhow!("Unable to get registers from tracee {}", pid))
    |                 ^^^^^^^ not found in `ptrace`

error[E0425]: cannot find value `reg` in this scope
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:440:10
    |
440 |         (reg as u32)
    |          ^^^ not found in this scope

error[E0425]: cannot find value `reg` in this scope
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:442:63
    |
442 |             .map_err(|_| anyhow!("Invalid syscall number {}", reg))
    |                                                               ^^^ not found in this scope

error[E0425]: cannot find value `reg` in this scope
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:459:13
    |
459 |             reg == Sysno::exit as u64 || reg == Sysno::exit_group as u64
    |             ^^^ not found in this scope

error[E0425]: cannot find value `reg` in this scope
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:459:42
    |
459 |             reg == Sysno::exit as u64 || reg == Sysno::exit_group as u64
    |                                          ^^^ not found in this scope

error[E0308]: mismatched types
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/arch/mod.rs:79:51
    |
79  |         let res: c_long = match ptrace::read(pid, address) {
    |                                 ------------      ^^^^^^^ expected `*mut i8`, found `*mut c_void`
    |                                 |
    |                                 arguments to this function are incorrect
    |
    = note: expected raw pointer `*mut i8`
               found raw pointer `*mut c_void`
note: function defined here
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.29.0/src/sys/ptrace/bsd.rs:173:8
    |
173 | pub fn read(pid: Pid, addr: AddressType) -> Result<c_int> {
    |        ^^^^

error[E0308]: mismatched types
  --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/arch/mod.rs:80:27
   |
80 |             Ok(c_long) => c_long,
   |                           ^^^^^^ expected `i64`, found `i32`
   |
help: you can convert an `i32` to an `i64`
   |
80 |             Ok(c_long) => c_long.into(),
   |                                 +++++++

error[E0425]: cannot find function `get_arg_value` in this scope
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/arch/mod.rs:143:17
    |
143 |     let value = get_arg_value(registers, idx);
    |                 ^^^^^^^^^^^^^ not found in this scope

error[E0599]: no variant or associated item named `PtraceEvent` found for enum `WaitStatus` in the current scope
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:212:29
    |
212 |                 WaitStatus::PtraceEvent(pid, _, code) => {
    |                             ^^^^^^^^^^^ variant or associated item not found in `WaitStatus`

error[E0599]: no variant or associated item named `PtraceSyscall` found for enum `WaitStatus` in the current scope
   --> /Users/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lurk-cli-0.3.6/src/lib.rs:222:29
    |
222 |                 WaitStatus::PtraceSyscall(pid) => {
    |                             ^^^^^^^^^^^^^ variant or associated item not found in `WaitStatus`

Some errors have detailed explanations: E0308, E0425, E0432, E0599.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `lurk-cli` (lib) due to 25 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `lurk-cli v0.3.6`, intermediate artifacts can be found at `/var/folders/vk/cb344xdx2jg29k9z7gw_2l240000gn/T/cargo-installq8cQwM`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

However, the same error can be obtained by compiling cargo install [email protected]

To reproduce

Run cargo install [email protected] - so this is not a binsider specific issue, however, it is a dependency of binsider.

Software information

  • Operating system: Mac OS 14.5 (23F79)
  • Rust version:
    stable-aarch64-apple-darwin
    rustc 1.81.0 (eeb90cda1 2024-09-04)
  • Project version: latest (on crates.io)
@bsodmike bsodmike added the bug Something isn't working label Sep 29, 2024
@bsodmike
Copy link
Author

This does however compile with CARGO_TARGET_DIR=target cargo build --release --no-default-features. I think it's probably best to add a section for Mac OS in the docs and suggest using the above rather than a direct cargo install?

@orhun
Copy link
Owner

orhun commented Sep 29, 2024

See #31

It is already documented here and I will be creating a new release tomorrow :)

@orhun orhun added the duplicate This issue or pull request already exists label Sep 29, 2024
@bsodmike
Copy link
Author

See #31

It is already documented here and I will be creating a new release tomorrow :)

Awesome, thanks.

@orhun
Copy link
Owner

orhun commented Sep 30, 2024

0.2.0 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants