fn main() { // The prebuilt libwebrtc (pulled by webrtc-sys) ships Objective-C categories in a // static library — e.g. the NSString/abseil-string-view bridge used by the macOS // video-encoder factory. Without `-ObjC`, the linker drops those category object // files, so their selectors are never registered and the first call crashes with // `unrecognized selector +[NSString stringForAbslStringView:]` while building the // PeerConnectionFactory. Force-load ObjC members from the static libs to fix it. let macos = std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos"); let livekit = std::env::var("CARGO_FEATURE_LIVEKIT").is_ok(); if macos && livekit { println!("cargo:rustc-link-arg=-ObjC"); } }