Repository navigation
deps.ffmpeg: Fix libvpx Windows x64 build with NASM 3.02 - #5
Merged
Merged
Conversation
The Windows x64 FFmpeg job has failed in every run since MSYS2 replaced nasm 2.16.03 with nasm 3.02 (here since the first run on master, https://github.com/obs-rust/obs-deps/actions/runs/37731278276, latest nightly: https://github.com/obs-rust/obs-deps/actions/runs/39002391991): x64\Debug\vpxrc\vp8_common_x86_dequantize_mmx_asm.obj : fatal error LNK1136: invalid or corrupt file libvpx's Visual Studio project assembles its Debug configuration with "nasm -Xvc -gcv8 -f win64". libvpx 1.14.1 puts its constant tables in "section .rodata" on win64, which NASM treats as an executable code section there. NASM 3.02's CodeView writer then dereferences a NULL line table for that section while writing the debug info and crashes, leaving a 0-byte object that the MSVC linker rejects. Assembling the 15 affected libvpx 1.14.1 files with -gcv8 -f win64 segfaults with nasm 3.02 and works with nasm 2.16.03. libvpx fixed this in 1.17.0 (commit 8b3ce4cfa488, "x86_abi_support.asm: use .rdata for win32/win64"; libvpx bug 540261859): read-only data goes to .rdata on win32/win64, which also stops it being mapped executable. The NASM side is netwide-assembler/nasm#267, with an open fix in netwide-assembler/nasm#292. Apply that libvpx commit as a patch on Windows instead of pinning NASM back to 2.16.03. With the patch, every libvpx 1.14.1 x86 asm source the build assembles also assembles with nasm 3.02 -gcv8 -f win64. The patch can be dropped when libvpx is updated to 1.17.0 or later. Co-Authored-By: James Zern <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 18, 2026
This was referenced Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix the Windows x64 FFmpeg build (libvpx 1.14.1) with NASM 3.02 by applying libvpx's own upstream fix as a Windows patch:
deps.ffmpeg/patches/libvpx/0003-use-rdata-section-on-windows.patch, wired into30-libvpx.ps1through a newPatchstep (sameSafe-Patchpattern as the other Windows scripts). NASM is not pinned.The patch is libvpx commit 8b3ce4cfa488 "x86_abi_support.asm: use .rdata for win32/win64" by James Zern (credited as co-author), shipped in libvpx 1.17.0. It is 4 lines:
SECTION_RODATAbecomessection .rdataon win32/win64 instead ofsection .rodata. The patch can be dropped when libvpx is updated to 1.17.0 or later.Motivation and Context
What fails. "Build FFmpeg for Windows (x64)" has failed in every run here since the first one on master (37731278276, 2026-10-08), every nightly since (latest: 39002391991), and the PR runs of #1, #2 and #3:
The arm64 job shows as cancelled in those runs (fail-fast after x64). Its one standalone failure (38682381576) was a transient
git cloneof vorbis; arm64 libvpx uses armasm64, not NASM.Root cause.
nasm-3.02-1. obsproject/obs-deps has the same failure: its last green nightly (36673288925, 2026-09-30) installednasm-2.16.03-1; from 2026-10-02 on, every nightly installsnasm-3.02-1and fails with the same LNK1136 (the 2026-10-01 run failed earlier on an unrelated libpng download hash).nasm -Xvc -gcv8 -f win64(CodeView debug info), Release without-gcv8.section .rodata, which on win64 NASM creates as an executable code section. NASM 3.02's CodeView writer then hits a NULL line table for that section and crashes (saa_rewind(s=0x0)fromwrite_linenumber_table,output/codeview.c:570), leaving a 0-byte.obj, which is what LNK1136 reports. The regression is NASM commit dee2d13f2 ("Proper handling of several code sections in Codeview debug information"), bisected in netwide-assembler/nasm#267; the NASM fix (netwide-assembler/nasm#292) is still open. libvpx's tracker entry is webm bug 540261859.Why this fix and not a NASM pin. The libvpx change is the upstream fix for the actual problem (read-only data in an executable section on Windows; with
.rdatathe tables are also no longer mapped executable). It works with every NASM version, does not depend on MSYS2 keeping an old package around, and goes away by itself with the next libvpx update. Bumping libvpx to 1.17.0 instead would be three minor versions at once (new ABI) mixed into a CI fix; that stays a separate, one-library update.This unblocks #1 (libsrt 1.5.7), #2 (FFmpeg 8.1.3) and #3 (Mbed TLS 3.6.7), which all fail on this job.
How Has This Been Tested?
RED. The CI runs linked above (master and upstream, nasm 3.02).
Local, outside Windows (NASM 2.16.03 and 3.02 built from the nasm.us release tarballs; libvpx v1.14.1 configured for
x86_64-win64-vs17; the 45 x86.asmsources undervp8/,vp9/,vpx_dsp/assembled with the same flags as the vcxproj,-Xvc [-gcv8] -f win64):-gcv8-gcv8-gcv8dequantize_mmx.asm,add_noise_sse2.asm)(The 46th
.asmfile,vpx_dsp/x86/bitdepth_conversion_sse2.asm, is macros only and is not assembled on its own by the build.)Object checks with llvm-readobj (
dequantize_mmxandadd_noise_sse2, the two files in the CI error): nasm 2.16.03 unpatched puts the tables in.rodataflaggedCNT_CODE | MEM_EXECUTE; nasm 3.02 patched puts them in.rdataflaggedINITIALIZED_DATA | MEM_READ. The.textbytes are identical to the nasm 2.16.03 objects that link today, and the.rdatabytes equal the old.rodatabytes. All 45 patched objects from nasm 3.02-gcv8parse cleanly withllvm-readobj --codeview. Not checked here: linking with the MSVC linker (no Windows machine available), which is what this PR's CI does.The patch applies to the v1.14.1 sources with
patch -p1 --binary(asSafe-Patchruns it) and no fuzz, and the reverse dry-run fails on unpatched sources, soSafe-Patchapplies it once.GREEN. This PR's CI: the Windows x64 and arm64 FFmpeg jobs.
Types of changes
🤖 Generated with Claude Code