From 8d51b02ca05d1c4863409a4ac7852afdb64682c8 Mon Sep 17 00:00:00 2001 From: deepend Date: Thu, 19 Feb 2026 12:03:27 -0700 Subject: [PATCH] Updated the macOS Darwin arch sanity check to detect when a build is intentionally universal (-arch arm64 and -arch x86_64) instead of treating it as an x86_64-only mismatch. This allows universal binary compile flows to proceed through configuration. Kept the protective failure for true x86_64-only builds that resolve ARM Homebrew libraries (/opt/homebrew) and updated the error text to explicitly mention universal builds as a supported path. --- meson.build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 2a813b74..891f3bc5 100644 --- a/meson.build +++ b/meson.build @@ -49,11 +49,13 @@ if host_machine.system() == 'darwin' and darwin_arch_sanity_check pkgconfig_glib = run_command('pkg-config', '--libs-only-L', 'glib-2.0', check: false) targeting_x86_64 = cflags_env.contains('-arch x86_64') or ldflags_env.contains('-arch x86_64') + targeting_arm64 = cflags_env.contains('-arch arm64') or ldflags_env.contains('-arch arm64') + targeting_universal = targeting_x86_64 and targeting_arm64 using_arm_homebrew = pkgconfig_glib.returncode() == 0 and pkgconfig_glib.stdout().contains('/opt/homebrew/') - if targeting_x86_64 and using_arm_homebrew + if targeting_x86_64 and not targeting_universal 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). ' + + 'Use arm64 build flags with /opt/homebrew, use a universal build (-arch arm64 -arch x86_64) with universal dependencies, or run an x86_64/Rosetta environment with an x86_64 dependency stack (typically /usr/local). ' + 'To bypass this safety check, configure with -Ddarwin-arch-sanity-check=false or set ZOITECHAT_DARWIN_ARCH_SANITY_CHECK=0.') endif endif