Attempted compile Firefox in EasyOS
Some applications, over the years, have become more bloated and more difficult to compile. Firefox included.
The Linux From Scratch people have instructions, for example:
https://www.linuxfromscratch.org/blfs/view/svn/xsoft/firefox.html
Rust and clang (LLVM) are required to compile Firefox. This is how to install Rust:
# curl -4 --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Choose custom install, and type in "1.51.0" for Default toolchain.
Installs to /root/.cargo
A dependency is 'cbindgen', a rust package, install:
# cargo install cbindgen
Another dependency is 'nodejs', obtain from here, the LTS package, doesn't need to be compiled:
Python3 is also required, unlike SeaMonkey that is still stuck on
needing Python2. Python3 is already in EasyOS, with the "devx" SFS
loaded of course, for the full Python3.
I compiled the LLVM package in OpenEmbedded, which includes 'clang'. I was shocked that the binary package, xz-compressed, is 2GB, but that includes a lot of ".a" files. The library "libllvm*so" on its own is 60MB,
and prior to now did not have it in the OE Dunfell build -- even though
it means some GPU drivers in the 'mesa' package could not be built.
It really does go against the grain for me, to include such a huge
library in EasyOS, and I won't. I have compiled it in OE only for the
purpose of compiling Firefox (in a running EasyOS), with the intention
that Firefox will be an SFS, not builtin to EasyOS.
So, LLVM and clang, compiled in OE, binary package now installed in running EasyOS 2.9, getting ready to compile Firefox...
Actually, it is not Firefox itself that needs clang and libllvm, it
is 'cbindgen', the rust package. Cross fingers that won't need libllvm
in the final firefox executable.
Final steps to getting ready for the compile, set some variables:
# export PATH="/root/.cargo/bin:${PATH}"
# export SHELL=/bin/sh
# export CC=gcc
# export CXX=g++
# export MACH_USE_SYSTEM_PYTHON=1
Here is the 'mozconfig' file, that needs to be in the Firefox source folder:
mk_add_options MOZ_OBJDIR=obj-x86_64-pc-linux-gnu
ac_add_options --enable-application=browser
ac_add_options --prefix=/usr
ac_add_options --host=x86_64-unknown-linux-gnu
ac_add_options --disable-dbus
ac_add_options --disable-accessibility
ac_add_options --disable-updater
ac_add_options --disable-parental-controls
ac_add_options --enable-strip
ac_add_options --with-system-jpeg
ac_add_options --with-system-zlib
ac_add_options --disable-tests
ac_add_options --disable-crashreporter
ac_add_options --with-system-libvpx
ac_add_options --disable-necko-wifi
ac_add_options --without-system-nspr
ac_add_options --without-system-nss
ac_add_options --without-system-icu
ac_add_options --disable-pulseaudio
ac_add_options --enable-alsa
ac_add_options --enable-system-ffi
ac_add_options --enable-system-pixman
ac_add_options --disable-debug
ac_add_options --with-system-libevent
ac_add_options --enable-optimize='-O2'
ac_add_options --enable-ffmpeg
ac_add_options --disable-webrtc
ac_add_options --enable-printing
ac_add_options --disable-jack
ac_add_options --without-system-webp
ac_add_options --disable-elf-hack
unset MOZ_TELEMETRY_REPORTING
I downloaded the latest source, version 92.0, from here:
http://ftp.mozilla.org/pub/firefox/releases/92.0/source/
Copied 'mozconfig' into it, then ran:
# ./mach configure
Then:
# ./mach build
...it compiled for a couple of hours, then compile fail.
Tried the legacy ESR version 78.x, see here:
https://www.linuxfromscratch.org/blfs/view/svn/xsoft/firefox-legacy.html
Source package:
https://archive.mozilla.org/pub/firefox/releases/78.14.0esr/source/firefox-78.14.0esr.source.tar.xz
...compile also failed, different place, in "netwerk/dns/mdns".
What requires mdns? WebRTC does, and I have "--disable-webrtc" in mozconfig. Worth a punt, have taken that out, trying again...
# rm -rf obj-x86_64-pc-linux-gnu/
# ./mach configure
# ./mach build
...failed again, this time in "modules/libjar/zipwriter".
Haven't given up yet! Downloaded the Firefox source from Debian:
https://packages.debian.org/bullseye/firefox-esr
http://deb.debian.org/debian/pool/main/f/firefox-esr/firefox-esr_78.12.0esr.orig.tar.xz
http://deb.debian.org/debian/pool/main/f/firefox-esr/firefox-esr_78.12.0esr-1.debian.tar.xz
Expanded the "debian" package inside the Firefox source, then applied the patches:
#!/bin/sh
P='fixes/Allow-.js-preference-files-to-set-locked-prefs-with-.patch
fixes/Bug-1526653-Include-struct-definitions-for-user_vfp-.patch
fixes/Bug-1650299-Unify-the-inclusion-of-the-ICU-data-file.patch
fixes/Bug-1264836-Automatically-convert-the-little-endian-.patch
porting/Add-xptcall-support-for-SH4-processors.patch
porting/NSS-Fix-FTBFS-on-Hurd-because-of-MAXPATHLEN.patch
porting/Work-around-Debian-bug-844357.patch
porting/Use-NEON_FLAGS-instead-of-VPX_ASFLAGS-for-libaom-neo.patch
porting/Work-around-GCC-ICE-on-mips-i386-and-s390x.patch
porting/Work-around-another-GCC-ICE-on-arm.patch
porting/Add-missing-bindings-for-mips-in-the-authenticator-c.patch
prefs/Set-javascript.options.showInConsole.patch
prefs/Set-DPI-to-system-settings.patch
prefs/Don-t-auto-disable-extensions-in-system-directories.patch
debian-hacks/Avoid-wrong-sessionstore-data-to-keep-windows-out-of.patch
debian-hacks/Add-another-preferences-directory-for-applications-p.patch
debian-hacks/Don-t-register-plugins-if-the-MOZILLA_DISABLE_PLUGIN.patch
debian-hacks/Add-a-2-minutes-timeout-on-xpcshell-tests.patch
debian-hacks/Add-debian-extra-stuff-to-upstream-build-system-dire.patch
debian-hacks/Don-t-build-image-gtests.patch
debian-hacks/Set-program-name-from-the-remoting-name.patch
debian-hacks/Use-the-Mozilla-Location-Service-key-when-the-Google.patch
debian-hacks/Avoid-using-vmrs-vmsr-on-armel.patch
debian-hacks/Use-remoting-name-for-call-to-gdk_set_program_class.patch
debian-hacks/Use-build-id-as-langpack-version-for-reproducibility.patch
debian-hacks/Don-t-build-ICU-in-parallel.patch
debian-hacks/Allow-to-build-with-older-versions-of-nodejs-10.patch'
for aP in $P
do
patch -p1 --dry-run < debian/patches/${aP} >/dev/null 2>&1
if [ $? -eq 0 ];then
echo "PATCH: ${aP}"
patch -p1 < debian/patches/${aP} >/dev/null 2>&1
else
echo "FAILED: ${aP}"
fi
done
Off we go again...
...failed again. Oh well, will just use an already-compiled package to create a Firefox SFS.
Tags: easy