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

[Feature Request] MacOS support #12

Closed
andrewssobral opened this issue May 8, 2024 · 2 comments
Closed

[Feature Request] MacOS support #12

andrewssobral opened this issue May 8, 2024 · 2 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@andrewssobral
Copy link

Nice tool, but I am getting the following error on my Mac M1, how to fix it ?

➜  ~ cargo install tracexec --bin tracexec
    Updating crates.io index
  Downloaded tracexec v0.0.5
  Downloaded 1 crate (417.5 KB) in 0.06s
  Installing tracexec v0.0.5
    Updating crates.io index
  Downloaded backtrace v0.3.71
  Downloaded rustc-demangle v0.1.24
  Downloaded tracing-error v0.2.0
  Downloaded supports-color v2.1.0
  Downloaded serde v1.0.201
  Downloaded syn v2.0.61
  Downloaded object v0.32.2
  Downloaded gimli v0.28.1
  Downloaded color-eyre v0.6.3
  Downloaded seccompiler v0.4.0
  Downloaded cc v1.0.97
  Downloaded strum_macros v0.26.2
  Downloaded rustversion v1.0.16
  Downloaded owo-colors v3.5.0
  Downloaded num-traits v0.2.19
  Downloaded kxxt-owo-colors v4.0.0
  Downloaded autocfg v1.3.0
  Downloaded anstyle v1.0.7
  Downloaded addr2line v0.21.0
  Downloaded strum v0.26.2
  Downloaded shell-quote v0.5.0
  Downloaded proc-macro2 v1.0.82
  Downloaded pretty_env_logger v0.5.0
  Downloaded libc v0.2.154
  Downloaded is_ci v1.2.0
  Downloaded colorchoice v1.0.1
  Downloaded atoi v2.0.0
  Downloaded is_terminal_polyfill v1.70.0
  Downloaded color-spantrace v0.2.1
  Downloaded anstyle-query v1.0.3
  Downloaded anstyle-parse v0.2.4
  Downloaded anstream v0.6.14
  Downloaded 32 crates (3.2 MB) in 0.30s
   Compiling libc v0.2.154
   Compiling memchr v2.7.2
   Compiling once_cell v1.19.0
   Compiling cfg-if v1.0.0
   Compiling proc-macro2 v1.0.82
   Compiling unicode-ident v1.0.12
   Compiling regex-syntax v0.8.3
   Compiling lazy_static v1.4.0
   Compiling pin-project-lite v0.2.14
   Compiling sharded-slab v0.1.7
   Compiling utf8parse v0.2.1
   Compiling autocfg v1.3.0
   Compiling tracing-core v0.1.32
   Compiling thread_local v1.1.8
   Compiling aho-corasick v1.1.3
   Compiling cc v1.0.97
   Compiling rustversion v1.0.16
   Compiling tracing-subscriber v0.3.18
   Compiling tracing v0.1.40
   Compiling regex-automata v0.4.6
   Compiling backtrace v0.3.71
   Compiling num-traits v0.2.19
   Compiling anstyle-parse v0.2.4
   Compiling anstyle v1.0.7
   Compiling gimli v0.28.1
   Compiling anstyle-query v1.0.3
   Compiling is_terminal_polyfill v1.70.0
   Compiling eyre v0.6.12
   Compiling colorchoice v1.0.1
   Compiling quote v1.0.36
   Compiling syn v2.0.61
   Compiling is-terminal v0.4.12
   Compiling adler v1.0.2
   Compiling anstream v0.6.14
   Compiling miniz_oxide v0.7.2
   Compiling regex v1.10.4
   Compiling tracing-error v0.2.0
   Compiling object v0.32.2
   Compiling owo-colors v3.5.0
   Compiling addr2line v0.21.0
   Compiling heck v0.5.0
   Compiling log v0.4.21
   Compiling clap_lex v0.7.0
   Compiling termcolor v1.4.1
   Compiling is_ci v1.2.0
   Compiling humantime v2.1.0
   Compiling rustc-demangle v0.1.24
   Compiling strsim v0.11.1
   Compiling heck v0.4.1
   Compiling indenter v0.3.3
   Compiling clap_builder v4.5.2
   Compiling env_logger v0.10.2
   Compiling supports-color v2.1.0
   Compiling color-spantrace v0.2.1
   Compiling bstr v1.9.1
   Compiling bitflags v2.5.0
   Compiling atoi v2.0.0
   Compiling nix v0.27.1
   Compiling shell-quote v0.5.0
   Compiling kxxt-owo-colors v4.0.0
   Compiling strum_macros v0.26.2
   Compiling clap_derive v4.5.4
   Compiling color-eyre v0.6.3
   Compiling pretty_env_logger v0.5.0
   Compiling seccompiler v0.4.0
