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

Can't compile ZED anymore using Vendor - error: failed to run custom build command for `webrtc-sys v0.3.5 #23247

Open
1 task done
AngryPenguinPL opened this issue Jan 16, 2025 · 4 comments
Labels
linux open source Open source community projects, contributions, etc support User support (non-defect troubleshooting, documentation, etc)

Comments

@AngryPenguinPL
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

The last version of ZED that I managed to compile using the vendored rust crates was 0.164.2. Later versions give an error on compilation that says: failed to run custom build command for `webrtc-sys v0.3.5

Here is the error on Zed version 0.170.0-pre

error: failed to run custom build command for `webrtc-sys v0.3.5 (https://github.com/zed-industries/livekit-rust-sdks?rev=060964da10574cd9bf06463a53bf6e0769c5c45e#060964da)`
DEBUG util.py:461:  Caused by:
DEBUG util.py:461:    process didn't exit successfully: `/builddir/build/BUILD/zed-0.170.0_pre-build/zed-0.170.0-pre/target/release/build/webrtc-sys-fa68416f9d313caf/build-script-build` (exit status: 101)
DEBUG util.py:461:    --- stdout
DEBUG util.py:461:    cargo:rerun-if-env-changed=LK_DEBUG_WEBRTC
DEBUG util.py:461:    cargo:rerun-if-env-changed=LK_CUSTOM_WEBRTC
DEBUG util.py:461:    cargo:CXXBRIDGE_PREFIX=webrtc-sys
DEBUG util.py:461:    cargo:CXXBRIDGE_DIR0=/builddir/build/BUILD/zed-0.170.0_pre-build/zed-0.170.0-pre/target/release/build/webrtc-sys-a4b48bd95e534577/out/cxxbridge/include
DEBUG util.py:461:    cargo:CXXBRIDGE_DIR1=/builddir/build/BUILD/zed-0.170.0_pre-build/zed-0.170.0-pre/target/release/build/webrtc-sys-a4b48bd95e534577/out/cxxbridge/crate
DEBUG util.py:461:    --- stderr
DEBUG util.py:461:    CXX include path:
DEBUG util.py:461:      /builddir/build/BUILD/zed-0.170.0_pre-build/zed-0.170.0-pre/target/release/build/webrtc-sys-a4b48bd95e534577/out/cxxbridge/include
DEBUG util.py:461:      /builddir/build/BUILD/zed-0.170.0_pre-build/zed-0.170.0-pre/target/release/build/webrtc-sys-a4b48bd95e534577/out/cxxbridge/crate
DEBUG util.py:461:    thread 'main' panicked at /builddir/build/BUILD/zed-0.170.0_pre-build/zed-0.170.0-pre/vendor/webrtc-sys/build.rs:85:45:
DEBUG util.py:461:    called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("github.com")), port: None, path: "/zed-industries/webrtc/releases/download/m114_release_patched/webrtc-linux-x64-release.zip", query: None, fragment: None }, source: hyper::Error(Connect, ConnectError("dns error", Os { code: 16, kind: ResourceBusy, message: "Device or resource busy" })) }
DEBUG util.py:461:    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
DEBUG util.py:461:  warning: build failed, waiting for other jobs to finish...

Full build log: https://file-store.openmandriva.org/api/v1/file_stores/772278ed0f9367f6cf2c32e5396f4c7d272f3b49.log?show=true

I don't know what is visible in the livekit-rust-sdks log, but it is most likely not automatically added to the list of vendored rust dependencies.
In the vendor directory after executing "cargo vendor" I see only livekit, livekit-api, livekit-protocol and livekit-runtime, but there is no livekit-rust-sdk there...

The said webrtc-sys was vendored correctly.

I will add that I do not fully understand this error.

Does anyone know how to solve this?

Also looks like similar problem stopped opensuse package to build: https://build.opensuse.org/package/live_build_log/editors/zed/15.6/x86_64

Zed Version and System Specs

Zed from 0.166.0 to 0.170-pre

