Skip to content

docs(usage): name the mimalloc DLLs a self-built Windows libs/ needs - #8909

Open
dantdmdarealguy wants to merge 1 commit into
boykopovar:mainfrom
dantdmdarealguy:docs/usage-mimalloc-dlls
Open

dantdmdarealguy wants to merge 1 commit into
boykopovar:mainfrom
dantdmdarealguy:docs/usage-mimalloc-dlls

Conversation

@dantdmdarealguy

Copy link
Copy Markdown
Contributor

What

Since #6067 the Windows libs target also writes mimalloc.dll and mimalloc-redirect.dll to build/core/libs/libs (core/libs/CMakeLists.txt L207-227). tools/package_release.py L55 puts both in the release archives. The Windows entry stub loads mimalloc.dll from the run path only when APS5_MIMALLOC is set (WindowsEntryStubBuilder.cpp L103-133, ARCHITECTURE.md L65-66). The runtime layout in USAGE.md tells a self-built libs/ to take build/core/libs/libs/*.prx and the three MinGW runtime DLLs, and nothing else. #6067 did not change USAGE.md. A libs/ set up that way runs with APS5_MIMALLOC set, but it never loads mimalloc and prints nothing.

The paragraph on the MinGW runtime DLLs now names the two mimalloc DLLs: they are loaded from libs/ with APS5_MIMALLOC, they are copied from build/core/libs/libs, and without them the title keeps the C runtime's heap and prints nothing.

Tested

Windows 11 Pro, Intel Core i9-14900K, 128 GB RAM, NVIDIA GeForce RTX 5080 (driver 32.0.16.1742), WinLibs GCC 15.2.0 (15.2.0posix-14.0.0-ucrt-r7), Git for Windows 2.51.0.

Setup: a fresh clone of main (6696def6e), with the Windows steps of docs/dev/BUILD.md and docs/user/USAGE.md run in the order given, in Windows PowerShell:

  • git submodule update --init --recursive
  • the $env:PATH line, with C:\winlibs\mingw64\bin as the toolchain path
  • cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, with SSL_CERT_FILE set to Git's mingw64 CA bundle as the Requirements say
  • cmake --build build
  • cmake --build build --target libs
  • the runtime DLL Copy-Item loop

