Firefox-65.0.1

#### Beyond Linux® From Scratch - Version 2019-02-27

### Chapter 40. Graphical Web Browsers

- Prev

  Falkon-3.0.1

- Next

  SeaMonkey-2.49.4

- Up
- Home

# Firefox-65.0.1

## Introduction to Firefox

Firefox is a stand-alone browser based on the Mozilla codebase.

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

### Package Information

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

- Download MD5 sum: 38c01a14e58cce894dda513739bd15d3

- Download size: 264 MB

- Estimated disk space required: 9.4 GB (148 MB installed) without tests

- Estimated build time: 31 SBU (with parallelism=4) without tests

### Additional Downloads

- Optional patch to allow system versions of Graphite2-1.3.13 and HarfBuzz-2.3.1: http://www.linuxfromscratch.org/patches/blfs/svn/firefox-65.0.1-system_graphite2_harfbuzz-1.patch

### Note

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.

As with other large packages which use C++ (or rust), the SBU times to build this vary more widely than you might expect. Also, 6GB of real memory is used during the final link and the SBUs can increase significantly if the machine has to swap.

The mach build system (Python scripts) can be somewhat unreliable: if the build fails and reports an Error, it can still return a status of success, causing a scripted build to try to install (which does not rerun the build), fail during the preparations for installing, but still exit with a status of success. Also, on occasion it may limit itself to only running one set of jobs - that will make the build take about 3 times as long as running with four sets of jobs.

Although upstream prefer to use PulseAudio, for the moment Alsa can still be used. Both may need runtime configuration to get sound working.

### Firefox Dependencies

#### Required

Autoconf-2.13, Cbindgen-0.8.0, Clang (from LLVM-7.0.1), both GTK+-3.24.5 and GTK+-2.24.32, libnotify-0.7.7, nodejs-10.15.1, NSS-3.42.1, PulseAudio-12.2 (or alsa-lib-1.1.8 if you edit the mozconfig; now deprecated by mozilla), in either case please read the Configuration Information, rustc-1.32.0, UnZip-6.0, yasm-1.3.0, and Zip-3.0

#### Recommended

ICU-63.1, libevent-2.1.8, libwebp-1.0.2, and SQLite-3.27.1

### Note

If you don't install recommended dependencies, then internal copies of those packages will be used. They might be tested to work, but they can be out of date or contain security holes.

#### Optional

cURL-7.64.0, dbus-glib-0.110, Doxygen-1.8.15, GConf-3.2.6, FFmpeg-4.1.1 (runtime, to play mov, mp3 or mp4 files), liboauth-1.0.3, OpenJDK-11.0.2, startup-notification-0.12, Valgrind-3.14.0, Wget-1.20.1, Wireless Tools-29, libproxy, and (with the patch) Graphite2-1.3.13 and HarfBuzz-2.3.1

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

## Installation of Firefox

