Skip to content

Commit ce8d59d

Browse files
build(macos): Allow compiling without Xcode (#2733)
When the Xcode app is not installed, compiling `apple-catalog-parsing` fails due to linker errors. The problem can be fixed by expanding the linker search path. Fixes #2732
1 parent e3e0caf commit ce8d59d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

apple-catalog-parsing/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ fn main() {
2727
// sandbox already. Nested sandboxes are not allowed on Darwin.
2828
println!("cargo:rerun-if-env-changed={SWIFT_DISABLE_SANDBOX}");
2929

30+
// Add necessary libraries to the linker search path. Without this line, compiling fails
31+
// on systems without Xcode installed (xcode-select is still required).
32+
println!(
33+
"cargo:rustc-link-search=native=/Library/Developer/CommandLineTools/usr/lib/swift/macosx"
34+
);
35+
3036
let out_dir = env::var("OUT_DIR").expect("OUT_DIR is set for build scripts");
3137

3238
// Compile Swift code

0 commit comments

Comments
 (0)