Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Fix macOS support on Big Sur & Monterey #680

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lucetc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,15 @@ fn ldflags_default(target: &Triple, target_version: &TargetVersion) -> String {
| OperatingSystem::Freebsd
| OperatingSystem::Dragonfly
| OperatingSystem::Netbsd
| OperatingSystem::Openbsd => "-shared",
| OperatingSystem::Openbsd => "-shared".to_string(),
OperatingSystem::Darwin | OperatingSystem::MacOSX { .. } => {
"-dylib -dead_strip -export_dynamic -undefined dynamic_lookup"
let sdk_path = std::process::Command::new("xcrun")
.args(&["-sdk", "macosx", "--show-sdk-path"])
.output()
.expect("xcrun failed")
.stdout;
let sdk_path = std::str::from_utf8(&sdk_path).expect("invalid sdk_path").trim();
format!("-dylib -dead_strip -export_dynamic -undefined dynamic_lookup -L {}/usr/lib -lSystem", sdk_path)
}
_ => panic!(
"Cannot determine default flags for {}.
Expand Down