From 86f5ca800d8386fda5f475741dcb8df581d06d1f Mon Sep 17 00:00:00 2001 From: WizzardSK <42868978+WizzardSK@users.noreply.github.com> Date: Wed, 16 Sep 2026 17:28:07 +0200 Subject: [PATCH] libretro: build the Switch core, and turn the iOS 9 job back off (#1180) * ci: turn the iOS 9 job back off, with what it said on the way out It was the one of the five I could not try before pushing, and one run was enough. It compiles the pinned commit and then fails to link: Undefined symbols for architecture armv7: "std::bad_optional_access::~bad_optional_access()" "vtable for std::bad_variant_access" "vtable for std::bad_optional_access" Those arrived in Apple's libc++ with iOS 12 and 32-bit iOS ended at 10, so no armv7 slice of any SDK carries them. Supplying them from the core does work - but it only moves the failure, because building the tip for armv7 stops before that, inside libc++: __format/formatter_floating_point.h:74: error: 'to_chars' is unavailable: introduced in iOS 16.3 std::format with a floating-point argument reaches the floating-point half of , which Apple shipped in iOS 16.3 / macOS 13.3 / tvOS 16.3. Every Apple target here is built below that, which is also what OSX_BUILD_COMMIT is working around - the Apple jobs build a commit from before that code arrived, now some 670 behind. So the job goes back into a comment with both errors in it, rather than being left red for whoever looks at the pipeline next. The other four targets from the last change are green. * ci: build the Switch core, which the recipe has been ready for The libnx template has been in the include list since .gitlab-ci.yml was written, the job under it has been commented out for just as long, and the Makefile has had a platform=libnx branch the whole time - so the Switch has never had a core built from this tree. It does not build as it stands: -std=c++23 defines __STRICT_ANSI__, newlib reads that as "no POSIX names", and libretro.cxx calls strdup: ../../os/libretro/libretro.cxx:140:18: error: 'strdup' was not declared in this scope; did you mean 'strcmp'? -D_GNU_SOURCE in the libnx flags is enough - devkitA64 has the function, the header simply will not declare it otherwise. Built with devkitA64 before turning the job on, so what lands on the buildbot is a job that passes rather than one that finds this out in a nightly. --- .gitlab-ci.yml | 52 +++++++++++++++++++++++++++++----------- src/os/libretro/Makefile | 5 +++- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0af29a45b..e8b8e63e8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -205,16 +205,40 @@ libretro-build-ios-arm64: - git checkout "$OSX_BUILD_COMMIT" # iOS (armv7, iOS 9) -libretro-build-ios9: - tags: - - mac-apple-silicon - extends: - - .libretro-ios9-make-default - - .core-defs - before_script: - - export NUMPROC=$((1 + $(sysctl -n hw.ncpu)/5)) - - git fetch origin - - git checkout "$OSX_BUILD_COMMIT" +# +# Off again after one run, and off for a reason that is worth writing down. +# +# It compiles the pinned commit and then does not link: +# +# Undefined symbols for architecture armv7: +# "std::bad_optional_access::~bad_optional_access()" +# "vtable for std::bad_variant_access" +# "vtable for std::bad_optional_access" +# +# Those members came to Apple's libc++ with iOS 12 and 32-bit iOS stopped at +# 10, so no armv7 slice of any SDK has them. That part can be carried in the +# core, but it is not the wall. Building the tip for armv7 stops earlier, in +# libc++ itself: +# +# __format/formatter_floating_point.h:74: error: 'to_chars' is unavailable: +# introduced in iOS 16.3 +# +# std::format with a floating-point argument reaches the floating-point half of +# , which Apple shipped in iOS 16.3 / macOS 13.3 / tvOS 16.3 - above +# every deployment minimum used here, and the reason OSX_BUILD_COMMIT exists at +# all. So this stays a comment until floating-point formatting stops needing a +# library version armv7 can never have; the include above stays with it. +# +# libretro-build-ios9: +# tags: +# - mac-apple-silicon +# extends: +# - .libretro-ios9-make-default +# - .core-defs +# before_script: +# - export NUMPROC=$((1 + $(sysctl -n hw.ncpu)/5)) +# - git fetch origin +# - git checkout "$OSX_BUILD_COMMIT" # tvOS libretro-build-tvos-arm64: @@ -228,10 +252,10 @@ libretro-build-tvos-arm64: ################################### CONSOLES ################################# # Nintendo Switch -# libretro-build-libnx-aarch64: -# extends: -# - .libretro-libnx-static-retroarch-master -# - .core-defs +libretro-build-libnx-aarch64: + extends: + - .libretro-libnx-static-retroarch-master + - .core-defs #################################### MISC ################################## # webOS 32-bit diff --git a/src/os/libretro/Makefile b/src/os/libretro/Makefile index 37c8bfff9..09807d143 100644 --- a/src/os/libretro/Makefile +++ b/src/os/libretro/Makefile @@ -168,7 +168,10 @@ else ifeq ($(platform), libnx) include $(DEVKITPRO)/libnx/switch_rules TARGET := $(TARGET_NAME)_libretro_$(platform).a DEFINES := -DSWITCH=1 -D__SWITCH__ -DARM - CXXFLAGS += $(DEFINES) -fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -specs=$(LIBNX)/switch.specs + # -std=c++23 defines __STRICT_ANSI__, which is what newlib reads to decide + # whether POSIX names exist at all - and libretro.cxx calls strdup. devkitA64 + # has it; the header just will not declare it without this. + CXXFLAGS += $(DEFINES) -D_GNU_SOURCE -fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -specs=$(LIBNX)/switch.specs CXXFLAGS += -march=armv8-a -mtune=cortex-a57 -mtp=soft -mcpu=cortex-a57+crc+fp+simd -ffast-math $(ASFLAGS) STATIC_LINKING = 1