From d19c4eb75346bc6c658f191e3fdd3d796d21af09 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 16 Aug 2026 13:17:24 +0800 Subject: fix linkname --- xmake/core/project/target.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 81b95cc96..e51ffeb8b 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -3296,6 +3296,14 @@ function target.linkname(filename, opt) linkname, count = filename:gsub(target.filename("__pattern__", "static", {plat = "windows"}):gsub("%.", "%%."):gsub("__pattern__", "(.+)") .. "$", "%1") end if count > 0 and linkname then + -- the library name itself may end with `.lib`, e.g. vcpkg installs `Luau.CLI.lib.lib`, + -- we cannot strip it, nf_link() passes the names ending with `.lib` to the linker + -- as-is, and it would look for `Luau.CLI.lib` + -- + -- @see https://github.com/xmake-io/xmake/issues/7708 + if opt.plat == "windows" and linkname:endswith(".lib") then + return filename + end return linkname end -- fallback to the generic unix library name, libxxx.a, libxxx.so, .. -- cgit v1.3.1