If applicable, add screenshots or screencasts of the incorrect state / behavior

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

@AngryPenguinPL AngryPenguinPL added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Jan 16, 2025
@notpeter
Copy link
Member

  1. Can you provide info about the platform you are trying to compile on (distro/version)?
  2. Can you provide explicit steps/commands you are using to build (e.g. git clone, script/linux, cargo build --release, etc)
  3. Looking at your log, there appears to be a DNS error resolving github.com are you trying to run this build somewhere offline or with restricted access ot the internet?

DEBUG util.py:461: called Result::unwrap() on an Err value: reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("github.com")), port: None, path: "/zed-industries/webrtc/releases/download/m114_release_patched/webrtc-linux-x64-release.zip", query: None, fragment: None }, source: hyper::Error(Connect, ConnectError("dns error", Os { code: 16, kind: ResourceBusy, message: "Device or resource busy" })) }

@notpeter notpeter added linux open source Open source community projects, contributions, etc support User support (non-defect troubleshooting, documentation, etc) needs info / awaiting response Issue that needs more information from the user and removed bug [core label] triage Maintainer needs to classify the issue admin read Pending admin review labels Jan 16, 2025
@AngryPenguinPL
Copy link
Author

AngryPenguinPL commented Jan 16, 2025

Os: OpenMandriva Cooker, but same problem is also on OpenSuse Tumbleweed.

  1. Download released source code : https://github.com/zed-industries/zed/archive/refs/tags/v0.169.2.tar.gz
  2. Unpack
  3. Run inside source dir command to vendor rust dependencies: cargo vendor
  4. Compress newly created vendor folder to tar.xz
  5. Configure cargo to use vendored libs as:
    %cargo_prep -v vendor
  6. Build with
# Build CLI
cd crates/cli/
cargo build --release
# Build Editor
cd ../zed/
cargo build --release --verbose

And yes, trying to build it outside of internet (unfortunately this is the policy of many linux systems, where the build must be performed without access to the network, using only libraries from the repository or vendored rust crates).
From this it follows that cargo is trying to download the missing file: zed-industries/webrtc/releases/download/m114_release_patched/webrtc-linux-x64-release.zip",
but it not have access to the network.
It seems to me that this file should be downloaded by "cargo vendor" and then vendored, but for some reason this does not happen.

@notpeter notpeter removed the needs info / awaiting response Issue that needs more information from the user label Jan 18, 2025
@mgsloan
Copy link
Contributor

mgsloan commented Jan 19, 2025

I believe that livekit's rust sdk is this way because it uses a patched libwebrtc. So it downloads a statically linked build of it to avoid needing to require all the build deps / build time of libwebrtc.

I wrote some docs after figuring out how to build with a patched version of libwebrtc, should be exactly what you need to build offline / fully from source: https://github.com/livekit/rust-sdks/blob/main/webrtc-sys/libwebrtc/README.md

It does seem pretty non-ideal to have a download of a precompiled binary as part of the build process. I'm not sure what a clean solution would look like (I don't yet know how vendoring C via crates works)

I recommend you use Zed's patched version. For some inscrutable reason, for me port numbers were getting serialized to gibberish, and this patch fixed the issue?!?! :

Image

So Zed's fork of libwebrtc includes both LiveKit's patches and this patch.

mgsloan referenced this issue in zed-industries/webrtc Jan 19, 2025
…rtAsString()`

Justification for this change is that `std::to_string` should be
avoided as it uses the user's locale and calls to it get serialized,
which is bad for concurrency.

My actual motivation for this is quite bizarre. Before this change,
with Zed's use of the LiveKit Rust SDK, I was getting connection
strings that were not valid utf-8, instead having a port of
`3\u0000\u0000\u001c\u0000`. I have not figured out how that could
happen or why this change fixes it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linux open source Open source community projects, contributions, etc support User support (non-defect troubleshooting, documentation, etc)
Projects
None yet
Development

No branches or pull requests

3 participants