I'm trying to build SpiderMonkey (32 bit) for Windows. Following the answer here, I performed the instructions here
The command line I used for building is:
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"
However, I'm getting various linker errors where SpiderMonkey doesn't find Rust encoding functions, such as:
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>))
After looking at SpiderMonkey config files (Cargo.toml files), it seems to me that during compilation SpiderMonkey should build jsrust.lib out of Rust bindings. but in fact this doesn't happen and I get the linker errors. any idea?
Yes, you are right, in that during compiling SpiderMonkey mach/mozbuild build
jsrust.liband link it into the resulting dll/js-shell executable.Also, in my case, building
jsrust.libwas also missing abcryptimport.this can be easily fixed by applying the following patch to the sources, which enables mozbuild to traverse into the js/rust directory, and fixes the aforementioned missing import too. (tested on esr91 and up):
(the patch is available as a gist alongside a tested mozbuild config, which builds a 32bit .dll, here: https://gist.github.com/razielanarki/a890f21a037312a46450e244beeba983 )