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

[macOS] Workaround Xcode 15 linker bug. #81968

Merged
merged 1 commit into from Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion platform/macos/detect.py
@@ -1,6 +1,6 @@
import os
import sys
from methods import detect_darwin_sdk_path
from methods import detect_darwin_sdk_path, get_compiler_version, is_vanilla_clang
from platform_methods import detect_arch

from typing import TYPE_CHECKING
Expand Down Expand Up @@ -119,6 +119,22 @@ def configure(env: "Environment"):
env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"])
env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"])

cc_version = get_compiler_version(env) or {
"major": None,
"minor": None,
"patch": None,
"metadata1": None,
"metadata2": None,
"date": None,
}
cc_version_major = int(cc_version["major"] or -1)
cc_version_minor = int(cc_version["minor"] or -1)
vanilla = is_vanilla_clang(env)

# Workaround for Xcode 15 linker bug.
if not vanilla and cc_version_major == 15 and cc_version_minor == 0:
env.Prepend(LINKFLAGS=["-ld_classic"])

env.Append(CCFLAGS=["-fobjc-arc"])

if not "osxcross" in env: # regular native build
Expand Down