From 26c733dc7d3dd5eeb58d2777f983bd526228f61e Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Thu, 20 Apr 2023 13:44:30 +0800 Subject: [PATCH] static link lpthread correctly on windows --- config/nim.cfg | 3 +++ lib/std/typedthreads.nim | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/nim.cfg b/config/nim.cfg index a1559e24ac..13665936b6 100644 --- a/config/nim.cfg +++ b/config/nim.cfg @@ -179,6 +179,9 @@ nimblepath="$home/.nimble/pkgs/" # Configuration for the GNU C/C++ compiler: @if windows: #gcc.path = r"$nim\dist\mingw\bin" + @if gcc: + gcc.options.linker %= "-Wl,-Bstatic -lpthread" + @end @if tcc: tlsEmulation:on @end diff --git a/lib/std/typedthreads.nim b/lib/std/typedthreads.nim index 6cc5dd9e0a..2c1cf6f1d6 100644 --- a/lib/std/typedthreads.nim +++ b/lib/std/typedthreads.nim @@ -35,8 +35,6 @@ ## deinitLock(L) -when defined(windows) and defined(gcc) and (not compileOption("tlsEmulation")): - {.passl: "-Wl,-Bstatic -lpthread -Wl,-Bdynamic".} import std/private/[threadtypes] export Thread