Skip to content

Commit bd2452c

Browse files
mralephCommit Queue
authored and
Commit Queue
committed
[infra] Workaround Python binary pecularities on Mac OS X
For some reason `python3` binary shipped with Mac OS X sets LIBRARY_PATH, SDKROOT and CPATH environment variables. This affects clang if it is spawned in such a modified environment, because it picks and uses those values. This CL simply removes these variables from the environment if they are present. See also https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4149962 Fixes #52411 [email protected] Change-Id: Id71ece4c3232c3e9ad19dc07d7546d1012d6330f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306540 Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Slava Egorov <[email protected]>
1 parent ecf1968 commit bd2452c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tools/build.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,19 @@ def Main():
251251
env = dict(os.environ)
252252
env.update(SanitizerEnvironmentVariables())
253253

254+
# macOS's python sets CPATH, LIBRARY_PATH, SDKROOT implicitly.
255+
#
256+
# See:
257+
#
258+
# * https://openradar.appspot.com/radar?id=5608755232243712
259+
# * https://github.com/dart-lang/sdk/issues/52411
260+
#
261+
# Remove these environment variables to avoid affecting clang's behaviors.
262+
if sys.platform == 'darwin':
263+
env.pop('CPATH', None)
264+
env.pop('LIBRARY_PATH', None)
265+
env.pop('SDKROOT', None)
266+
254267
# Always run GN before building.
255268
gn_py.RunGnOnConfiguredConfigurations(options)
256269

0 commit comments

Comments
 (0)