我正在尝试为Windows构建SpiderMonkey (32位)。在回答这里之后,我执行了这里指令
我用于构建的命令行是:
PATH=$PATH:"/c/Program Files/LLVM/bin/" JS_STANDALONE=1 ../configure.in --enable-nspr-build --disable-jemalloc --disable-js-shell --disable-tests --target=i686-pc-mingw32 --host=i686-pc-mingw32 --with-libclang-path="C:/Program Files/LLVM/bin"但是,在SpiderMonkey找不到Rust编码函数的情况下,我得到了各种链接器错误,例如:
lld-link: error: undefined symbol: _encoding_mem_convert_latin1_to_utf8_partial
referenced by c:\firefox_90_0\js\src\vm\CharacterEncoding.cpp:109
..\Unified_cpp_js_src17.obj:(unsigned int __cdecl JS::DeflateStringToUTF8Buffer(class
JSLinearString *, class mozilla::Span<char, 4294967295>))在查看SpiderMonkey配置文件(Cargo.toml文件)之后,在我看来,在编译过程中,SpiderMonkey应该根据锈蚀绑定构建jsrust.lib。但事实上,这种情况并没有发生,我得到了链接器错误。知道吗?
发布于 2022-01-24 18:33:17
是的,您是对的,因为在编译SpiderMonkey mach/mozbuildjsrust.lib并将其链接到生成的dll/js可执行文件时。
而且,在我的例子中,构建jsrust.lib也缺少了一个bcrypt导入。
通过将下面的修补程序应用到源代码中,可以很容易地修复这个问题,这使得mozbuild能够遍历js/锈菌目录,并修复了前面提到的缺少的导入。(在esr91和更高版本上测试):
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -7,6 +7,10 @@
include("js-config.mozbuild")
include("js-cxxflags.mozbuild")
+if CONFIG["JS_STANDALONE"]:
+ DIRS += ["rust"]
+ include("js-standalone.mozbuild")
+
# Directory metadata
component_engine = ("Core", "JavaScript Engine")
component_gc = ("Core", "JavaScript: GC")
@@ -51,10 +55,7 @@ if CONFIG["ENABLE_WASM_CRANELIFT"]:
CONFIGURE_SUBST_FILES += ["rust/extra-bindgen-flags"]
if not CONFIG["JS_DISABLE_SHELL"]:
- DIRS += [
- "rust",
- "shell",
- ]
+ DIRS += ["shell"]
TEST_DIRS += [
"gdb",
--- a/js/src/rust/moz.build
+++ b/js/src/rust/moz.build
@@ -37,4 +37,5 @@ elif CONFIG["OS_ARCH"] == "WINNT":
"shell32",
"userenv",
"ws2_32",
+ "bcrypt"
](该修补程序可作为gist与经过测试的mozbuild一起使用,该配置构建了一个32位.dll,此处为:https://gist.github.com/razielanarki/a890f21a037312a46450e244beeba983 )
https://stackoverflow.com/questions/68636098
复制相似问题