mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
Added a macOS-only Meson configure-time guard that checks for the exact mismatch you hit: -arch x86_64 in build flags while pkg-config resolves GLib from /opt/homebrew (ARM Homebrew). This now fails early with a clear actionable error instead of letting the build continue to a long linker failure.
The new error message explicitly tells users to choose one consistent setup: native arm64 with /opt/homebrew, or Rosetta/x86_64 with an x86_64 dependency stack (typically /usr/local).
This commit is contained in:
14
meson.build
14
meson.build
@@ -35,6 +35,20 @@ else
|
||||
required: get_option('tls'))
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'darwin'
|
||||
cflags_env = run_command('sh', '-c', 'printf %s "$CFLAGS"', check: false).stdout().strip()
|
||||
ldflags_env = run_command('sh', '-c', 'printf %s "$LDFLAGS"', check: false).stdout().strip()
|
||||
pkgconfig_libs = run_command('pkg-config', '--libs', 'glib-2.0', check: false).stdout()
|
||||
|
||||
targeting_x86_64 = cflags_env.contains('-arch x86_64') or ldflags_env.contains('-arch x86_64')
|
||||
using_arm_homebrew = pkgconfig_libs.contains('/opt/homebrew/')
|
||||
|
||||
if targeting_x86_64 and using_arm_homebrew
|
||||
error('Detected x86_64 build flags (-arch x86_64) while pkg-config resolves glib from /opt/homebrew (arm64). ' +
|
||||
'Use arm64 build flags with /opt/homebrew, or run an x86_64/Rosetta environment with an x86_64 dependency stack (typically /usr/local).')
|
||||
endif
|
||||
endif
|
||||
|
||||
config_h = configuration_data()
|
||||
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
|
||||
config_h.set_quoted('PACKAGE_NAME', meson.project_name())
|
||||
|
||||
Reference in New Issue
Block a user