fix(dev): the Tracy build links on Windows with llvm-mingw (secur32 for GetUserNameExA) #1765
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1765
Loading…
Reference in a new issue
No description provided.
Delete branch "Jiro113/Longshot:fix/tracy-windows"
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?
Type: fix · Risk: low · Tested on: Windows 11, RTX 4090 · Needs: none
TL;DR
The profiling build of the game (
LONGSHOT_TRACY=1, for developers only) did not link on Windows: one systemlibrary the profiler's client needs was never named on the link line. This PR names it. The Tracy build now builds on
Windows with llvm-mingw, ran in Castle Town's market three times, and the Tracy viewer's capture tool saved a minute
of zones from both the host and the renderer each time. A game-free test fails on main and passes here.
Breakdown
#pragma comment(lib, ...)lines that onlyMSVC reads, so under llvm-mingw
secur32(forGetUserNameExA) was missing and the executable did not link.LONGSHOT_TRACY=1build on Windows also linkssecur32, and the Tracy page of the docs says howthe Windows build was built, captured and exported.
LONGSHOT_TRACY(the players' builds, the Builder's, Linux's),third_party/, the game's behaviour.secur32missing) and passes here; three Tracy builds ofthis fix on Windows ran 180 s in the south market each, with a 60-s capture of 159 to 164 MB saved each time.
tried here), named in the docs.
Why
docs/development/tracy.mdsaid the Windows configuration of the Tracy build was "written and not yet built byanyone". Built here with llvm-mingw, its link stopped on
undefined symbol: GetUserNameExA, called by Tracy'sTracySystem.cppfor the user name the viewer shows. Tracy asks forsecur32(andws2_32,advapi32,user32) by#pragma comment(lib, ...)under_MSC_VER, which llvm-mingw's clang does not define;dbghelp's pragma is outsideit, and the others the game links anyway. See #1543 (merged: the Tracy build), #1546 and #1741 (merged: Tracy build
fixes, Linux), #1746 (merged:
mise run tracy-tools).How to reproduce
Seen on: Windows 11, llvm-mingw 20261104 (ucrt), any GPU
Settings and switches:
LONGSHOT_TRACY=1at the buildSteps: build a pack with
LONGSHOT_TRACY=1(dev_packs.py packover a base, ormake_game.py)Expected: the executable links
Actual: on main the link fails with
undefined symbol: GetUserNameExAWhat changed
The Windows link of the executable names
secur32besidews2_32whenLONGSHOT_TRACYis set, and a test checks thatevery library Tracy's pragmas ask for is on that link.
nx2/build.py, the executable's link:-lsecur32with-lws2_32underTRACY, with a comment saying why.tests/test_tracy_win_libs.pyreads every#pragma comment(lib, ...)inthird_party/tracy/publicand checkseach library is in
HOST_LIBSor in theLONGSHOT_TRACYlibraries ofnx2/build.py(text only, no compiler). Onmain it fails: "secur32 (asked for by third_party/tracy/public/common/TracySystem.cpp) is not on the Windows link of
the executable".
docs/development/tracy.md: the Windows build links and captures, whysecur32is named,tracy-csvexport(counts, and
-ufor every zone with its thread and text), and what was not tried on Windows (sampling and contextswitches need an administrator per Tracy's manual; no zones in the game's code, whose list is for ELF objects).
Measurements
Nothing to measure: the change adds one library to the link of the developers' Tracy build on Windows only, and a build without
LONGSHOT_TRACY(every player's) has the same link line as on main.Flags and settings
None.
Testing
Tested: Windows 11 Home 10.0.26300, RTX 4090 (NVIDIA 621.24), i9-13900K, llvm-mingw 20261104: three
LONGSHOT_TRACY=1packs over a base (v3.0.0,544229a2) built and linked with this fix (one from the fix before it wascommitted, two from its commit over main
8b0ea786with local zones added for a study, not in this PR); each ran 180 sin Castle Town's south market (cap 60, DLSS on) through the PC's job queue, and
tracy-capture0.15.0 saved a 60-scapture (159, 163 and 164 MB) with the host's waits and the renderer's zones;
tracy-csvexport -uread them. Run as auser with
TRACY_NO_SAMPLING=1. The game-free test fails on main and passes here.tests/run_all.py(the venv's Python 3.13,llvm-mingw on
PATH,RX_CPMset) on the rebased tree: 755 passed, 49 failed, 53 skipped. None of the failures isthis PR's: before the rebase, main
8b0ea786and this branch over it failed the same files (749 passed, 49 failed, 53skipped each;
test_longshot_ctlfailed once in the branch's run and passes alone;byte_compile_trackedfailed inmain's run only because that tree was an export without git), and the one file failing since the rebase,
test_high_fps_fixes(HOS_HEAP_BASEundeclared in its stand-ins), compiles host code this PR doesn't touch. The 48files: test_auto_handheld, test_bug_report, test_bug_report_defaults, test_capture_read_once,
test_capture_readback_visibility, test_crash_dialog, test_crt_options, test_damage_debug_menu, test_dev_packs,
test_display_startup_failure, test_dlss_feature_size, test_draw_stream_visibility, test_failed_compile_keeps_objects,
test_fsr_image_retirement, test_fsr_uniform_ownership, test_game_menu_mouse_buttons, test_guest_imported,
test_high_fps_fixes, test_host_guest_writes, test_hud_layout_row, test_job_queue, test_libc_hooks, test_linux_preflight,
test_linux_pressure, test_missing_nup, test_pads_after_menu, test_parallel_init_order, test_pending_guest_import,
test_pipeline_play_cache, test_prepare_cache_save, test_present_source_crop, test_present_thread, test_profiling_mode,
test_psychov35_fsr3_fg, test_readback_timeout_source, test_recorder_sync, test_replay_write_order, test_sdiv_overflow,
test_slow_frames, test_song_note_cue, test_staging_burst, test_tested_configurations, test_texel_buffer_ownership,
test_upscaler_rows, test_vcore_escape, test_vk_occlusion_queries, test_walk_key, test_work_lock (
test_work_lockfailsunder the venv's launcher and passes under the uv Python itself).
Rebased onto main
819a5967after those runs: the commits it brings changenx2/build.pyonly to copy RenHDrum besidethe game, not the executable's link, and the test passes on the rebased tree.
Not tested: Tracy's sampling and context switches on Windows (they need an administrator per Tracy's manual; this
PC has none). Linux is not touched (the line is in the Windows link).
Must be tested:
Risks
What could break: a Windows Tracy build without
libsecur32.ain its toolchain (llvm-mingw and MSYS2's MinGW bothship it).
Turning it off: revert the commit.
Compatibility: Nothing changes.
Checklist
Everyone
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why.
in Risks.
main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.🤖 Generated with Claude Code
Tested in game: Windows 11, RTX 4090, NVIDIA 621.24, llvm-mingw 20261104: three LONGSHOT_TRACY=1 packs with this fix built and linked; each ran 180 s in Castle Town's south market (cap 60, DLSS on) and tracy-capture 0.15.0 saved a 60-s capture with the host's and the renderer's zones; no error or hang. Ran before the rebase onto
819a5967, which does not change the executable's link.WIP: fix(dev): the Tracy build links on Windows with llvm-mingw (secur32 for GetUserNameExA)to fix(dev): the Tracy build links on Windows with llvm-mingw (secur32 for GetUserNameExA)