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

Linux Local Redirector #206

Merged
merged 58 commits into from
Jan 2, 2025
Merged

Linux Local Redirector #206

merged 58 commits into from
Jan 2, 2025

Conversation

mhils
Copy link
Member

@mhils mhils commented Dec 27, 2024

Filing this early to work on CI.

@emanuele-em
Copy link
Member

good job 🥇

@errorxyz
Copy link
Contributor

errorxyz commented Jan 1, 2025

I get this error in step 2:

Logs
(venv) errorxyz@home:~/mitmproxy_rs/mitmproxy-linux$ maturin develop
🍹 Building a mixed python/rust project
🐍 Found CPython 3.11 at /home/errorxyz/mitmproxy/venv/bin/python
📡 Using build options bindings from pyproject.toml
   Compiling mitmproxy-linux-ebpf v0.12.0-dev (/home/errorxyz/mitmproxy_rs/mitmproxy-linux-ebpf)
   Compiling internet-packet v0.2.2
   Compiling anstream v0.6.18
   Compiling sysinfo v0.33.1
   Compiling hickory-resolver v0.24.2
   Compiling anyhow v1.0.95
   Compiling mitmproxy-linux-ebpf-common v0.12.0-dev (/home/errorxyz/mitmproxy_rs/mitmproxy-linux-ebpf-common)
   Compiling aya-log v0.2.1
error: failed to run custom build command for `mitmproxy-linux-ebpf v0.12.0-dev (/home/errorxyz/mitmproxy_rs/mitmproxy-linux-ebpf)`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/home/errorxyz/mitmproxy_rs/target/debug/build/mitmproxy-linux-ebpf-e3781c050c9ef793/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at mitmproxy-linux-ebpf/build.rs:15:42:
  called `Result::unwrap()` on an `Err` value: CannotFindBinaryPath
  stack backtrace:
     0:     0x558db1e7625a - std::backtrace_rs::backtrace::libunwind::trace::h5a5b8284f2d0c266
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
     1:     0x558db1e7625a - std::backtrace_rs::backtrace::trace_unsynchronized::h76d4f1c9b0b875e3
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:     0x558db1e7625a - std::sys::backtrace::_print_fmt::hc4546b8364a537c6
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/sys/backtrace.rs:66:9
     3:     0x558db1e7625a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h5b6bd5631a6d1f6b
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/sys/backtrace.rs:39:26
     4:     0x558db1e91503 - core::fmt::rt::Argument::fmt::h270f6602a2b96f62
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/fmt/rt.rs:177:76
     5:     0x558db1e91503 - core::fmt::write::h7550c97b06c86515
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/fmt/mod.rs:1186:21
     6:     0x558db1e73c53 - std::io::Write::write_fmt::h7b09c64fe0be9c84
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/io/mod.rs:1839:15
     7:     0x558db1e760a2 - std::sys::backtrace::BacktraceLock::print::h2395ccd2c84ba3aa
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/sys/backtrace.rs:42:9
     8:     0x558db1e7704c - std::panicking::default_hook::{{closure}}::he19d4c7230e07961
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:268:22
     9:     0x558db1e76e92 - std::panicking::default_hook::hf614597d3c67bbdb
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:295:9
    10:     0x558db1e77627 - std::panicking::rust_panic_with_hook::h8942133a8b252070
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:801:13
    11:     0x558db1e774ba - std::panicking::begin_panic_handler::{{closure}}::hb5f5963570096b29
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:674:13
    12:     0x558db1e76739 - std::sys::backtrace::__rust_end_short_backtrace::h6208cedc1922feda
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/sys/backtrace.rs:170:18
    13:     0x558db1e7714c - rust_begin_unwind
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:665:5
    14:     0x558db1e50210 - core::panicking::panic_fmt::h0c3082644d1bf418
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/panicking.rs:74:14
    15:     0x558db1e50586 - core::result::unwrap_failed::hd20b4aa073bda1e2
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/result.rs:1700:5
    16:     0x558db1e54e53 - build_script_build::main::h1ec4febccf615d83
    17:     0x558db1e53923 - core::ops::function::FnOnce::call_once::hd0718eb710e49bfe
    18:     0x558db1e50ae6 - std::sys::backtrace::__rust_begin_short_backtrace::hadf926a4c6bb045b
    19:     0x558db1e52239 - std::rt::lang_start::{{closure}}::h481e8c46e5155276
    20:     0x558db1e71a3e - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hfdb85f4ee94732d3
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/ops/function.rs:284:13
    21:     0x558db1e71a3e - std::panicking::try::do_call::h6e577310f330cbef
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:557:40
    22:     0x558db1e71a3e - std::panicking::try::ha588d438267d2645
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:520:19
    23:     0x558db1e71a3e - std::panic::catch_unwind::h429fda1e025f26d9
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panic.rs:358:14
    24:     0x558db1e71a3e - std::rt::lang_start_internal::{{closure}}::h7b731265e841c4bf
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/rt.rs:174:48
    25:     0x558db1e71a3e - std::panicking::try::do_call::hc0f6a675b7ae5a36
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:557:40
    26:     0x558db1e71a3e - std::panicking::try::h4c93b7ff0671f1ff
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:520:19
    27:     0x558db1e71a3e - std::panic::catch_unwind::hcc1e154961d16ce6
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panic.rs:358:14
    28:     0x558db1e71a3e - std::rt::lang_start_internal::h1c66660c99c8424c
                                 at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/rt.rs:174:20
    29:     0x558db1e52217 - std::rt::lang_start::h88c9608c1d08f324
    30:     0x558db1e55035 - main
    31:     0x7f1912f0724a - <unknown>
    32:     0x7f1912f07305 - __libc_start_main
    33:     0x558db1e50901 - _start
    34:                0x0 - <unknown>
warning: build failed, waiting for other jobs to finish...
💥 maturin failed
  Caused by: Failed to build a native library through cargo
  Caused by: Cargo build finished with "exit status: 101": `env -u CARGO PYO3_ENVIRONMENT_SIGNATURE="cpython-3.11-64bit" PYO3_PYTHON="/home/errorxyz/mitmproxy/venv/bin/python" PYTHON_SYS_EXECUTABLE="/home/errorxyz/mitmproxy/venv/bin/python" "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/home/errorxyz/mitmproxy_rs/mitmproxy-linux/Cargo.toml" "--bin" "mitmproxy-linux-redirector"`

I'm using debian linux via WSL2 on windows 11.

It seems "bpf-linker" is not found?

Edit:

2. cd mitmproxy_linux && maturin develop

Just to clarify, did you mean mitmproxy-linux here?

Edit2: Getting the same error on kali-linux (not WSL) as well

@mhils
Copy link
Member Author

mhils commented Jan 1, 2025

Ah yes, sorry. cargo install bpf-linker is a dev prerequisite.

@mhils mhils merged commit 33ba734 into mitmproxy:main Jan 2, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants