%general-entities; ]> SpiderMonkey from Firefox-&spidermonkey-version; SpiderMonkey Introduction to SpiderMonkey SpiderMonkey is Mozilla's JavaScript and WebAssembly Engine, written in C++ and Rust. In BLFS, the source code of SpiderMonkey is taken from Firefox. &lfs120_checked; Package Information Download (HTTP): Download (FTP): Download MD5 sum: &spidermonkey-md5sum; Download size: &spidermonkey-size; Estimated disk space required: &spidermonkey-buildsize; Estimated build time: &spidermonkey-time; SpiderMonkey Dependencies Required , , and Recommended (with Clang, required for 32-bit systems without SSE2 capabilities) If you are building this package on a 32-bit system, and Clang is not installed or you're overriding the default compiler choice with the environment variable CXX, please read the Command Explanations section first. Installation of SpiderMonkey Unlike most other packages in BLFS, the instructions below require you to untar firefox-&spidermonkey-version;esr.tar.xz and change into the firefox-&spidermonkey-version; folder. Extracting the tarball will reset the permissions of the current directory to 0755 if you have permission to do that. If you do this in a directory where the sticky bit is set, such as /tmp it will end with error messages: tar: .: Cannot utime: Operation not permitted tar: .: Cannot change mode to rwxr-xr-t: Operation not permitted tar: Exiting with failure status due to previous errors This does finish with non-zero status, but it does NOT mean there is a real problem. Do not untar as the root user in a directory where the sticky bit is set - that will unset it. Install SpiderMonkey by running the following commands: Compiling the C++ code respects $MAKEFLAGS and defaults to 'j1', the rust code will use all processors. mkdir obj && cd obj && ../js/src/configure --prefix=/usr \ --with-intl-api \ --with-system-zlib \ --with-system-icu \ --disable-jemalloc \ --disable-debug-symbols \ --enable-readline && make To run the SpiderMonkey test suite, issue: make -C js/src check-jstests JSTESTS_EXTRA_ARGS="--timeout 300 --wpt=disabled". It's recommended to redirect the output into a log. Because we are building with system ICU, 8 tests (out of a total of more than 50,000) are known to fail. The JIT test suite can use a large amount of system memory. Running the JIT test suite without enough memory may invoke the kernel OOM killer and causes stability issues. To run the JIT test suite, ensure the amount of available system memory is at least 16 GB, then issue: make -C js/src check-jit-test JITTEST_EXTRA_ARGS="--timeout 300". An issue in the installation process causes any running program which links to SpiderMonkey shared library (for example, GNOME Shell) to crash if SpiderMonkey is reinstalled, or upgraded or downgraded without a change of the major version number (&spidermonkey-major; in &spidermonkey-version;). To work around this issue, remove the old version of the SpiderMonkey shared library before installation: rm -fv /usr/lib/libmozjs-&spidermonkey-major;.so Now, as the root user: make install && rm -v /usr/lib/libjs_static.ajs && sed -i '/@NSPR_CFLAGS@/d' /usr/bin/js&spidermonkey-major;-config Command Explanations --with-intl-api: This enables the internationalization functions required by Gjs. --with-system-*: These parameters allow the build system to use system versions of the above libraries. These are required for stability. --enable-readline: This switch enables Readline support in the SpiderMonkey command line interface. --disable-jemalloc: This switch disables the internal memory allocator used in SpiderMonkey. jemalloc is only intended for the Firefox browser environment. For other applications using SpiderMonkey, the application may crash as items allocated in the jemalloc allocator are freed on the system (glibc) allocator. --disable-debug-symbols: Don't generate debug symbols since they are very large and most users won't need it. Remove it if you want to debug SpiderMonkey. rm -v /usr/lib/libjs_static.ajs: Remove a large static library which is not used by any BLFS package. sed -i '/@NSPR_CFLAGS@/d' /usr/bin/js&spidermonkey-major;-config: Prevent js&spidermonkey-major;-config from using buggy CFLAGS. : BLFS used to prefer to use gcc and g++ instead of upstream's defaults of the clang programs. With the release of gcc-12 the build takes longer with gcc and g++, primarily because of extra warnings, and is bigger. Pass these environment variables to the configure script if you wish to continue to use gcc, g++ (by exporting them and unset them after the installation, or simply prepending them before the ../js/src/configure command). If you are building on a 32-bit system, also see below. : Use SSE2 instead of 387 for double-precision floating-point operations. It's needed by GCC to satisfy the expectations of upstream (Mozilla) developers with floating-point arithmetic. Use it if you are building this package on a 32-bit system with GCC (if Clang is not installed or GCC is explicitly specified). Note that this will cause SpiderMonkey to crash on a processor without SSE2 capability. If you are running the system on such an old processor, Clang is strictly needed. This setting is not needed on 64-bit systems because all 64-bit x86 processors support SSE2 and the 64-bit compilers (both Clang and GCC) use SSE2 by default. Contents Installed Programs Installed Libraries Installed Directories js&spidermonkey-major; and js&spidermonkey-major;-config libmozjs-&spidermonkey-major;.so /usr/include/mozjs-&spidermonkey-major; Short Descriptions js&spidermonkey-major; provides a command line interface to the JavaScript engine js&spidermonkey-major; js&spidermonkey-major;-config is used to find the SpiderMonkey compiler and linker flags i js&spidermonkey-major;-config libmozjs-&spidermonkey-major;.so contains the Mozilla JavaScript API functions libmozjs-&spidermonkey-major;.so