Skip to content

Fix: Enable MSVC build on Windows#100

Open
Leif-US wants to merge 1 commit intoschoolpost:masterfrom
Leif-US:windows-msvc-fix
Open

Fix: Enable MSVC build on Windows#100
Leif-US wants to merge 1 commit intoschoolpost:masterfrom
Leif-US:windows-msvc-fix

Conversation

@Leif-US
Copy link
Copy Markdown

@Leif-US Leif-US commented Apr 19, 2026

This pull request fixes build failures on Windows when using the MSVC toolchain.
The build process previously failed due to two main issues:

  1. A linker error caused by the use of the GCC/Clang-specific function __builtin_clz in lj92.c, which is not
    available in MSVC.
  2. An unsupported compiler argument -std=gnu99 in setup.py, which is ignored by MSVC but indicates
    non-portable build logic.

These changes resolve the issues as follows:

  • In src/pidng/liblj92/lj92.c: Replaces the compiler-specific function calls with a compatible MSVC
    implementation using the _BitScanReverse intrinsic. This ensures the code compiles correctly without linker
    errors.
  • In setup.py: Removes the unsupported '-std=gnu99' compile argument to allow for a warning-free
    compilation on Windows.

With this patch, the package now installs successfully via pip on Windows.

Replaces compiler-specific function calls with a compatible MSVC implementation.

Removes unsupported '-std=gnu99' compile argument to allow clean compilation on Windows.
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