Introduction to JS

JS is Mozilla's JavaScript engine written in C. JS68 is taken from Firefox.

This package is known to build and work properly using an LFS-10.0 platform.

Package Information

JS68 Dependencies


Autoconf-2.13, ICU-67.1, Python-2.7.18, and Which-2.21


LLVM-10.0.1 (with Clang), NASM-2.15.03, and Doxygen-1.8.19 (for documentation)

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/js68

Installation of JS



If you are upgrading JS68 from a previously installed old version, save all work and exit your GNOME Session if you have one running. Replacing the JS68 binary will cause the GNOME Shell to crash and return you to your display manager or TTY. After installing the new version, if GNOME Shell still doesn't work, reinstall Gjs-1.64.4.



Unlike most other packages in BLFS, the instructions below require you to untar firefox-68.11.0esr.tar.xz and change into the firefox-68.11.0 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 JS by running the following commands:



If you are compiling this package in chroot you must do two things. First, as the root user, ensure that /dev/shm is mounted. If you do not do this, the Python configury will fail with a traceback report referencing /usr/lib/pythonN.N/multiprocessing/synchronize.py. Run:

mountpoint -q /dev/shm || mount -t tmpfs devshm /dev/shm

Second, either as the root user export the $SHELL environment variable using export SHELL=/bin/sh or else prepend SHELL=/bin/sh when running the configure command.

sed '21,+4d' -i js/moz.configure &&

mkdir obj &&
cd    obj &&

CC=gcc CXX=g++ LLVM_OBJDUMP=/bin/false       \
../js/src/configure --prefix=/usr            \
                    --with-intl-api          \
                    --with-system-zlib       \
                    --with-system-icu        \
                    --disable-jemalloc       \
                    --disable-debug-symbols  \
                    --enable-readline        \
                    --enable-unaligned-private-values &&

This package does not come with a working test suite.

Now, as the root user:

make install &&
rm -v /usr/lib/libjs_static.ajs

Command Explanations

sed '21,+4d' js/moz.configure: Firefox building system searches for rustc and cargo. Since we are building the standalone JS engine instead of the entire browser, they are not actually used. Remove the reference to them so we can build JS68 without rustc-1.42.0 installed.

CC=gcc CXX=g++: Upstream now prefers clang, override it like other Mozilla packages in BLFS book.

LLVM_OBJDUMP=/bin/false: The firefox build system searches for llvm-objdump. Since we are building the standalone JS engine instead of the entire browser, they are not actually used. Override it so we can build JS68 without LLVM-10.0.1 installed.

--with-*: 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 JS shell.

--disable-jemalloc: This switch disables the internal memory allocator used in JS68. jemalloc causes a conflict with glibc.

--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 JS68.

--enable-unaligned-private-values: This switch allows the code using JS68 not to align all pointers in the same way JS68 does. Gjs-1.64.4 requires JS68 to be built with this switch.

rm -v /usr/lib/libjs_static.ajs: Remove a large static library which is not used by any BLFS package.


Installed Programs: js68 and js68-config
Installed Libraries: libmozjs-68.so
Installed Directories: /usr/include/mozjs-68

Short Descriptions


provides a command line interface to the JavaScript engine.


is used to find the JS compiler and linker flags.


contains the Mozilla JavaScript API functions.

Last updated on 2020-08-16 21:26:53 -0700