The configuration of Firefox is accomplished by creating a `mozconfig` file containing the desired configuration options. A default `mozconfig` is created below. To see the entire list of available configuration options (and an abbreviated description of some of them), issue ./mach configure && ./configure --help | less. You may also wish to review the entire file and uncomment any other desired options. Create the file by issuing the following command:

    cat > mozconfig << "EOF"
    # If you have a multicore machine, all cores will be used by default.

    # If you have installed dbus-glib, comment out this line:
    ac_add_options --disable-dbus

    # If you have installed dbus-glib, and you have installed (or will install)
    # wireless-tools, and you wish to use geolocation web services, comment out
    # this line
    ac_add_options --disable-necko-wifi

    # API Keys for geolocation APIs - necko-wifi (above) is required for MLS
    # Uncomment the following line if you wish to use Mozilla Location Service
    #ac_add_options --with-mozilla-api-keyfile=$PWD/mozilla-key

    # Uncomment the following line if you wish to use Google's geolocaton API
    # (needed for use with saved maps with Google Maps)
    #ac_add_options --with-google-api-keyfile=$PWD/google-key

    # Uncomment this line if you have installed startup-notification:
    #ac_add_options --enable-startup-notification

    # Uncomment the following option if you have not installed PulseAudio
    #ac_add_options --disable-pulseaudio
    # and uncomment this if you installed alsa-lib instead of PulseAudio
    #ac_add_options --enable-alsa

    # If you have installed GConf, comment out this line
    ac_add_options --disable-gconf

    # From firefox-61, the stylo CSS code can no-longer be disabled

    # Comment out following options if you have not installed
    # recommended dependencies:
    ac_add_options --enable-system-sqlite
    ac_add_options --with-system-libevent
    # current firefox fails to build against libvpx-1.8.0
    #ac_add_options --with-system-libvpx
    # firefox-65 understands webp and ships with an included copy
    ac_add_options --with-system-webp
    ac_add_options --with-system-nspr
    ac_add_options --with-system-nss
    ac_add_options --with-system-icu

    # The gold linker is no-longer the default
    ac_add_options --enable-linker=gold

    # You cannot distribute the binary if you do this
    ac_add_options --enable-official-branding

    # If you are going to apply the patch for system graphite
    # and system harfbuzz, uncomment these lines:
    #ac_add_options --with-system-graphite2
    #ac_add_options --with-system-harfbuzz

    # Stripping is now enabled by default.
    # Uncomment these lines if you need to run a debugger:
    #ac_add_options --disable-strip
    #ac_add_options --disable-install-strip

    # The BLFS editors recommend not changing anything below this line:
    ac_add_options --prefix=/usr
    ac_add_options --enable-application=browser

    ac_add_options --disable-crashreporter
    ac_add_options --disable-updater
    # enabling the tests will use a lot more space and significantly
    # increase the build time, for no obvious benefit.
    ac_add_options --disable-tests

    # With clang, unlike gcc-7 and later, the default level
    # of optimization produces a working build.
    ac_add_options --enable-optimize

    # From firefox-61 system cairo is not supported

    ac_add_options --enable-system-ffi
    ac_add_options --enable-system-pixman

    # From firefox-62 --with-pthreads is not recognized

    ac_add_options --with-system-bz2
    ac_add_options --with-system-jpeg
    ac_add_options --with-system-png
    ac_add_options --with-system-zlib

    mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-build-dir
    EOF

Compile Firefox by issuing the following commands:

If you have installed system versions of graphite2 and harfbuzz and wish firefox to use those instead of its shipped versions, apply the patch and uncomment the appropriate entries in the `mozconfig` file.

    patch -Np1 -i ../firefox-65.0.1-system_graphite2_harfbuzz-1.patch

If the geolocation APIs are needed:

### Note

The Google and Mozilla API Keys below are specific to LFS. If using these instructions for another distro, or if you intend to distribute binary copies of the software using these instructions, please obtain your own keys following the instructions located at http://www.chromium.org/developers/how-tos/api-keys and https://location.services.mozilla.com/api respectively.

    echo "AIzaSyDxKL42zsPjbke5O8_rPVpVrLrJ8aeE9rQ" > google-key
    echo "d2284a20-0505-4927-a809-7ffaf4d91e55" > mozilla-key

### Note

If you are compiling Firefox in chroot, make sure you have `$SHELL` environment variable set or prepend `SHELL=/bin/sh`. Also ensure that `/dev/shm` is mounted.

To use the system version of ICU, run a sed to avoid a conflict between upstream ICU's use of `CheckImpl()` in their public headers and firefox's internal use of a different `CheckImpl()`. Then invoke the Python2 script to compile the package.

    sed -e 's/checkImpl/checkFFImpl/g' -i js/src/vm/JSContext*.h &&
    export CC=clang CXX=clang++ AR=llvm-ar NM=llvm-nm RANLIB=llvm-ranlib &&
    export MOZBUILD_STATE_PATH=${PWD}/mozbuild &&
    ./mach build

The `mozconfig` above disables the tests because they use a lot more time and disk space for no obvious benefit. If you have nevertheless enabled them, you can run the tests by executing ./mach gtest. This will require a network connection, and to be run from within an Xorg session - there is a popup dialog when it fails to connect to ALSA (that does not create a failed test). One or two tests will fail. To see the details of the failure(s) you will need to log the output from that command so that you can review it.

Now, as the `root` user:

    ./mach install                                                  &&

    mkdir -pv  /usr/lib/mozilla/plugins                             &&
    ln    -sfv ../../mozilla/plugins /usr/lib/firefox/browser/

Set environment variables back to their values:

    unset CC CXX AR NM RANLIB MOZBUILD_STATE_PATH

## Command Explanations

sed -e 's/checkImpl/checkFFImpl/g' ...: Although the package ships with a modified version of ICU-59 and only tests that the system version, if requested, is at least 59, changes in some versions cause builds with the system version to fail with error messages of the form `no void JSContext::checkImpl_NN member function` where NN is the system ICU version. The sed renames the local function.

export CC=clang CXX=clang++ ...: Upstream now use clang and building with any recent version saves a lot of space.

