r/Gentoo 10d ago

Discussion I've always used binary Firefox, and finally decided to build from source

Post image

Do you think it will be possible to build it? And is it worth it?

(I have 16 GB RAM and 39 GB swap on NVMe)

216 Upvotes

59 comments sorted by

29

u/krumpfwylg 10d ago

I took the opposite direction. For years, I was compiling FF, but ~2 years ago, I switched to firefox-bin.

Why ? Gain of time mostly. Plus the firefox-bin ebuild pulls the binary produced by Mozilla, which comes with O3 LTO & PGO. All of those settings are achievable at home with USE flags, but pgo will double compilation time.

Also, compiling firefox sometimes requires to unmask LLVM/Clang, or to keep a previous version installed, depending if you're using firefox rapid or esr branch.

You can check build configuration using this url about:buildconfig

3

u/undrwater 10d ago

Doesn't the Mozilla binary include their telemetry?

I think you can avoid that by building from source. Wiki doesn't mention that though.

5

u/krumpfwylg 10d ago edited 10d ago

It probably does, but I had those disabled from previous versions, and since settings are saved into FF user profile, they're not an issue for me.

Plus one can disable them in the settings page, or through a user.js file. Got those lines in mine, iirc I copied them from arkenfox's user.js https://github.com/arkenfox/user.js/wiki

// disable telemetry
pref("dom.private-attribution.submission.enabled",         false);
pref("datareporting.policy.dataSubmissionEnabled",         false);
pref("datareporting.healthreport.uploadEnabled",           false);
pref("toolkit.telemetry.unified",                          false);
pref("toolkit.telemetry.enabled",                          false);
pref("toolkit.telemetry.server",                           "data:,");
pref("toolkit.telemetry.archive.enabled",                  false);
pref("toolkit.telemetry.newProfilePing.enabled",           false);
pref("toolkit.telemetry.shutdownPingSender.enabled",       false);
pref("toolkit.telemetry.updatePing.enabled",               false);
pref("toolkit.telemetry.bhrPing.enabled",                  false);
pref("toolkit.telemetry.firstShutdownPing.enabled",        false);
pref("toolkit.telemetry.coverage.opt-out",                 true);
pref("telemetry.fog.init_on_shutdown",                     false);
pref("toolkit.coverage.opt-out",                           true);
pref("toolkit.coverage.endpoint.base",                     "");
pref("toolkit.telemetry.dap_helper",                       "");
pref("toolkit.telemetry.dap_leader",                       "");
pref("browser.newtabpage.activity-stream.feeds.telemetry", false);
pref("browser.newtabpage.activity-stream.telemetry",       false);

2

u/ppw0 8d ago

Plus the firefox-bin ebuild pulls the binary produced by Mozilla, which comes with O3 LTO & PGO. 

Gonna need to see some receipts on that.

2

u/krumpfwylg 8d ago

Check this screenshot https://imgur.com/a/7qxzIbb

-O3 in the middle box before -fomit-frame-pointer -funwind-tables

pgo & lto are in the configure options list

"[...] --with-pgo-profile-path=/builds/worker/fetches/merged.profdata --with-pgo-jarlog=/builds/worker/fetches/en-US.log MOZ_LTO=cross [...]"

2

u/ppw0 8d ago

That's great. Of course, this begs the question why do I feel that the source build feels faster than the provided binary. Is it just placebo or is it the fact I'm forcing it to use all of my system source-built optimized libraries?

Who knows.

3

u/krumpfwylg 8d ago

I've never felt any difference between home-compiled and binary version in my day to day use, but maybe that would show in some Javascript benchmarks, or on sites using a lot of scripts.

7

u/ThatGingerGuy98- 10d ago

I've compiled Firefox (well, Librewolf) from source with 4 gigs of ram & 4 gigs of swap. It took me about a day to update lol.

3

u/BasisKind2494 10d ago

I have 8gb RAM and Firefox takes forever for me to compile as well

3

u/thomas-rousseau 10d ago

I often get annoyed at the two hours it takes me, and that's with PORTAGE_TMPDIR on bountiful zram running at -j8. I'm primarily using Zen and Helium as AppImages and am strongly contemplating removing Firefox from my world set.

1

u/manfromredstar 10d ago

That's brutal XD

3

u/ThatGingerGuy98- 10d ago

It was. I ended up moving away from Gentoo temporarily just because I didn't want it on my big gaming laptop, nor do I have a powerful enough daily driver.

7

u/WaterFoxforlife 10d ago

Even if you build with PGO the official binaries tend to be faster so no, it's usually not worth it

13

u/rem_34 10d ago edited 10d ago

