WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Solved] Firefox-ESR won't start after packing - Couldn't load XPCOM.  (Read 3182 times)

Offline polikuo

  • Hero Member
  • *****
  • Posts: 724
Hi all
I managed to compile Firefox 91.7.0 ESR on aarch64
However, I'm encountering a weird phenomenon that need fixing before mailing it.  :-\
I'm testing out distcc and have successfully compiled a working result. (I'm posting from this build right now)

After the installation, everything works. (sudo MACH_USE_SYSTEM_PYTHON=1 time ./mach install)
Then I pack it up in a tcz (with/without .desktop and icons)
Remove the files in the system (sudo rm -fr /usr/local/lib/firefox)
tce-load the package and this is what I get

Code: [Select]
tc@pi3:/mnt/sda1/firefox-91.7.0$ firefox
Couldn't load XPCOM.

I've tried copy mode, rebooting, replacing with tar command and more.
No matter what do, it won't start.

The only solution is to rerun the installation command above.
Firefox will start again like it normally would.

The combo of touch files as time mark and finding newer files report nothing interesting
They are the same file list you see in the repo build.

I'm suspecting notify-send might be responsible, but I have no clue what it is / how to use it.

Code: [Select]
tc@pi3:/mnt/sda1/firefox-91.7.0$ sudo MACH_USE_SYSTEM_PYTHON=1 time ./mach install
 0:07.84 /usr/local/bin/make -C . -j4 -s -w install
 0:08.62 make: Entering directory '/mnt/sda1/firefox-91.7.0/firefox-build-dir'
 0:08.66 make[1]: Entering directory '/mnt/sda1/firefox-91.7.0/firefox-build-dir/browser/installer'
 1:20.20 make[1]: Leaving directory '/mnt/sda1/firefox-91.7.0/firefox-build-dir/browser/installer'
 1:20.22 make: Leaving directory '/mnt/sda1/firefox-91.7.0/firefox-build-dir'
 1:20.22 /usr/local/bin/notify-send --app-name=Mozilla Build System Mozilla Build System Install complete
real    1m 27.16s
user    0m 37.03s
sys     0m 17.05s
« Last Edit: March 09, 2022, 10:53:45 AM by Rich »

Offline polikuo

  • Hero Member
  • *****
  • Posts: 724
Re: Firefox-ESR won't start after packing - Couldn't load XPCOM.
« Reply #1 on: March 09, 2022, 10:47:56 AM »
Okay, I see the problem...
It appears that the time stamp of some files are preserved when installing
Therefore, the "find -newer" method won't work.
Some files are left behind with this strategy.
The solution is rather simple.
The mach build system supports "DESTDIR" variable.
Code: [Select]
DESTDIR=/tmp/packing-firefox MACH_USE_SYSTEM_PYTHON=1./mach install
P.S. I just wanna say, using pi4+pi3 with distcc is not really helping.
pi3 is too slow for pi4 from my observation
Most of the time, pi4 gives up waiting for pi3 and build locally.
It took me 7hr+ to build  :P
I'm considering rebuild the whole thing with LTO to see if it shrink the size.
BTW, I've found a better configuration (some flags here and there) that slightly shrink the overall size.
I'll send my "mozconfig" when things got sorted.
Code: [Select]
tc@pi4:~$ du -bh /mnt/mmcblk0p2/tce/optional/firefox.tcz
72.9M   /mnt/mmcblk0p2/tce/optional/firefox.tcz

This post can be marked solved
« Last Edit: March 09, 2022, 11:04:53 AM by polikuo »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11621
Re: [Solved] Firefox-ESR won't start after packing - Couldn't load XPCOM.
« Reply #2 on: March 09, 2022, 10:57:56 AM »
Hi polikuo
You beat me to it. I was getting ready to suggest searching for  xpcom  under /usr after installation.

Marked as solved.  :)

Offline polikuo

  • Hero Member
  • *****
  • Posts: 724
Re: [Solved] Firefox-ESR won't start after packing - Couldn't load XPCOM.
« Reply #3 on: March 11, 2022, 02:50:22 AM »
Hi
Just some follow up
It took me a while to figure out how to do cross language LTO on firefox
For some unknown reason, the libpng provided by the repo is not compatible in this mode.
I had to use the libpng provided by the firefox source code. (disable --with-system-png)
This increase the size of libxul.so by ~20MB

Personally, I believe the performance has been improved.
I don't feel any lag on pi4.
I think I'll mail this build as well, as a different extension.
How should I name this build ?
My ideas are firefox-cross-lang.tcz or firefox-llvm.tcz or firefox-lto.tcz ...
Any suggestions ?

