Skip to content

Commit f771d2d

Browse files
danakjAravind Vasudevan
authored andcommitted
Set SDKROOT for Mac Rust toolchain builds
This ensures that clang is able to find our sysroot libraries when linking rust targets, even when running tests. Bug: 1386212 Change-Id: I3b43e33a697fddd30a69fc5e9120799fc91cc2c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4234820 Commit-Queue: danakj <[email protected]> Reviewed-by: Hans Wennborg <[email protected]> Cr-Commit-Position: refs/heads/main@{#1104481} NOKEYCHECK=True GitOrigin-RevId: 4a733637401125bec9c31cdea225c23c6dfb5ce6
1 parent 3f554ee commit f771d2d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

build_rust.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ def RunXPy(sub, args, llvm_bins_path, zlib_path, libxml2_dirs, build_mac_arm,
279279
'CFLAGS',
280280
'CXXFLAGS',
281281
'LDFLAGS',
282-
'RUSTFLAGS',
283282
'RUSTFLAGS_BOOTSTRAP',
284283
'RUSTFLAGS_NOT_BOOTSTRAP',
285284
'RUSTDOCFLAGS',
@@ -316,10 +315,10 @@ def RunXPy(sub, args, llvm_bins_path, zlib_path, libxml2_dirs, build_mac_arm,
316315
f' -Clink-arg=-isysroot -Clink-arg={sdk_path}')
317316
RUSTENV['RUSTFLAGS_NOT_BOOTSTRAP'] += (
318317
f' -Clink-arg=-isysroot -Clink-arg={sdk_path}')
319-
# This flag needs to be in RUSTFLAGS for running compiletests as well,
320-
# for building things _with_ rustc, not just for building rustc.
321-
RUSTENV['RUSTFLAGS'] += (
322-
f' -Clink-arg=-isysroot -Clink-arg={sdk_path}')
318+
# Rust compiletests don't get any of the RUSTFLAGS that we set here and
319+
# then the clang linker can't find `-lSystem`, unless we set the
320+
# `SDKROOT`.
321+
RUSTENV['SDKROOT'] = sdk_path
323322

324323
if zlib_path:
325324
RUSTENV['CFLAGS'] += f' -I{zlib_path}'

0 commit comments

Comments
 (0)