From 0c62cc1ee4dd2a0843f832f989b25b3e12771cb5 Mon Sep 17 00:00:00 2001 From: Arun Sharma Date: Wed, 29 Apr 2026 13:36:48 -0700 Subject: [PATCH 1/2] Fix precompiled Ladybug link dependencies When using a prebuilt liblbug archive, derive the native addon extra link libraries from Ladybug's generated link lines even when those lines do not contain the archive itself. This keeps third-party static libraries such as Thrift on the lbugjs.node link line and avoids unresolved symbols when the addon is loaded. --- build.js | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/build.js b/build.js index 71f30b6..89e5708 100644 --- a/build.js +++ b/build.js @@ -57,16 +57,41 @@ function getDefaultExtraLinkLibs(lbugBuildDir, precompiledLibPath) { const tokens = fs.readFileSync(linkTxtPath, "utf8").match(tokenPattern) || []; const libs = []; let sawPrecompiledLib = false; - - for (const rawToken of tokens) { + const linkLineHasPrecompiledLib = tokens.some((rawToken) => { + const token = rawToken.replace(/^"(.*)"$/, "$1"); + if (token.startsWith("-")) { + return false; + } + const resolvedToken = fs.existsSync(path.resolve(linkBaseDir, token)) + ? path.resolve(linkBaseDir, token) + : path.resolve(linkTxtDir, token); + return resolvedToken === precompiledLibPath; + }); + let outputPath = null; + + for (let i = 0; i < tokens.length; i++) { + const rawToken = tokens[i]; const token = rawToken.replace(/^"(.*)"$/, "$1"); + if (token === "-o") { + const outputToken = tokens[++i]?.replace(/^"(.*)"$/, "$1"); + outputPath = outputToken ? path.resolve(linkBaseDir, outputToken) : null; + continue; + } + if (token === "-install_name" || token === "-current_version" || token === "-compatibility_version") { + i++; + continue; + } + if (token.startsWith("@")) { + continue; + } + const resolvedToken = token.startsWith("-") ? token : fs.existsSync(path.resolve(linkBaseDir, token)) ? path.resolve(linkBaseDir, token) : path.resolve(linkTxtDir, token); - if (!sawPrecompiledLib) { + if (!sawPrecompiledLib && linkLineHasPrecompiledLib) { if (resolvedToken === precompiledLibPath) { sawPrecompiledLib = true; } @@ -80,7 +105,7 @@ function getDefaultExtraLinkLibs(lbugBuildDir, precompiledLibPath) { if (!/\.(a|lib|dylib|so|tbd)$/.test(token)) { continue; } - if (resolvedToken === precompiledLibPath) { + if (resolvedToken === precompiledLibPath || resolvedToken === outputPath) { continue; } libs.push(resolvedToken); From 622b4f62c4dd7803df9bf1044bd50b582950a1ce Mon Sep 17 00:00:00 2001 From: Arun Sharma Date: Wed, 29 Apr 2026 13:36:53 -0700 Subject: [PATCH 2/2] Fix JSON result conversion Convert Ladybug JSON values through Value::toString() instead of Value::getValue(). JSON uses string-like storage but the std::string getter asserts that the logical type is STRING, BLOB, or UUID, so debug/assert-enabled builds failed while release builds could appear to work by reading the underlying string value. --- src_cpp/node_util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_cpp/node_util.cpp b/src_cpp/node_util.cpp index 94ef204..fef89d6 100644 --- a/src_cpp/node_util.cpp +++ b/src_cpp/node_util.cpp @@ -199,7 +199,7 @@ Napi::Value Util::ConvertToNapiObject(const Value& value, Napi::Env env) { return Napi::String::New(env, valString).ToNumber(); } case LogicalTypeID::JSON: { - auto valString = value.getValue(); + auto valString = value.toString(); auto global = env.Global(); auto jsonObj = global.Get("JSON").As(); auto parseFunc = jsonObj.Get("parse").As();