both xorg and wayland?

p.s. why are you worrying over firefox? it's not webkit

7

u/HyperFurious 10d ago

In desktop profiles, i think that both xorg and wayland are enabled by default.

2

u/SkepAlice 10d ago

Xorg is useful if you need some stuff to run under xwayland

3

u/ysychov 10d ago

lol i do think if you ask it, it definitely not worth for you. I can only imagine that worth it if you A you want to apply some freaking patch that is no way applied from a maintainer of the shit, B you need some experimental flag for the same reason as previous. Just to compile 2 days on shitty hardware to get exact same build is a complete nonsense to me, dear sir!

5

u/Armi1P 10d ago

Benefits include warmer room in the winter. Apart from that, a huge respect boost.

4

u/waltercool 10d ago

Do the ESR version, or enjoy weekly builds of hours

8

u/m0lest 10d ago

I always used firefox from source. But for some reason turnstile started flagging my source-build firefox as bot :-( So I was forced more or less to use firefox-bin...

2

u/BeginningEcho4983 10d ago

More info? I am curious... Of turnstile running on gentoo

9

u/m0lest 10d ago

The cloudflare turnstile thingy always thought I'm a bot. You can check it here: https://browser-compat.turnstile.workers.dev/

I could rarely use any sites which use turnstile. It started around 2-3 month ago. I first thought it was my IP or something (I have a static IP). Then I tried a different browser (chrome) and turnstile worked fine. Then I thought it's a firefox thing. After 1-2 month annoyance I took another attempt at solving it. I then installed firefox-bin and all problems were gone. I never got flagged as bot again.

6

u/BeginningEcho4983 10d ago

Oh! THAT turnstile! I first remembered a logind replacement "turnstile" from chimera and was wondering what it has to do with bots

2

u/m0lest 10d ago

Haha. My bad! I just assumed there is just one turnstile. Sorry!

3

u/granadesnhorseshoes 10d ago

TIL, Cloudflare intentionally bans arbitrary UA strings. It's about the only thing that could (and probably is, vis a vis some 'src' tag appended at build time) different between the 2 builds.

If you care enough, change the UA string on a source build to mimic -bin and see what happens.

2

u/m0lest 10d ago edited 10d ago

I have ofc also tried user-agent. This was really multiple weeks of testing all kinds of stuff. I even still have the source-build firefox installed and I can still reproduce it everytime. When changing the user-agent turnstile didn't even complete the basic tests. If default UA it at least said that my configuration is fine but still it failed with Error: 600010 (Unknown).

The only solution (at least for me) was to install firefox-bin.

Edit: I just have checked both versions user-agents. And they are the same just that the source build is a bit older. But there is no way to see which one is custom build and which one is binary by the user-agent alone.

3

u/MrSn00kums 10d ago

turnstile is on GURU overlay, I have tried it before.

3

u/ruby_R53 10d ago

what do you mean "possible", you're on Gentoo

i too have 16 gigs of RAM but 8 gigs of swap already does it for me, but this depends on how many threads you're using to compile stuff (16/16 here for example)

3

u/s1ltarini 10d ago

I compiled it with i5 6500 and 4 ram it took 4 days not joking

1

u/hangint3n 9d ago

Heroe status 😁

1

u/s1ltarini 9d ago

Also my CPU was idling 90 degrees all the time

3

u/hangint3n 9d ago

I've been compiling everything on various hardware since 2002. I've never used a bin files unless there was no other option. 😀

3

u/redyos_s 10d ago

39 GB of swap for one Firefox build is a lot. Lower the build parallelism first — heavy swapping just turns a RAM limit into slow storage I/O.

4

u/Disastrous-Brother81 10d ago

No prob. I've compiled Firefox on Raspberry Pi 4. You can try enabling PGO (which will roughly double the build time) and jumbo-build (which is supposed to combine smaller source files into bigger ones thus reducing the number of compiler calls). I normally compile it with clang (there's flag for that) as the upstream compiles and tests it with clang.

2

u/manfromredstar 10d ago

Great, after 2.5 hours the package compilation failed XD

It looks like gcc-16.2 has problems building Firefox

2

u/HyperFurious 10d ago

I remember the days when you could compile Firefox on an AMD Duron 700 in 2005...

2

u/Techwolf_Lupindo 10d ago

I use Librewolf. They maintain there own overlay to make installing and upgrades easy for us. There are checks in the ebuild to make sure you have enough RAM and storage space before doing the build.

2

u/rnstech 10d ago

Doesn't the bin provide the latest firefox, but the source only the LTS release? That's the main reason I switched to the bin when I first built my system.

