diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2022-12-05 00:28:59 +0530 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2022-12-05 09:30:34 +0000 |
commit | 8ac9709fc4071386bd4b2817830b1b76181a4bb5 (patch) | |
tree | 0396c5f0fec5f56514c5bb65e33cc6bd084037d0 /config | |
parent | 4f92a5b430a67f3605d7aa4853971e6b531d0456 (diff) |
macOS, iOS: Fix Xcode 14 ABI breakage with older Xcode
Starting with Xcode 14, clang emits `_objc_msgSend` stubs that are
unsupported by older Xcode toolchains. This makes artifacts created
with Xcode 14 unusable with older Xcode versions.
Disable this for now. Other projects are doing the same thing:
https://github.com/llvm/llvm-project/issues/56034
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1034>
Diffstat (limited to 'config')
-rw-r--r-- | config/darwin.config | 11 | ||||
-rw-r--r-- | config/ios.config | 13 |
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'] |