mirror of
https://github.com/utmapp/UTM.git
synced 2026-10-12 02:24:01 +00:00
scripts: stop dependencies weak-linking pipe2() and dup3()
pipe2() and dup3() are new in the 27.0 SDKs and carry __API_AVAILABLE(macos(27.0), ios(27.0), ...). Both meson's has_function() and autoconf's AC_CHECK_FUNCS declare their own prototype rather than including the system header, so they never see that annotation and report the functions present no matter the deployment target. The real call sites do include <unistd.h>, so clang emits a weak import that is NULL on anything older than 27 and the first call branches to zero. That broke every VM start on iOS 26 and below: -[CSMain init] -> g_main_context_new() -> g_wakeup_new() -> g_unix_open_pipe(), which calls pipe2() when glib is configured with HAVE_PIPE2. glib, gio, gettext and libusb all picked it up in every sysroot built with Xcode 27. Tell both configure systems the functions are missing so the existing pipe() + fcntl(FD_CLOEXEC) fallbacks are compiled in instead. Nothing detects dup3() today, but cover it so the next dependency bump cannot reintroduce the same crash. Assisted-by: Claude:claude-opus-5
This commit is contained in:
@@ -270,6 +270,12 @@ generate_meson_cross() {
|
||||
echo "# Automatically generated - do not modify" > $cross
|
||||
echo "[properties]" >> $cross
|
||||
echo "needs_exe_wrapper = true" >> $cross
|
||||
# pipe2() and dup3() are new in the 27.0 SDKs. Meson's has_function() check declares
|
||||
# its own prototype, so it never sees the availability attribute and reports them
|
||||
# present no matter the deployment target. The real call sites do include the system
|
||||
# header, which leaves a weak import that is NULL when running on an older OS.
|
||||
echo "has_function_pipe2 = false" >> $cross
|
||||
echo "has_function_dup3 = false" >> $cross
|
||||
echo "[built-in options]" >> $cross
|
||||
echo "c_args = [${CFLAGS:+$(meson_quote $CFLAGS)}]" >> $cross
|
||||
echo "cpp_args = [${CXXFLAGS:+$(meson_quote $CXXFLAGS)}]" >> $cross
|
||||
@@ -1216,6 +1222,11 @@ export CXXFLAGS
|
||||
export OBJCFLAGS
|
||||
export LDFLAGS
|
||||
|
||||
# Same reason as the has_function_* properties in the meson cross file: AC_CHECK_FUNCS
|
||||
# declares its own prototype and misses the 27.0 SDK availability attribute.
|
||||
export ac_cv_func_pipe2=no
|
||||
export ac_cv_func_dup3=no
|
||||
|
||||
check_env
|
||||
echo "${GREEN}Starting build for ${PLATFORM_FAMILY_NAME} ${ARCH} [${NCPU} jobs]${NC}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user