export MOZBUILD_STATE_PATH=${PWD}/mozbuild: The build is now supposed to tell you that it intends to create `~/.mozbuild`, and offer you an option to press <ENTER> to accept this, or Ctrl-C to cancel and restart the build after specifying the directory. In practice, the message may not appear until after <ENTER> is keyed, i.e. the build stalls.

That directory is used for a (probably random) telemetry identifier. Creating this in the build directory, and deleting that after the installation, prevents it being used. If you wish to participate in telemetry, export MOZBUILD_STATE_PATH to point to its default directory.

./mach build: Firefox now uses this python2 script to run the build and install.

`./mach build --verbose`: Use this alternative if you need details of which files are being compiled, together with any C or C++ flags being used.

`./mach build -jN`: The build should, by default, use all the online CPU cores. There are two reasons to specify the number of cores, e.g. -j4 for 4 cores: First, if using all the cores causes the build to swap because you have insufficient memory (e.g. for 4 cores a build without system graphite2 and harfbuzz now uses slightly over 8GB of RAM). In such cases, using fewer cores can be faster. Second, on some machines the middle part of the build can drag on as if only one core is present. In those cases, specifying the number of cores may speed up the build.

mkdir -pv /usr/lib/mozilla/plugins: This ensures that `/usr/lib/mozilla/plugins/` exists.

ln -sv ... /usr/lib/firefox/browser: This command creates a symbolic link to `/usr/lib/mozilla/plugins`. It's not really needed, as Firefox checks `/usr/lib/mozilla/plugins` by default, but the symbolic link is made to keep all the plugins installed in one folder.

## Configuring Firefox

If you use a desktop environment like Gnome or KDE you may like to create a `firefox.desktop` file so that Firefox appears in the panel's menus. If you didn't enable startup-notification in your mozconfig change the StartupNotify line to false. As the `root` user:

    mkdir -pv /usr/share/applications &&
    mkdir -pv /usr/share/pixmaps &&

    cat > /usr/share/applications/firefox.desktop << "EOF" &&
    [Desktop Entry]
    Encoding=UTF-8
    Name=Firefox Web Browser
    Comment=Browse the World Wide Web
    GenericName=Web Browser
    Exec=firefox %u
    Terminal=false
    Type=Application
    Icon=firefox
    Categories=GNOME;GTK;Network;WebBrowser;
    MimeType=application/xhtml+xml;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
    StartupNotify=true
    EOF

    ln -sfv /usr/lib/firefox/browser/chrome/icons/default/default128.png \
            /usr/share/pixmaps/firefox.png

### Configuration Information

The application settings for firefox are accessible by keying about:config in the address bar.

With this version of firefox, getting working sound can be a problem. Although upstream prefers pulseaudio, on balance using Alsa may be easier.

If you enabled Alsa for sound, you may need to alter one variable to get working sound. If you run firefox from a term and try to play something with sound you might encounter error messages like:

`Sandbox: seccomp sandbox violation: pid 3941, tid 4030, syscall 16, args 48 2147767296 139909894784796 0 0 0.`

That was on x86_64, on i686 the syscall number is 54. To allow this syscall, in about:config change security.sandbox.content.syscall_whitelist to 16 (or 54 if using i686).

If you use pulseaudio in a Desktop Environment, it might already be started by that DE. But if it is not, although firefox-57 managed to start it, firefox-58 did not. If you run firefox from a term and this problem is present, trying to play sound will encounter error messages warning `Can't get cubeb context!`

The fix for this is to close firefox, start pulseaudio to check it does start (if not, read the information on Configuring in PulseAudio-12.2) and restart firefox to check it is working. If it now works, add the following to your `~/.xinitrc`: `pulseaudio --verbose --log-target=syslog&` (unfortunately, on some systems this does not work).

You may wish to use multiple profiles within firefox. To do that, invoke firefox as firefox --ProfileManager. You can also check which profile is currently in use from about:profiles.

## Contents

Installed Programs: firefox
Installed Libraries: Numerous libraries, browser components, plugins, extensions, and helper modules installed in /usr/lib/firefox
Installed Directory: /usr/lib/firefox and /usr/lib/mozilla

### Short Descriptions

firefox | is a GTK+-3 internet browser that uses the Mozilla Gecko rendering engine.

Last updated on 2019-02-15 15:01:29 -0600

- Prev

  Falkon-3.0.1

- Next

  SeaMonkey-2.49.4

- Up
- Home