Skip to content

fix: Enable Windows cross-compilation for FF146#534

Open
LeooNic wants to merge 1 commit into
daijro:mainfrom
LeooNic:fix/windows-cross-compilation
Open

fix: Enable Windows cross-compilation for FF146#534
LeooNic wants to merge 1 commit into
daijro:mainfrom
LeooNic:fix/windows-cross-compilation

Conversation

@LeooNic

@LeooNic LeooNic commented Mar 20, 2026

Copy link
Copy Markdown

Summary

Fixes 4 issues that prevented cross-compiling Camoufox v146 for Windows (--target=x86_64-pc-mingw32 from Linux):

  • pid_t undefined: Added conditional typedef int pid_t for Windows targets in HeadlessWindowCapturer.h and nsScreencastService.cpp (ref FF146 Build Errors Thread #445)
  • camoufox.exe.manifest missing: Added git rename directives to windows-theming-bug-modified.patch so the manifest file is properly renamed from firefox.exe.manifest
  • Document.h include missing: Added #include "mozilla/dom/Document.h" in anti-font-fingerprinting.patch for gfxTextRun.cpp (was using doc->GetInnerWindow() with only a forward declaration)
  • Dockerfile git setup: Changed setup-minimal to setup and added git config (required for the patch reset/apply cycle)

Testing

  • Cross-compiled from Ubuntu (Docker) to Windows x86_64
  • Ran on Windows 11 natively
  • Verified with CreepJS: headless 0%, stealth 0%, lies 1 (canvas noise only), GPU confidence HIGH grade A
  • UserAgent correctly reports Firefox/146.0

Build instructions

docker build -t camoufox-builder .
docker run -dt --name cfox --memory=22g --entrypoint bash camoufox-builder
docker exec cfox bash -c "cd /app && export BUILD_TARGET=windows,x86_64 && make set-target && make build && make package-windows arch=x86_64"

Note: Requires ~22GB RAM for Rust compilation. Set WSL2 memory via ~/.wslconfig on Windows.

Test plan

  • Cross-compilation completes without errors
  • Binary launches on Windows 11
  • CreepJS audit passes (headless: 0, stealth: 0)
  • Canvas, Audio, WebGL spoofing functional
  • Full Playwright test suite (not yet run)

🤖 Generated with Claude Code

Four issues prevented building Camoufox v146 for Windows
(cross-compiling from Linux with --target=x86_64-pc-mingw32):

1. pid_t undefined: The POSIX pid_t type is not available in
   MinGW/MSVC cross-compilation headers. Added conditional typedef
   in HeadlessWindowCapturer.h and nsScreencastService.cpp.
   (ref: issue daijro#445)

2. camoufox.exe.manifest missing: The windows-theming-bug patch
   renamed the reference in Makefile.in from firefox.exe.manifest
   to camoufox.exe.manifest but did not rename the actual file.
   Added git rename directives to the patch.

3. Document.h include missing: The anti-font-fingerprinting patch
   uses doc->GetInnerWindow() in gfxTextRun.cpp but only had a
   forward declaration of Document. Added the full include.

4. Dockerfile git setup: Changed setup-minimal to setup (requires
   git repo for patch reset/apply cycle) and added git config for
   commits inside the container.

Tested: Successfully cross-compiled and ran on Windows 11,
verified with CreepJS (headless: 0%, stealth: 0%, lies: 1).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant