fix(build): link when the build files folder's path has a comma #2137
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!2137
Loading…
Reference in a new issue
No description provided.
Delete branch "link-path-comma"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A build stops at the link, after the whole compile, when the folder chosen for the build files has a comma in its path
(for example
D:\Games, Zeldapicked in the builder, or--work): the compiler splits the linker options that name thelink map and the link order at that comma. A failed link also makes the next build translate and compile everything
again (
make_game.py), and it fails the same way.Fixes #2257.
What changed
nx2/build.py:linker()passes linker options each after-Xlinker, as one argument (with llvm-mingw as-Xlink=<option>, astoolchain.link_optdoes). It is used for the options that name a file in the build filesfolder, which went through
-Wl,(directly on Linux, throughtoolchain.link_opton Windows):-Map=on Linux,/map:on Windows), of the Vulkan back end, and of--dll;hot_order.txtin that folder (--symbol-ordering-file=on Linux,/order:@on Windows).The other linker options are constants and stay as they are.
tests/test_link_path_comma.py(new, game-free):-Wl,option inbuild.pycarries anything but a constant, andtoolchain.link_optis given only constants;linker()andHOT_ORDER()give for Linux, the MSVC target and llvm-mingw, with a build files folder namedGames, Zelda;lld-link and the MinGW driver, writes its map there. Without lld that part skips itself (CI's Ubuntu has clang but
perhaps not lld); the first two parts need nothing.
How it was tested
Linux (Arch, clang and lld 23.1.3), no GPU involved:
nx2/build.py --standalonewithOOT_WORKset to a folder namedx,y(a copy of a full build's files from main, soonly the files changed since were compiled). On main (
fab8cb3) the link stops:With this change both links pass and write
hookshot.mapandhookshot_vk.so.mapinx,y. All 3682 functions of thelink order are in the new map at the same addresses as in main's own build (built in a folder with no comma), and in
the list's order: the order still takes effect through
-Xlinker.The Windows options, linked from Linux with the same clang for both Windows targets: a small program linked into a
folder named
a,bwith the old options fails (lld-link: error: could not open 'b/hookshot.map'; llvm-mingw's ld.lldgives
ld.lld: error: could not open 'b/hookshot.map';/order:@the same withb/hot_order.txt). With-Xlinkeritlinks and writes the map.
The compile options that also carry paths in the build files folder (
-I,-include,-fprofile-instr-use=) are notsplit at commas: a small compile with a profile in
a,bpasses.The new test passes; run against main's
build.py(--build-script) it fails 8 times, and names the 7 optionsthat carried a path (build.py lines 136, 137, 1073, 1092, 1142, 1147, 1161 on main).
python -I -B tests/run_all.py: 362 passed, 2 failed, 10 skipped. The same 2 fail on main here, forreasons of this machine (
tests/test_updater_asset_digest.py: dotnet cannot restore its packages offline;tests/test_wayland_libdecor_hint.py: clang 23's new-Wunused-but-set-globalon its harness). Every other checkhas the same result as on main; the new one passes.
After a rebase onto current
main(e0578ede) the new test was run again and passes (6 tests, with the three reallinks); the full set above was run on
fab8cb3, before the rebase.Not tested
from Linux with clang 23's lld-link and ld.lld (MinGW).
2026-11-11: @Arkex-ai ran the new test's six cases on Windows with llvm-mingw's clang 23 and LLVM's lld, with the
three real links, at
0d240b30(see the comments). Still not run: a full Builder build on Windows.make_game.pybuild into a folder with a comma: the lift and the full compile were not run there, onlybuild.py's compile of the changed files and its two links.-Wl,-map,<path>would have the same fault).Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 [email protected]
Additional Windows validation at
0d240b30: all six tests pass with llvm-mingw clang23 and LLVM lld, including the real no-CRT links for the ELF, MSVC and MinGW routes. Each writes its map inGames, Zelda; the order file is supplied too.I also reproduced the original failure on main
49f75dc8with separate authored programs on Windows and Linux: both the map path and order-file path break at a comma, while the same paths with spaces alone link successfully. This looks relevant to the new report #2257.These are game-free linker fixtures, not a full
make_game.pybuild or game runtime test.Thanks for running it on Windows: that was the part I could not do here.
And yes, #2257 is this fault: its two error lines are the map's path and
hot_order.txt's, each beginning right after the comma in the reporter's folder name. I've addedFixes #2257and a note about your run to the description, and told the reporter the way around it until this is merged (a build files folder with no comma in its path).Rebased onto main
b29967bfso the workflows run here: they had waited for an approval on the old head, and main's game-free tests are green again since #2380. The patch is unchanged (git range-diff: the commit is equal), and its test passes on the new base.Looks good. The cause is right: clang splits
-Wl,at every comma, and the map andhot_order.txtpaths sit in the user-chosen build files folder. I checked every option in the diff that carries a path and each now goes through-Xlinkeras its own argv entry. The comma is the only character that clang's own-Wl,splitting treats specially, so spaces and non-ASCII (UTF-8) paths are fine, since this is a list-formsubprocess.run, not a shell string. The@rspfiles are not touched by this change. The remaining-Wl,options are constants (--gc-sections,-Bsymbolic,--export-dynamic-symbol=hos_posix_*), and the test guards that with the AST check.The llvm-mingw route (
-Xlinker -Xlink=/map:...) matches whattoolchain.link_optalready emitted, minus the-Wl,wrapper. Arkex-ai's Windows run with llvm-mingw clang 23 and lld, including the real links, confirms it. That was the one thing I could not check from here. The test is game-free, needs no dump, and skips the real links when lld is absent.CI: the two red jobs look unrelated to this change.
tests/test_native_astc_texture_count.pyon windows-2022 fails with'scanf' is deprecated(-Werror) in its own fixture, andappimagefails in its System packages step on network timeouts. Both are in files this PR does not touch, but check that main's latest run shows the same. The Conventional Commit title check was still pending when I looked.Nit, not blocking: the
linker()docstring is long for a three-line helper. It is fine to keep as is.Paths go to the linker through
-Xlinker(and-Xlink=for llvm-mingw) instead of-Wl,, which splits on commas. In the merged result I found no other-Wl,orlink_optcarrying a path. The red checks are main's old ASTC test failure (#2397) and a Launchpad PPA timeout on appimage, neither from this PR.github-sync referenced this pull request2026-11-12 06:22:54 +00:00