summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/darwin.config11
-rw-r--r--config/ios.config13
2 files changed, 22 insertions, 2 deletions
diff --git a/config/darwin.config b/config/darwin.config
index 7d59262a..3f6fbe11 100644
--- a/config/darwin.config
+++ b/config/darwin.config
@@ -49,6 +49,10 @@ if sdk_root is None:
elif not os.path.exists(sdk_root):
raise FatalError("Determined SDK path %s does not exist. Is your XCode installation broken?" % sdk_root);
+ret = shell.check_output(['xcodebuild', '-version']).strip()
+assert(ret.startswith('Xcode'))
+xcode_version = tuple(int(c) for c in ret.split()[1].split('.'))
+
min_osx_sdk_version = min_osx_sdk_version or '10.11'
sdk='-mmacosx-version-min=%s -isysroot %s' % (min_osx_sdk_version, sdk_root)
@@ -71,6 +75,11 @@ elif target_arch == Architecture.ARM64:
arch_ldflags += ' -arch arm64 -m64 -Wl,-arch,arm64'
arch_cflags += ' -Wno-error=format-nonliteral '
+# Starting with XCode 14, clang emits code that makes all binaries incompatible
+# with older XCode versions. Disable that feature.
+arch_objcflags = ''
+if xcode_version >= (14, 0):
+ arch_objcflags = ' -fno-objc-msgsend-selector-stubs '
incl_dir = os.path.join(prefix, 'include')
@@ -86,6 +95,8 @@ for f in ['CFLAGS', 'CCASFLAGS', 'CXXFLAGS', 'OBJCFLAGS', 'OBJCXXFLAGS']:
env[f] += ' %s ' % incflag
if sdk not in env[f]:
env[f] += ' %s ' % sdk
+env['OBJCFLAGS'] += arch_objcflags
+env['OBJCXXFLAGS'] += arch_objcflags
# To ensure that AC_CHECK_HEADER etc detect the right headers
if arch_cflags not in env['CPPFLAGS']:
diff --git a/config/ios.config b/config/ios.config
index c37bfaf3..1a4475de 100644
--- a/config/ios.config
+++ b/config/ios.config
@@ -66,6 +66,10 @@ elif _sdk_version is None:
else:
target_distro_version = _sdk_version
+ret = shell.check_output(['xcodebuild', '-version']).strip()
+assert(ret.startswith('Xcode'))
+xcode_version = tuple(int(c) for c in ret.split()[1].split('.'))
+
sysroot = version_array_to_sdk_location(best_version)
ccache = use_ccache and 'ccache ' or ''
@@ -104,6 +108,11 @@ else:
env['CC']= 'clang'
env['CXX']= 'clang++'
extra_cflags += ' -Wno-error=format-nonliteral -Wno-error=implicit-function-declaration '
+# Starting with XCode 14, clang emits code that makes all binaries incompatible
+# with older XCode versions. Disable that feature.
+extra_objcflags = ''
+if xcode_version >= (14, 0):
+ extra_objcflags += ' -fno-objc-msgsend-selector-stubs '
env['PATH'] = '%s:%s' % (toolchain_path, env['PATH'])
env['OBJC'] = env['CC']
@@ -130,8 +139,8 @@ else:
env['LDFLAGS'] += '-Wl,-ios_simulator_version_min,{0} '.format(ios_min_version)
env['CFLAGS'] += extra_cflags
env['LDFLAGS'] += extra_ldflags
-env['OBJCFLAGS'] = env['CFLAGS']
-env['OBJLDFLAGS'] = env['LDFLAGS']
+env['OBJCFLAGS'] = env['CFLAGS'] + extra_objcflags
+env['OBJLDFLAGS'] = env['LDFLAGS'] + extra_objcflags
env['CXXFLAGS'] =' -stdlib=libc++ ' + env['CFLAGS']
env['OBJCXXFLAGS'] =' -stdlib=libc++ ' + env['CFLAGS']