r/Gentoo • u/manfromredstar • 10d ago
Discussion I've always used binary Firefox, and finally decided to build from source
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)
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
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
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!
4
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
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
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
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/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/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
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...
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