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

Use lld when building with mzcompose on macOS #30797

Merged
merged 1 commit into from
Dec 11, 2024
Merged
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
11 changes: 8 additions & 3 deletions misc/python/materialize/xcompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,13 @@ def cargo(

if sys.platform == "darwin":
_bootstrap_darwin(arch)
lld_prefix = spawn.capture(["brew", "--prefix", "lld"]).strip()
sysroot = spawn.capture([f"{_target}-cc", "-print-sysroot"]).strip()
rustflags += [f"-L{sysroot}/lib"]
rustflags += [
f"-L{sysroot}/lib",
"-Clink-arg=-fuse-ld=lld",
f"-Clink-arg=-B{lld_prefix}/bin",
]
env.update(
{
"CMAKE_SYSTEM_NAME": "Linux",
Expand Down Expand Up @@ -242,7 +247,7 @@ def _bootstrap_darwin(arch: Arch) -> None:
# Building in Docker for Mac is painfully slow, so we install a
# cross-compiling toolchain on the host and use that instead.

BOOTSTRAP_VERSION = "4"
BOOTSTRAP_VERSION = "5"
BOOTSTRAP_FILE = MZ_ROOT / "target-xcompile" / target(arch) / ".xcompile-bootstrap"
try:
contents = BOOTSTRAP_FILE.read_text()
Expand All @@ -251,7 +256,7 @@ def _bootstrap_darwin(arch: Arch) -> None:
if contents == BOOTSTRAP_VERSION:
return

spawn.runv(["brew", "install", f"materializeinc/crosstools/{target(arch)}"])
spawn.runv(["brew", "install", "lld", f"materializeinc/crosstools/{target(arch)}"])
spawn.runv(["rustup", "target", "add", target(arch)])

BOOTSTRAP_FILE.parent.mkdir(parents=True, exist_ok=True)
Expand Down
Loading