Size comparison between the builds
Code: [Select]
4.0K    cross-lang-lto/usr/local/lib/firefox/application.ini                    4.0K    distcc/usr/local/lib/firefox/application.ini
744K    cross-lang-lto/usr/local/lib/firefox/browser/features                   744K    distcc/usr/local/lib/firefox/browser/features
44K     cross-lang-lto/usr/local/lib/firefox/browser/chrome/icons/default       44K     distcc/usr/local/lib/firefox/browser/chrome/icons/default
44K     cross-lang-lto/usr/local/lib/firefox/browser/chrome/icons               44K     distcc/usr/local/lib/firefox/browser/chrome/icons
44K     cross-lang-lto/usr/local/lib/firefox/browser/chrome                     44K     distcc/usr/local/lib/firefox/browser/chrome
41M     cross-lang-lto/usr/local/lib/firefox/browser                            41M     distcc/usr/local/lib/firefox/browser
4.0K    cross-lang-lto/usr/local/lib/firefox/defaults/pref                      4.0K    distcc/usr/local/lib/firefox/defaults/pref
4.0K    cross-lang-lto/usr/local/lib/firefox/defaults                           4.0K    distcc/usr/local/lib/firefox/defaults
4.0K    cross-lang-lto/usr/local/lib/firefox/dependentlibs.list                 4.0K    distcc/usr/local/lib/firefox/dependentlibs.list
392K    cross-lang-lto/usr/local/lib/firefox/firefox                            540K    distcc/usr/local/lib/firefox/firefox
392K    cross-lang-lto/usr/local/lib/firefox/firefox-bin                        540K    distcc/usr/local/lib/firefox/firefox-bin
1.4M    cross-lang-lto/usr/local/lib/firefox/fonts                              1.4M    distcc/usr/local/lib/firefox/fonts
56K     cross-lang-lto/usr/local/lib/firefox/gmp-clearkey/0.1                   72K     distcc/usr/local/lib/firefox/gmp-clearkey/0.1
56K     cross-lang-lto/usr/local/lib/firefox/gmp-clearkey                       72K     distcc/usr/local/lib/firefox/gmp-clearkey
32K     cross-lang-lto/usr/local/lib/firefox/liblgpllibs.so                     36K     distcc/usr/local/lib/firefox/liblgpllibs.so
248K    cross-lang-lto/usr/local/lib/firefox/libmozavcodec.so                   248K    distcc/usr/local/lib/firefox/libmozavcodec.so
196K    cross-lang-lto/usr/local/lib/firefox/libmozavutil.so                    204K    distcc/usr/local/lib/firefox/libmozavutil.so
8.0K    cross-lang-lto/usr/local/lib/firefox/libmozgtk.so                       8.0K    distcc/usr/local/lib/firefox/libmozgtk.so
84K     cross-lang-lto/usr/local/lib/firefox/libmozsandbox.so                   120K    distcc/usr/local/lib/firefox/libmozsandbox.so
832K    cross-lang-lto/usr/local/lib/firefox/libmozsqlite3.so                   844K    distcc/usr/local/lib/firefox/libmozsqlite3.so
12K     cross-lang-lto/usr/local/lib/firefox/libmozwayland.so                   16K     distcc/usr/local/lib/firefox/libmozwayland.so
114M    cross-lang-lto/usr/local/lib/firefox/libxul.so                          92M     distcc/usr/local/lib/firefox/libxul.so
28M     cross-lang-lto/usr/local/lib/firefox/omni.ja                            28M     distcc/usr/local/lib/firefox/omni.ja
392K    cross-lang-lto/usr/local/lib/firefox/pingsender                         540K    distcc/usr/local/lib/firefox/pingsender
4.0K    cross-lang-lto/usr/local/lib/firefox/platform.ini                       4.0K    distcc/usr/local/lib/firefox/platform.ini
388K    cross-lang-lto/usr/local/lib/firefox/plugin-container                   532K    distcc/usr/local/lib/firefox/plugin-container
0       cross-lang-lto/usr/local/lib/firefox/removed-files                      0       distcc/usr/local/lib/firefox/removed-files

P.S. Hey paul
Do you mind if I take over libpng ?
That is, if I actually find a solution...
« Last Edit: March 11, 2022, 02:52:36 AM by polikuo »

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14815
Re: [Solved] Firefox-ESR won't start after packing - Couldn't load XPCOM.
« Reply #4 on: March 11, 2022, 03:13:42 AM »
You need  to patch libpng for it to work with firefox and some other browsers - see blfs for the patch.

Offline polikuo

  • Hero Member
  • *****
  • Posts: 724
Re: [Solved] Firefox-ESR won't start after packing - Couldn't load XPCOM.
« Reply #5 on: March 11, 2022, 03:23:42 AM »
Hi juanito.
I know that, but it looks like the patch no longer works with the newer version of firefox.
I can see some patches in the firefox source for png but they are different from the LFS one.
Code: [Select]
tc@pi4:/mnt/mmcblk0p3/firefox-lto$ ls ./media/libpng/*.patch
./media/libpng/apng.patch  ./media/libpng/arm.patch

Change-log: attaching patch files.
« Last Edit: March 11, 2022, 03:25:51 AM by polikuo »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11621
Re: [Solved] Firefox-ESR won't start after packing - Couldn't load XPCOM.
« Reply #6 on: March 11, 2022, 08:12:51 AM »
Hi polikuo
... How should I name this build ? ...

Well, since you said this:
Quote
... Personally, I believe the performance has been improved.
I don't feel any lag on pi4. ...

Maybe something like  firefox-91.7.0esr-faster.tcz  or  firefox-91.7.0esr-perf.tcz.
Then include a comment in the  .info  file that the extension trades off size for speed (or performance).


Offline polikuo

  • Hero Member
  • *****
  • Posts: 724
Re: [Solved] Firefox-ESR won't start after packing - Couldn't load XPCOM.
« Reply #7 on: March 13, 2022, 11:12:37 PM »
Hi

It took me a while, but I've found the cause and solution.
I'm using LLVM linker "ld.lld" for this build.
That linker doesn't search /usr/local/lib by default.
(BTW, neither does the gold linker, is there any way to adjust that so they behave like the bfd one ?)

So we don't need to adjust libpng.
All you have to do is to specify it from the command.
Code: [Select]
CC='clang -march=armv8-a+crc -mtune=cortex-a72 -L/usr/local/lib'
Sadly, with system-png only saves 46 KB of space.
It's insignificant compare to the entire directory (185.7M)

Do you think I should submit this build ?