From c73d2e81729f56d69c71aad9f3228ef40c2cfa68 Mon Sep 17 00:00:00 2001 From: Nie Zhihe Date: Mon, 5 Jan 2026 17:06:36 +0800 Subject: [PATCH 1/4] fix: change -static to -Bstatic (selectively static link pthread only) --- .gnfiles/build/toolchain/mingw/BUILD.gn | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.gnfiles/build/toolchain/mingw/BUILD.gn b/.gnfiles/build/toolchain/mingw/BUILD.gn index 50ef2da..647aa98 100644 --- a/.gnfiles/build/toolchain/mingw/BUILD.gn +++ b/.gnfiles/build/toolchain/mingw/BUILD.gn @@ -48,7 +48,12 @@ config("debug") { ldflags = [ "-static-libgcc", # Static link libgcc (avoids libgcc_s_seh-1.dll) "-static-libstdc++", # Static link libstdc++ (avoids libstdc++-6.dll) - "-static", # Static link MinGW runtime including pthread (avoids libwinpthread-1.dll) + # Note: Do NOT use -static here, as it prevents linking with .dll.a import libraries + # (ten_runtime and ten_utils) + # Instead, use -Wl,-Bstatic/-Bdynamic to selectively static link pthread + "-Wl,-Bstatic", + "-lpthread", # Static link pthread (avoids libwinpthread-1.dll) + "-Wl,-Bdynamic", # Switch back to dynamic linking for other libraries ] libs = default_libs } @@ -64,7 +69,11 @@ config("release") { "-Wl,-O2", "-static-libgcc", "-static-libstdc++", - "-static", + # Note: Do NOT use -static here, as it prevents linking with .dll.a import libraries + # Instead, use -Wl,-Bstatic/-Bdynamic to selectively static link pthread + "-Wl,-Bstatic", + "-lpthread", # Static link pthread (avoids libwinpthread-1.dll) + "-Wl,-Bdynamic", # Switch back to dynamic linking for other libraries ] libs = default_libs } From 563419a01823b6177cd8e2a984aafda885288b0f Mon Sep 17 00:00:00 2001 From: Nie Zhihe Date: Mon, 5 Jan 2026 17:07:11 +0800 Subject: [PATCH 2/4] fix: lib prefix for .dll.a (import lib) --- .gnfiles/build/toolchain/mingw/mingw.gni | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gnfiles/build/toolchain/mingw/mingw.gni b/.gnfiles/build/toolchain/mingw/mingw.gni index ea3233b..298566d 100644 --- a/.gnfiles/build/toolchain/mingw/mingw.gni +++ b/.gnfiles/build/toolchain/mingw/mingw.gni @@ -120,10 +120,14 @@ template("mingw_toolchain") { tool("solink") { soname = "{{target_output_name}}{{output_extension}}" sofile = "{{output_dir}}/$soname" + # Import library extension matches output extension for consistency # e.g., .dll -> .dll.a, .pyd -> .pyd.a - implibname = "{{target_output_name}}{{output_extension}}.a" + # MinGW import libraries require 'lib' prefix for GNU linker compatibility: + # GNU ld expects libfoo.dll.a when using -lfoo flag. + implibname = "lib{{target_output_name}}{{output_extension}}.a" implibfile = "{{output_dir}}/$implibname" + rspfile = sofile + ".rsp" pool = "//.gnfiles/build/toolchain:link_pool" From 4a7f35878a7d239baa5fe255d74c2d29e4895bbf Mon Sep 17 00:00:00 2001 From: Nie Zhihe Date: Wed, 7 Jan 2026 11:49:24 +0800 Subject: [PATCH 3/4] fix: static lib stdc++ --- .gnfiles/build/platform/win/BUILD.gn | 3 --- .gnfiles/build/toolchain/mingw/BUILD.gn | 13 +++++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.gnfiles/build/platform/win/BUILD.gn b/.gnfiles/build/platform/win/BUILD.gn index a2cf356..687b9c5 100644 --- a/.gnfiles/build/platform/win/BUILD.gn +++ b/.gnfiles/build/platform/win/BUILD.gn @@ -126,9 +126,6 @@ config("specific_cpp_mingw") { } else { cflags_cc += [ "-fno-exceptions" ] } - - # Link against C++ standard library - libs = [ "stdc++" ] } diff --git a/.gnfiles/build/toolchain/mingw/BUILD.gn b/.gnfiles/build/toolchain/mingw/BUILD.gn index 647aa98..2978bf4 100644 --- a/.gnfiles/build/toolchain/mingw/BUILD.gn +++ b/.gnfiles/build/toolchain/mingw/BUILD.gn @@ -46,12 +46,12 @@ config("debug") { cflags = [ "-g" ] cflags_cc = [] ldflags = [ - "-static-libgcc", # Static link libgcc (avoids libgcc_s_seh-1.dll) - "-static-libstdc++", # Static link libstdc++ (avoids libstdc++-6.dll) # Note: Do NOT use -static here, as it prevents linking with .dll.a import libraries # (ten_runtime and ten_utils) - # Instead, use -Wl,-Bstatic/-Bdynamic to selectively static link pthread + # Instead, use -Wl,-Bstatic/-Bdynamic to selectively static link libraries "-Wl,-Bstatic", + "-lgcc", # Static link libgcc (avoids libgcc_s_seh-1.dll) + "-lstdc++", # Static link libstdc++ (avoids libstdc++-6.dll) "-lpthread", # Static link pthread (avoids libwinpthread-1.dll) "-Wl,-Bdynamic", # Switch back to dynamic linking for other libraries ] @@ -67,11 +67,12 @@ config("release") { cflags_cc = [] ldflags = [ "-Wl,-O2", - "-static-libgcc", - "-static-libstdc++", # Note: Do NOT use -static here, as it prevents linking with .dll.a import libraries - # Instead, use -Wl,-Bstatic/-Bdynamic to selectively static link pthread + # (ten_runtime and ten_utils) + # Instead, use -Wl,-Bstatic/-Bdynamic to selectively static link libraries "-Wl,-Bstatic", + "-lgcc", # Static link libgcc (avoids libgcc_s_seh-1.dll) + "-lstdc++", # Static link libstdc++ (avoids libstdc++-6.dll) "-lpthread", # Static link pthread (avoids libwinpthread-1.dll) "-Wl,-Bdynamic", # Switch back to dynamic linking for other libraries ] From 5fe2505bcedbfac8f45834a2fc3049e2571d16ba Mon Sep 17 00:00:00 2001 From: Nie Zhihe Date: Wed, 7 Jan 2026 11:52:14 +0800 Subject: [PATCH 4/4] fix: ubuntu-slim will cause commitlint error because it has no docker command --- .github/workflows/commitlint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index b7f8986..b0e8947 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -8,7 +8,7 @@ permissions: jobs: commitlint: - runs-on: ubuntu-slim + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: wagoid/commitlint-github-action@v6