为 foobar2000 (x64) 构建 Spider Monkey Panel。官方 SMP 一直以来只有 32 位(组件 vcxproj 仅 Win32、预编译 mozjs-102.lib 也是 32 位),本仓库给出 x64 全链路自建方案:
把 SpiderMonkey 102.12.0esr 引擎编译成 x64,并把 SMP 组件整个编译链接成 x64,打包成可安装的 foo_spider_monkey_panel.fb2k-component。
上游:https://github.com/TheQwertiest/foo_spider_monkey_panel(MIT,2018–2021 Yuri Shutenko)。本仓库是其 x64 适配分支。
scripts/ x64 构建脚本(configure_x64.sh / build_x64.sh / pack_x64.py / fix_sln_x64.py / add_x64.py)
prebuilt/ foo_spider_monkey_panel.fb2k-component —— 已编译好的 x64 组件(可直接装 foobar2000 x64)
patches/ x64 源码改动(组件源码 diff + SpiderMonkey Wrapper.h 导出修复)
panel/ SMP 面板示例脚本 + 《如何写 SMP 面板》教程
LICENSE 上游 MIT 许可证
third_party_licenses.txt 依赖库许可证清单
prebuilt/foo_spider_monkey_panel.fb2k-component 是 64 位组件包(含 foo_spider_monkey_panel.dll + mozjs-102.dll,均 x64):
把里面两个 dll 放进 foobar2000(x64) 的 components\(旧 32 位组件请先移出),重启 foobar,新建一个 Spider Monkey Panel 面板即可。
前置工具链:
- VS 2026/18(MSVC 14.51,平台工具集实际为
v145;v143本机没有 → 用msbuild ... /p:PlatformToolset=v145) - LLVM/clang ≥ 20(新版 VS 的 MSVC STL 14.51 有 STL1000 检查,强制要求 clang ≥ 20)
- Rust 1.62.0(引擎内置 crate
jsrust用老式&error::Errortrait,较新 rust 编不过) - MozillaBuild 3.4(提供 MSYS shell +
mozmake,到C:\mozilla-build) - 因用户目录含单引号(
Jason's Miku)会破坏 nmake/MSYS 的 8.3 短名,rust 装到无引号路径C:\smp-build\tools\{cargo,rustup}并把CARGO_HOME/RUSTUP_HOME指向它。
步骤:
- 下载并解压
firefox-102.12.0esr.source.tar.xz(官方 archive.mozilla.org)到mozjs-src/firefox-102.12.0。 - 用
scripts/configure_x64.sh配置(--target/host=x86_64-pc-mingw32、--disable-lto、注入MSVC_BIN解决 vswhere 认不出 VS2026 prerelease 导致的 ATL 检测失败、rust 1.62 default)。注意:别去掉
--disable-js-shell——那样js/src/moz.build不编jsrust,链接会缺encoding_mem_*。 scripts/build_x64.sh(mozmake -j8)产出 x64mozjs-102.dll/.lib/js_static.lib。- 把
firefox-102.12.0 的 dist/include与编译产物放进 SMP 的mozjs/Release/{include,bin,lib}(目前放 32 位预编译,替换为 x64)。 scripts/fix_sln_x64.py修workspaces/foo_spider_monkey_panel.sln里 6 个项目的Release|x64平台映射。msbuild workspaces/foo_spider_monkey_panel.sln /m /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v145编译组件。scripts/pack_x64.py打包出foo_spider_monkey_panel.fb2k-component。
完整坑记录见
patches/x64-component-src.patch(组件源码 x64 类型修复) 与patches/mozjs-Wrapper-ctor-export.md(SpiderMonkey 导出修复)。
- clang 必须 ≥20:新 VS STL 的
yvals_core.h有STL1000静态断言直接拒绝旧 clang。 - rust 必须 1.62:
jsrust老 crate 的 trait-object 语法,1.97 编不过。 --disable-js-shell会连带不编jsrust→mozjs-102.dll链接缺encoding_mem_*/install_rust_*。winheap.cpp在--disable-jemalloc下定义HeapAlloc等 → 与 kernel32 重复:给 dll 链接加LDFLAGS=/FORCE:MULTIPLE。mozjs-1751561-duplicate_dll_main.patch的git apply没真正写进jsapi.cpp:需手动把 DllMain 条件改成defined(XP_WIN) && (defined(MOZ_MEMORY) || !defined(JS_STANDALONE))。ForwardingProxyHandlerctor 未导出 → SMP 在 x64 下LNK2001:见patches/mozjs-Wrapper-ctor-export.md(把 Wrapper.h 的using BaseProxyHandler::...改成显式constexprctor)。- 组件链接缺
Scintilla_RegisterClasses/ReleaseResources:SMP 静态链libscintilla.lib,需用lib.exe(MSVC,支持 /GL 对象)把 Scintilla/Lexilla 的 x64 obj 归档成静态库并覆盖 projectref 目标。 - CRT 不匹配:组件用
/MT,把 Scintilla/Lexilla 的Release|x64也设<RuntimeLibrary>MultiThreaded</RuntimeLibrary>再归档。
SMP 的 JS 没有内建 WebSocket。演示面板见 panel/;要驱动 Python 后端,给后端加一个本机 HTTP 桥(GET /api/state、POST /api/play…),面板轮询/点按钮即可,思路见 panel/README-如何写SMP面板.md。
- 上游
foo_spider_monkey_panel:MIT(见LICENSE) - 依赖库:
third_party_licenses.txt - SpiderMonkey:MPL-2.0(ozilla Public License 2.0),见 SpiderMonkey 源码许可。