Skip to content

gitlab-ci: build the Switch core's combined archive - #2471

Merged
flyinghead merged 1 commit into
flyinghead:masterfrom
WizzardSK:ci-libnx-combined
Sep 5, 2026
Merged

gitlab-ci: build the Switch core's combined archive#2471
flyinghead merged 1 commit into
flyinghead:masterfrom
WizzardSK:ci-libnx-combined

Conversation

@WizzardSK

Copy link
Copy Markdown
Contributor

Follow-up to #2465: the Switch job builds, but the archive it hands to RetroArch is incomplete.

The libnx template runs cmake --build $BUILD_DIR --target ${CORENAME}_libretro, and on Switch that target is flycast's own objects and nothing else. The dependencies — xxhash, chdr, zip, elf and the resources — are folded in by the combined target that CMakeLists.txt defines for exactly this case:

add_custom_target(combined ALL
    COMMAND ${CMAKE_AR} -x $<TARGET_FILE:xxHash::xxhash>
    ...
    COMMAND ${CMAKE_AR} -rs flycast_libretro_libnx.a *.o

ALL means a plain cmake --build gets it; naming a single target does not. So the job takes the template's script with that one word changed.

Measured on a devkitA64 container, configuring exactly the way the template does:

target members size chd.o / xxhash.o / zip_*.o
flycast_libretro 251 160,395,522 absent
combined 409 171,338,952 present

The run builds the first, checks the archive, then builds the second and checks again.

Without this, make -f Makefile.libnx in retroarch-precompiled links against 158 missing objects.

The alternative would be to move the combined commands into a POST_BUILD step on the library target, so that building flycast_libretro always produces the complete archive and no CI knows about it — happy to do that instead if you prefer it.

The libnx template builds --target ${CORENAME}_libretro, and on Switch that
target is flycast's own objects and nothing else - 251 members. The
dependencies (xxhash, chdr, zip, elf, the resources) are folded in by the
"combined" target that CMakeLists.txt defines for exactly this case, and
that is the archive RetroArch has to link: 409 members.

So the job takes the template's script with that one word changed.

Checked on a devkitA64 container, configuring the way the template does:
--target flycast_libretro gives 251 members / 160 MB, with no chd.o,
xxhash.o or zip_*.o in it; --target combined gives 409 / 171 MB, with them.
@flyinghead
flyinghead merged commit a75d1cf into flyinghead:master Sep 5, 2026
19 checks passed
@WizzardSK
WizzardSK deleted the ci-libnx-combined branch September 5, 2026 14:51
@WizzardSK

Copy link
Copy Markdown
Contributor Author

One thing worth knowing: the merge commit carries [ci skip], so the buildbot skipped the pipeline for it (108292), same as for #2465 and #2466. That is fine for most CI-only changes, but it does mean this particular one - a change to the Switch job itself - has not been exercised yet; it will be on the next master build the buildbot triggers.

@flyinghead

Copy link
Copy Markdown
Owner

Sorry about that. I didn't want to trigger a build since this file isn't used here.

@WizzardSK

Copy link
Copy Markdown
Contributor Author

Sorry, I looks like a misunderstanding. My intention was to move the switch build from this project https://github.com/libretro/flycast to your project because I believe this project is more mature and up to date than that old switch-only fork.

@flyinghead

Copy link
Copy Markdown
Owner

There is indeed some misunderstanding. .gitlab-ci.yml is the libretro build file, and it's only used by libretro for their own builds. This project doesn't build on gitlab and uses the build files in .github/workflows. We do build the libretro core for some platforms but only to verify that the build is working and for testing. We don't publish these builds.
You should probably talk to the libretro team to sort this out.

@WizzardSK

Copy link
Copy Markdown
Contributor Author

That matches my understanding, and it is the reason the PR came here rather than to libretro: the buildbot builds this repository. The recipe in libretro-super reads flycast … https://github.com/flyinghead/flycast master, and git.libretro.com/libretro/flycast-upstream is a mirror of it, so .gitlab-ci.yml only has an effect where it lives now — libretro cannot fix it on their side without carrying a permanent divergence from your tree. Nothing in the PR touches .github/workflows or how you build and publish.

If you would rather not carry libretro's CI quirks in this repo at all, there is a cleaner version of this particular fix: move the combined commands into a POST_BUILD step on the library target, so cmake --build --target flycast_libretro produces a complete archive by itself and no CI file needs to know about it. I am happy to send that instead, and to take the question of which repository the Switch core should come from to the libretro side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants