Skip to content

Fix build failure on macOS for developers who have multiple clang installations - #697

Merged
ladvoc merged 1 commit into
livekit:mainfrom
ssaakaash:main
Oct 5, 2025
Merged

Fix build failure on macOS for developers who have multiple clang installations #697
ladvoc merged 1 commit into
livekit:mainfrom
ssaakaash:main

Conversation

@ssaakaash

Copy link
Copy Markdown
Contributor

Problem

The webrtc-sys build script was using Command::new("clang") to discover compiler library paths. On a system with Homebrew's llvm package installed, this command could resolve to /usr/local/bin/clang instead of the required Xcode toolchain compiler.

This caused the script to pass incorrect library search paths to the linker, resulting in errors like:

ld: warning: search path '/usr/local/lib/clang/22/lib/darwin' not found
ld: library 'clang_rt.osx' not found

Solution

The fix is to change Command::new("clang") to Command::new("cc") within the configure_darwin_sysroot function in build.rs.

On macOS, cc is the system's default compiler alias and is guaranteed to respect the toolchain set by xcode-select. This ensures that even if other versions of clang are in the PATH, the build script will always get the correct search paths from the active Xcode toolchain.

This makes the build process more robust and resilient to variations in the user's local environment.

@CLAassistant

CLAassistant commented Aug 31, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@davidzhao

Copy link
Copy Markdown
Member

it would appear this change would break the build script, could you take a look?

@ssaakaash

Copy link
Copy Markdown
Contributor Author

Don't know why the tests failed in the workflow, it doesn't break the current build script.

@ladvoc
ladvoc self-requested a review October 3, 2025 09:37

@ladvoc ladvoc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests pass now, LGTM ✅

@ladvoc
ladvoc merged commit 14787ce into livekit:main Oct 5, 2025
6 of 9 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 5, 2025
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.

4 participants