ScreenTester5 (PPSA69420) was then unwrapped with tools/unwrap_self.py, relinked with relinker --windows source/eboot.elf run/app.exe and laid out as the runtime layout says: libs/ with build/core/libs/libs/*.prx and the three MinGW DLLs, and app0/ with eboot.bin, sce_sys/ and the converted sce_module/. .\app.exe runs to its menu.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes, some AI assistance was used

What was run, step by step (fresh clone X:/aps5-agents/docsweep-work/AnyPS5, main 6696def6e)

Documented step Result Adjusted
BUILD.md "Full build": git submodule update --init --recursive ok (2 min 45 s) none (clone used --reference-if-able to the local clone and submodule.alternateLocation=superproject to save bandwidth; this does not change the commands)
BUILD.md Requirements: WinLibs 15.2.0posix-14.0.0-ucrt-r7, Git with Bash, Python 3 present WinLibs at C:\winlibs\mingw64
BUILD.md Windows setup: $env:PATH = "...\mingw64\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;$env:PATH" ok toolchain path C:\winlibs\mingw64\bin instead of C:\tools\winlibs\... (the doc says to adjust)
BUILD.md Commands: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ without SSL_CERT_FILE: Could not download FFmpeg 9ac4cfd195f1: 60;"SSL peer certificate or SSH remote key was not OK...", exactly as the Requirements bullet predicts. With $env:SSL_CERT_FILE = "C:\Program Files\Git\mingw64\etc\ssl\certs\ca-bundle.crt" (Git 2.51 < 2.56, so mingw64, as the doc says): ok none
cmake --build build --parallel ok, 487 steps, no .prx built (matches "With the default BUILD_TESTING=OFF, the default build does not produce them") --parallel 6 (machine rule)
cmake --build build --target libs --parallel ok, 1835 steps, 354 .prx in build/core/libs/libs plus mimalloc.dll, mimalloc-redirect.dll, unpatched/, implib/. 6 warnings, all in glslang or libstdc++ headers --parallel 6
Runtime DLL Copy-Item loop ok $toolchainBin = "C:\winlibs\mingw64\bin"
USAGE.md: tools/unwrap_self.py on the title's eboot.bin (SELF 4f153d1d) and sce_module/libc.prx (fSELF 5414f5ee) ok input copied from X:/aps5-agents/homebrew1-titles/PPSA69420-hb1/extracted/PPSA69420
USAGE.md: relinker --windows source/eboot.elf run/app.exe ok: 208 NID references, app0/sce_module/libc.prx.guest.prx relinker is not on PATH; ran build/core/relinker/relinker.exe (see follow-up 1)
USAGE.md runtime layout + .\app.exe (SDL_AUDIODRIVER=dummy) ScreenTester5 runs to its menu on the RTX 5080 (TV, screenshot X:/aps5-agents/docsweep-work/shots/screentester5.png), no error lines none

README.md has no Windows steps; it links to BUILD.md and USAGE.md. Nothing in it to follow or fix.

All the main-path steps work as written. The only verified inaccuracy is the one fixed: the Windows runtime layout leaves out the two mimalloc DLLs.

Evidence for the fix

  • core/libs/CMakeLists.txt L207-227: if(TARGET mimalloc) copies mimalloc.dll (with pe_import_first) and mimalloc-redirect.dll into PATCHED_DIR (build/core/libs/libs) as libs outputs. The mimalloc target is created in the root CMakeLists.txt L358-363 (the MinGW branch).
  • WindowsEntryStubBuilder.cpp L103 and L125-133: APS5_MIMALLOC and path + "mimalloc.dll", where path is the run path (libs/ by default). ARCHITECTURE.md L65-66 says the same and says the load fails quietly without the DLL.
  • tools/package_release.py L54-55: the Windows archive gets the three MinGW DLLs and both mimalloc DLLs. The release_package ctest passes.
  • git show --stat 9824c46fe (feat(libs): let relinked Windows games opt into mimalloc #6067, merged 2026-10-19) changed ARCHITECTURE.md and ENVIRONMENT.md but not USAGE.md.
  • Measured with ScreenTester5 and APS5_MIMALLOC=1, reading (Get-Process).Modules 12 s after launch (X:/aps5-agents/docsweep-scripts/mimalloc_probe.ps1):
    • documented layout: none loaded;
    • mimalloc.dll only: none loaded;
    • both DLLs: libs\mimalloc.dll and libs\mimalloc-redirect.dll loaded.
    • In all three runs stdout and stderr have no mimalloc text, and the title reaches its menu.
  • No open or closed PR or issue covers this (gh pr list --state all --search mimalloc, gh issue list --search mimalloc). Claimed on the board (feat(shader): implement MIMG sample/gather flag variants #226), with finding refactor(ajm): drop duplicated stub exports from libSceAjm and libSceAjmi #228.

Verification of the branch ($BUILD_DIR = X:/aps5-agents/docsweep-build)

  • Before configuring, the clone had four uninitialized submodules (ZArchive, mbedtls, mimalloc, zstd). The first configure failed on them. git submodule update --init --recursive fixed it. This was my environment, not a doc problem.
  • cmake --build "$BUILD_DIR" --parallel 6 fails on one target only: agc_driver_image_array_window_past_layer_limit_tests (ImageArrayWindowPastLayerLimit.cpp:33:52: error: requested alignment '65536' exceeds object file maximum 8192). It is on unmodified main (from ed599f525), it is MinGW-only and winsweep3 already reported it. Open PR test(agc): align the array window test's texels at run time #8310 fixes it. With -- -k 0 every other target builds.
  • cmake --build "$BUILD_DIR" --target libs --parallel 6: ok.
  • ctest --test-dir "$BUILD_DIR" --output-on-failure --timeout 120 --parallel 2 -R "^(release_package|patched_libraries|pe_import_first)$": 3/3 pass, 354 patched libraries loaded, 0 failed.
  • python tools/check_test_registration.py "$BUILD_DIR": 1140 test executable(s), 0 built and not run as recorded, none new.
  • python tools/check_conventions.py --base origin/main: All conventions checks passed.
  • The change adds no test: it is documentation only, and the before/after evidence is the module probe above.

Other findings, not fixed (for follow-ups)

  1. USAGE.md calls relinker ... as if it were on PATH. BUILD.md names the executable's path only for the relinker-only build (build-relinker/core/relinker/relinker). The full build writes it to build/core/relinker/relinker.exe, and the docs never say so. A reader of the Windows steps has to find it. This is minor and only a missing pointer.
  2. BUILD.md's "Windows setup and troubleshooting" section, read alone, does not mention SSL_CERT_FILE. The configure command fails with status 60 unless the reader has applied the Requirements bullet. The doc is correct, but the Windows section's order invites the failure. A one-line $env:SSL_CERT_FILE = ... beside the $env:PATH line would make the sequence runnable as written. I didn't change it, to keep one topic, and because docs(build): note the Group Policy script block on libusb's version step #8568 and docs(build): point the antivirus note at the relinker tests' test-temp #8619 are open on BUILD.md.
  3. BUILD.md L90 ("When preparing a title's libs/ directory, copy these DLLs with the patched .prx files") has the same omission as USAGE.md. It could point at the USAGE paragraph. It's a different file, so it was left out of this commit.
  4. The relinker's own "Arrange the files like this" message lists only libs/*.prx and app0/..., not the MinGW runtime DLLs that a self-built Windows libs/ needs. That's code, not docs.
  5. BUILD.md's CMake flag table leaves out ANYPS5_RELINKER_CLI (core/relinker/CMakeLists.txt:1, default ON; forced OFF for WASM). Not Windows-specific.
  6. Verified correct, no change needed:
    • WinLibs release and archive name (same as build.yml/release.yml);
    • CMake 3.22.1 (required by the SPIRV-Tools, Vulkan-Headers and glslang submodules);
    • Python 3 for glslang (StandAlone/CMakeLists.txt:34);
    • libusb gen-describe.ps1 with Bash/cygpath;
    • the libs / patched_libraries_tests dependency;
    • the build/core/libs/libs and unpatched paths;
    • the test names in the antivirus and Bitdefender bullets;
    • the agc_*_replay targets and paths;
    • the Tracy file names;
    • the release archive contents.

Not done or uncertain

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/user/USAGE.md
PR 5925 docs/user/USAGE.md
PR 6171 docs/user/USAGE.md
PR 6586 docs/user/USAGE.md
PR 6788 docs/user/USAGE.md
PR 6924 docs/user/USAGE.md
PR 7642 docs/user/USAGE.md
PR 7800 docs/user/USAGE.md
PR 7918 docs/user/USAGE.md
PR 8016 docs/user/USAGE.md
PR 9408 docs/user/USAGE.md
PR 9508 docs/user/USAGE.md

@harisibrar1 harisibrar1 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked against main:

  • core/libs/CMakeLists.txt:207-227 writes mimalloc.dll and mimalloc-redirect.dll to build/core/libs/libs as libs outputs, and tools/package_release.py:58 puts both in the Windows archive, so "copy both from build/core/libs/libs; the release archives contain them" matches.
  • WindowsEntryStubBuilder.cpp:103,125-133 loads <run path>mimalloc.dll only when APS5_MIMALLOC is set, and docs/dev/ARCHITECTURE.md:65-66 says the load fails quietly without the DLL, so "keeps the C runtime's heap and prints nothing" is accurate.
  • docs/user/USAGE.md:169,177 on main lists only the .prx files and the three MinGW DLLs, so the two DLLs were missing from the runtime layout.
  • tools/check_conventions.py --base main --head pr-8909 passes.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

@github-actions github-actions Bot added the docs label Oct 21, 2026

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants