#### Beyond Linux® From Scratch (systemd Edition) - Version 10.1

### Chapter 9. General Libraries

- Prev

  Jansson-2.13.1

- Next

  JSON-C-0.15

- Up
- Home

# JS-78.8.0

## Introduction to JS

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

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

### Package Information

- Download (HTTP): https://archive.mozilla.org/pub/firefox/releases/78.8.0esr/source/firefox-78.8.0esr.source.tar.xz

- Download MD5 sum: 04858eb8431d560e62189878d1abb7bd

- Download size: 316 MB

- Estimated disk space required: 2.9 GB (36 MB installed after removing 35MB static lib)

- Estimated build time: 2.2 SBU (with parallelism = 4)

### JS78 Dependencies

#### Required

Autoconf-2.13, ICU-68.2, rustc-1.47.0, and Which-2.21

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

## Installation of JS

### Note

Unlike most other packages in BLFS, the instructions below require you to untar `firefox-78.8.0esr.tar.xz` and change into the `firefox-78.8.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:

### Note

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.

    mkdir obj &&
    cd    obj &&

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

To run JS 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. Depending on the machine, either ten or fourteen JS tests related to locale and timezone fail, because of an issue in ICU-68.2. To run the JIT test suite, issue: make -C js/src check-jit-test JITTEST_EXTRA_ARGS="--timeout 300". Again, a few tests may show as unexpected failures.

### Caution

An issue in the installation process causes any running program which links to JS78 shared library (for example, GNOME Shell) to crash if JS78 is upgraded or reinstalled. To work around this issue, remove the old version of the JS78 shared library before installation:

    rm -fv /usr/lib/libmozjs-78.so

Now, as the `root` user:

    make install &&
    rm -v /usr/lib/libjs_static.ajs &&
    sed -i '/@NSPR_CFLAGS@/d' /usr/bin/js78-config

## Command Explanations

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

`--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 JS78. jemalloc is only intended for the Firefox browser environment. For other applications using JS78, if JS78 uses jemalloc, the application may crash as items allocated in jemalloc allocator are freed on 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 JS78.

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/js78-config: Prevent js78-config from using buggy CFLAGS.

## Contents

Installed Programs: js78 and js78-config
Installed Libraries: libmozjs-78.so
Installed Directories: /usr/include/mozjs-78

### Short Descriptions

js78 | provides a command line interface to the JavaScript engine
js78-config | is used to find the JS compiler and linker flags
`libmozjs-78.so` | contains the Mozilla JavaScript API functions

Last updated on 2021-02-26 17:57:35 -0800

- Prev

  Jansson-2.13.1

- Next

  JSON-C-0.15

- Up
- Home