On MinGW-w64 the driver expands -pthread to -lpthread, which does not exist there (the runtime is libwinpthread/-pthread is not provided as libpthread.a in every toolchain). The CMake build links fine because Threads::Threads is empty/handled by CMake on Windows, but the native description propagates the raw flag.
Request
Guard the pthread options with if (!windows) (the runtime section already does this at line ~810), or use the platform-appropriate thread flags on Windows.
Reproduced with MinGW-w64 GCC 16.2 UCRT via the VBS self-hosted install of Void/Build-System at pin de1fdcda.
## Context
Cross-building VBS for the Windows target through the native VBS build path (`vbs install --target-os windows`) fails while linking `vbs.exe`:
```
x86_64-w64-mingw32-ld.bfd: cannot find -lpthread: No such file or directory
collect2: error: ld returned 1 exit status
```
## Cause
`build.cpp` adds `-pthread` (compile and link) to the `System`/`SystemAsync`/`CryptoAsync`/`SecurityAsync` module targets unconditionally:
```cpp
} else if (module == "CryptoAsync" || module == "SecurityAsync" ||
module == "System" || module == "SystemAsync") {
target.compile_option("-pthread", Visibility::Public);
target.link_option("-pthread", Visibility::Public);
}
```
On MinGW-w64 the driver expands `-pthread` to `-lpthread`, which does not exist there (the runtime is `libwinpthread`/`-pthread` is not provided as `libpthread.a` in every toolchain). The CMake build links fine because `Threads::Threads` is empty/handled by CMake on Windows, but the native description propagates the raw flag.
## Request
Guard the pthread options with `if (!windows)` (the runtime section already does this at line ~810), or use the platform-appropriate thread flags on Windows.
Reproduced with MinGW-w64 GCC 16.2 UCRT via the VBS self-hosted install of Void/Build-System at pin `de1fdcda`.
Fixed on main in 1b19473. -pthread is now only added when !windows, for the System/SystemAsync/CryptoAsync/SecurityAsync targets and for Net. The target OS comparison is case-insensitive too.
Fixed on main in 1b19473. `-pthread` is now only added when `!windows`, for the System/SystemAsync/CryptoAsync/SecurityAsync targets and for Net. The target OS comparison is case-insensitive too.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Context
Cross-building VBS for the Windows target through the native VBS build path (
vbs install --target-os windows) fails while linkingvbs.exe:Cause
build.cppadds-pthread(compile and link) to theSystem/SystemAsync/CryptoAsync/SecurityAsyncmodule targets unconditionally:On MinGW-w64 the driver expands
-pthreadto-lpthread, which does not exist there (the runtime islibwinpthread/-pthreadis not provided aslibpthread.ain every toolchain). The CMake build links fine becauseThreads::Threadsis empty/handled by CMake on Windows, but the native description propagates the raw flag.Request
Guard the pthread options with
if (!windows)(the runtime section already does this at line ~810), or use the platform-appropriate thread flags on Windows.Reproduced with MinGW-w64 GCC 16.2 UCRT via the VBS self-hosted install of Void/Build-System at pin
de1fdcda.Fixed on main in
1b19473.-pthreadis now only added when!windows, for the System/SystemAsync/CryptoAsync/SecurityAsync targets and for Net. The target OS comparison is case-insensitive too.