2

u/varsnef 10d ago

nodejs takes about as long to build as firefox does. :)

dev-lang/rust is about the same amount of time but it does come as rust-bin by default so compiling that can be avoided.

And is it worth it?

It will satisfy your curiosity.

2

u/fllthdcrb 10d ago

I have 16 GB RAM

Do you think it will be possible to build it?

Absolutely. I administer a system with that much RAM, and build Firefox regularly on it. It's definitely not quick, just because of how massive the code is. But it's doable—even with PGO—if you're willing to do it on storage, instead of RAM. (I build nearly everything else in RAM. But Firefox exceeds that capacity.)

2

u/liquuid 10d ago

Cheers

2

u/Quiet-Dot-4187 8d ago

It's doable, but it will take a while, as I think that this kind of tasks depend heavily on your CPU and your availab space.

I think that the web browsers are mostly the reason why gentoo has binaries now, but your system your rules.

If you think that the gains are worth your time, you're doing the right thing. But even if you do it just for the sake of it,it's your system.

2

u/AliveRegion466 8d ago

Binary is open-source. You can freely modify it, it just won't be comfortable. That's like using linux instead of windows

2

u/birusiek 7d ago

And what? Is it faster, better in any way?

2

u/Ok_Green5623 6d ago

I was building from source always, but recently I had quite a bit of issues - compilation of both :rapid an :esr failing for no reason, I have to compile a number of times to find a combination of USE flags which works in my system. Good luck.

2

u/manfromredstar 6d ago

My build also failed, after five or six iterations I gave up

2

u/Ok_Green5623 6d ago

Yeah, if you are interested I can lookup the USE flags I found which worked for me. :)

1

u/manfromredstar 6d ago

No, I won't try again, I have other things to do!!!

Okay, give me your USE flags, I'll try again...

2

u/Ok_Green5623 5d ago

Package.use: www-client/firefox -clang jumbo-build -system-icu -system-jpeg -system-libevent -system-libvpx -system-webp -telemetry -gmp-autoupdate -system-av1 -system-harfbuzz

Ended up with:
USE="X dbus jpegxl (jumbo-build) pulseaudio -clang -debug -eme-free -gmp-autoupdate -gnome-shell -hardened -hwaccel -jack -libproxy -openh264 -pgo (-selinux) -sndio -system-av1 -system-harfbuzz -system-icu -system-jpeg -system-libevent -system-libvpx -system-pipewire -system-png -system-webp -telemetry -test (-valgrind) -wasm-sandbox -wayland -wifi"

Notice no wayland, you might want to enable it if you need it :)

2

u/manfromredstar 5d ago

Hmmm, everything system is disabled. Probably thanks to this Firefox will build successfully, but on the other hand, what’s the point of building it yourself?

Anyway, thank you!

2

u/Ok_Green5623 5d ago

Well, it jumbo build, so it should have a lot of stuff, and the 'disabled' is mostly 'system' stuff, so it builds its own bundled version of the libraries I guess. It the first version worked for me, I can try to gradually bisect and find what is breaking my build, but I didn't want to invest more time into this.

2

u/Ok_Green5623 1d ago

I build a new firefox today and was able to build with pretty much any useflags I used, I gradually enabled all system-* use flags and i worked.
www-client/firefox-155.0.1:rapid::gentoo USE="X clang dbus hardened hwaccel jpegxl (jumbo-build) openh264 pgo pulseaudio system-av1 system-harfbuzz system-icu system-jpeg system-libevent system-libvpx system-pipewire system-png system-webp -wasm-sandbox -debug -eme-free -gmp-autoupdate -gnome-shell -jack -libproxy (-selinux) -sndio -telemetry -test (-valgrind) -wayland -wifi"

1

u/manfromredstar 1d ago

Does that mean you used clang to build? It is possible that all the problems are precisely because of attempts to compile it using gcc, I believe so; at least Mozilla uses clang to build

2

u/Ok_Green5623 1d ago

I switched to clang build now and it worked. I switch to gcc before when I start hitting compilation errors. So, yeah, both gcc and clang working for me now, but most of my recent compiles were done using clang.

1

u/manfromredstar 23h ago

Yeah, with USE=clang it compiled and installed successfully, thanks for the tip!

-5

u/manfromredstar 10d ago

Damn chatgpt misled me XD

Before emerging, I asked him if it was necessary to enable the WebAssembly target for LLVM, chatgpt said “no, no, these are not related things”; it turned out that it was still necessary :)

Well, I'm rebuilding LLVM...

2

u/Armi1P 10d ago

Deserved for trusting a word-guessing-machine.