error[E0425]: cannot find value `SECCOMP_FILTER_FLAG_TSYNC` in crate `libc`
   --> /Users/andrewssobral/.cargo/registry/src/index.crates.io-6f17d22bba15001f/seccompiler-0.4.0/src/lib.rs:328:47
    |
328 |     apply_filter_with_flags(bpf_filter, libc::SECCOMP_FILTER_FLAG_TSYNC)
    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find function `prctl` in crate `libc`
   --> /Users/andrewssobral/.cargo/registry/src/index.crates.io-6f17d22bba15001f/seccompiler-0.4.0/src/lib.rs:347:29
    |
347 |     let rc = unsafe { libc::prctl(libc::PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) };
    |                             ^^^^^ not found in `libc`

error[E0425]: cannot find value `PR_SET_NO_NEW_PRIVS` in crate `libc`
   --> /Users/andrewssobral/.cargo/registry/src/index.crates.io-6f17d22bba15001f/seccompiler-0.4.0/src/lib.rs:347:41
    |
347 |     let rc = unsafe { libc::prctl(libc::PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) };
    |                                         ^^^^^^^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `SYS_seccomp` in crate `libc`
   --> /Users/andrewssobral/.cargo/registry/src/index.crates.io-6f17d22bba15001f/seccompiler-0.4.0/src/lib.rs:363:19
    |
363 |             libc::SYS_seccomp,
    |                   ^^^^^^^^^^^ not found in `libc`

error[E0308]: mismatched types
   --> /Users/andrewssobral/.cargo/registry/src/index.crates.io-6f17d22bba15001f/seccompiler-0.4.0/src/lib.rs:376:38
    |
376 |         return Err(Error::ThreadSync(rc));
    |                    ----------------- ^^ expected `i64`, found `i32`
    |                    |
    |                    arguments to this enum variant are incorrect
    |
note: tuple variant defined here
   --> /Users/andrewssobral/.cargo/registry/src/index.crates.io-6f17d22bba15001f/seccompiler-0.4.0/src/lib.rs:242:5
    |
242 |     ThreadSync(libc::c_long),
    |     ^^^^^^^^^^
help: you can convert an `i32` to an `i64`
    |
376 |         return Err(Error::ThreadSync(rc.into()));
    |                                        +++++++

Some errors have detailed explanations: E0308, E0425.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `seccompiler` (lib) due to 5 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `tracexec v0.0.5`, intermediate artifacts can be found at `/var/folders/4y/0hm48z794zd2d15cwsg10kcm0000gn/T/cargo-install2rFoLE`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
➜  ~
@kxxt
Copy link
Owner

kxxt commented May 8, 2024

Hi, tracexec only supports linux for now since it uses some ptrace features specific to the linux platform.

@kxxt
Copy link
Owner

kxxt commented May 8, 2024

After searching for ptrace on MacOS and reading the compiler error you get(which indicates that seccomp-bpf isn't available on MacOS either), I think it's very hard to get tracexec working on MacOS with reasonable performance. So I am going to close this issue as won't fix.

A much more comprehensive tool, strace, doesn't support MacOS either: Homebrew/homebrew-core#159527

@kxxt kxxt closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2024
@kxxt kxxt added enhancement New feature or request wontfix This will not be worked on labels May 8, 2024
@kxxt kxxt changed the title [ERROR] Can not compile on Mac M1 (ARM64) [Feature Request] MacOS support May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants