Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#79823 - [python-mitmproxy-rs] build improvement

Attached to Project: Arch Linux
Opened by Wang Haoyu (moui) - Saturday, 30 September 2023, 12:27 GMT
Last edited by kpcyrd (kpcyrd) - Saturday, 07 October 2023, 15:16 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To kpcyrd (kpcyrd)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Failed to build from source (version: 0.3.0-1) on RISC-V64 machine. This is the error message:

```
error: failed to run custom build command for `mitmproxy v0.3.0 (/build/python-mitmproxy-rs/src/mitmproxy_rs-0.3.0)`

Caused by:
process didn't exit successfully: `/build/python-mitmproxy-rs/src/mitmproxy_rs-0.3.0/target/release/build/mitmproxy-3b069f1b75be182d/build-script-build` (exit status: 101)
--- stderr
thread 'main' panicked at 'protoc is not available: Error { os: "linux", arch: "riscv64" }', build.rs:6:53
```

If the `PROTOC` environment variable is set during the build process, this package will use the `protoc` binary in the `PROTOC` path. Otherwise, it will use the packaged `protoc` binary in `protoc_bin_vendored`. Source Code: https://github.com/mitmproxy/mitmproxy_rs/blob/e81d487f0f64d1ee9a6e1cf3f4e77dc0d266e445/build.rs

While this problem can be solved by adding the binaries under the corresponding platforms to `protoc_bin_vendored`, we believe that a more reasonable way is to modify the PKGBUILD:

```
- makedepends=('maturin' 'python-installer' 'cargo')
+ makedepends=('maturin' 'python-installer' 'cargo' 'protobuf')

build() {
+ export PROTOC=$(command -v protoc)
}
```

You can also find the solution here: https://github.com/felixonmars/archriscv-packages/pull/3043
This task depends upon

Closed by  kpcyrd (kpcyrd)
Saturday, 07 October 2023, 15:16 GMT
Reason for closing:  Fixed
Additional comments about closing:  python-mitmproxy-rs 0.3.11-1
Comment by loqs (loqs) - Saturday, 30 September 2023, 16:19 GMT
Minor nits:
Why not hardcode PROTOC to the system provided /usr/bin/protoc?
Is export required it seems to only be used by one command?
Unrelated to this issue but while updating the PKGBUILD possibly add a prepare function to download the rust libraries ahead of time [1].
See attached diff for suggested changes.

[1] https://wiki.archlinux.org/title/Rust_package_guidelines#Prepare
Comment by Toolybird (Toolybird) - Saturday, 30 September 2023, 21:36 GMT
> on RISC-V64 machine

Hmm, not supported here. It builds fine on supported x86_64. But seeing as requested by @felixonmars and looks like an improvement...
Comment by Wang Haoyu (moui) - Tuesday, 03 October 2023, 12:30 GMT
Thank you for your suggestions!
Comment by kpcyrd (kpcyrd) - Saturday, 07 October 2023, 15:16 GMT
I investigated this and it seems python-mitmproxy-rs has dropped the dependency to protoc, so should work fine on risc-V now.

Loading...