-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the status of firefox on musl #44
Comments
Yes, the cairo-gtk2 problem is a non-issue, and for users who want to use alsa, apulse is currently fixing issues with firefox, though patched pulseaudio is in the overlay. I've been watching this issue here: rust-lang/rust#31322 At the moment the only configuration that is possible is a rust toolchain dynamically linked against glibc that statically links binaries against musl. LLVM is ready, and it looks like cargo also requires a bootstrap binary. |
The PR for rust is fully functioning AFAIK; we're just working out some issues with their CI system. It should be possible to just copy the patches from Alpine at this point. The only two absolutely necessary ones are "musl-support-dynamic-linking.patch", which is just the PR, and "musl-fix-linux_musl_base.patch", which is equivalent to what I've been using locally this whole time (something along those lines will be a second stage of upstreaming). Then we can disable jemalloc with ./configure, or use "musl-fix-jemalloc.patch", which is already upstream. One thing to watch out for when bootstrapping rust is that you can't just use the installed version, since Gentoo overrides the library directory (adding the version for SLOT support). It's not likely that rust will provide musl-linked tarballs any time soon (various reasons involving their infrastructure). Right now I have a hacked-up tarball here that could be used to generate something more official. |
Any news on this? I would love to test stuff, but this is nothing where I'd be able to just hack myself something which works mostly. If I got it right there is the need of a statical linked rust (or a stage1?) to go ahead with and use for building dynamically linked stage2 which is linked against musl. Which parts of these are missings? I mean, Alpine seems to have a working binary at least? @smaeul can you please update the link if you happen to have a newer hacked-up tarball at hand? |
@stefson stage0 tarballs are at https://portage.smaeul.xyz/distfiles/. The ones without -dev in the version are the latest stable, with static LLVM, so they should work on any gentoo-musl system. A current ebuild is at https://github.com/smaeul/portage-overlay/tree/master/dev-lang/rust. |
Great, thank you so much for making an effort, looks good to me. For easier testing - is there a way to add this via layman? |
@smaeul - I managed to break the compile, would you like to work on it? If so, should I post it here or over at your own overlay? |
@stefson Post an issue at the overlay please |
I just peeked into a beta of firefox 56 and it seems to depend on icu-59.1 if system-icu useflag is activated, but it also seem to depend on llvm and clang. Mozilla team also announced that it will not continue to support musl on their overlay and patchset until musl-rust hits the tree. |
rust-lang/rust#40113 was merged a week ago, this broke static linking for musl which was fixed by rust-lang/rust#44070 - looking pretty good to me :) will the upcoming 1.21 release of rust fully cover musl and therefore be ready for the portage tree? |
@smaeul are you willing to offer a statically linked rust-stage for armhf to bootstrap it? If it helps I can offer cpu time to test the compile and runtime. |
@stefson statically-linked rust stage is not possible, because of compiler plugins. (Well, you can create one, but it won't bootstrap.) But I can make a bunch of dynamically-linked-with-rpath stages. |
Well, I would really like to try to build firefox for arm with musl, so anything is appreciated that makes this possible. dev-lang/rust-bin and dev-util/cargo would be the minimum I guess, to bootstrap a dev-lang/rust would be cool but is certainly not a must to make it compile. By the way, do your self-hosted binaries have jemalloc activated? |
I forgot to mention something. Since my aim is to build firefox binaries, the correct toolchain needed for rust would be armv7-unknown-linux-gnu if you build against glibc and for I guess it would be armv7-unknown-linux-musl? The first is the only flavour firefox supports for arm, armv6 or earlier is not supported. |
@stefson stage0 binaries for several arches are at https://portage.smaeul.xyz/distfiles/, source for creating them is in the src tarballs, as well as the bootstrap-* branches at https://github.com/smaeul/rust. These should all work with the ebuild in my overlay. I'm pretty much done with rust at this point (been working on the port since January), so if you need more arches or future stage0 tarballs for them, you'll have to try to get this upstream (to something like gentoo/gentoo, gentoo/musl, gentoo/rust, etc.) or do it yourself. |
You did a great job on this, highly appreciated! :) I am very much interested into learning how you did the crosscompiling and bootstrapping part? If you can release documentation about it I might be able to build further stages for arm (nativly) with your stages in the future. Unfortunatley I am not a programmer, so if your efforts regarding the crosscompiling included a lot of hacking around into the source code it is not very likely that I will be capable of maintaining this for a longer period of time. What is left to do is to adjust the ebuild with arm keywords, which is not that trivial but I might be able to find a solution for it. And open a pullrequest for the overlay if I managed to. P.S. there is one bigger file without tar.xz in the filelist: cargo-0.21.0-x86_64-unknown-linux-musl |
@doughdemon are you still active with musl on arm? |
@stefson Steps for generating a stage0 are:
The cargo without a suffix is a statically-linked cargo for x86_64. |
checklist for me
TODO
|
@stefson Why not just use https://portage.smaeul.xyz/distfiles/rust-1.20.0-armv7-unknown-linux-musleabihf.tar.xz ? But to answer your questions: build, host, and target are interpreted just like they are for gcc. Build is your current system, host is where you want to run the compiled rustc, and target is what platform the newly-compiled rustc can compile for. So to make a rustc that runs on x86_64-unknown-linux-musl and can compile for the same, then put that in both host and target. Cargo is also included in the stage0. The static version is just for people with mismatched libraries. You really must have my patches for 1.20.0. It should be exactly like I said: You need a cross-compiler if and only if you are cross-compiling: if |
I tried to avoid installing GCC 6, simply because I don't like to have an unstable toolchain on my system. But after multiple attemps I must say it is way easier to emerge GCC 6 than to mess around with bootstrapping a musl-cross for arm which uses GCC 5 - maybe I'm going to fill a bug for it on bugzilla, maybe not. To clarify things, I understood you in a way that you are offering these stages but are not going to continue with your efforts providing them - so that someone else must built them from 1.21.0 on? This is how I understood you, therefore I tried to understand how the cross compile is working to be able to reproduce a new stage 0 , but failing hard with this. The last two bulletpoints in your checklist - can you give me an example what to actually write into the config.toml for build = "x86_64-unknown-linux-gnu" and build = "x86_64-unknown-linux-gnu" because I don't understand your explanation about strings and arrays, if I have to replace $TARGET with something from the target defined earlier in the file. Also confused about the different syntax from your posting and the config.toml P.S. for the first example I would need a crosscompiler too (x86_64-unknown-linux-musl), isn't it? |
I managed to get a (mostly) working X on the rpi2 with a glibc stage3, firefox 55.0.2 needs a patch to build (taken from fedora) but all I get is a segfault at starting the firefox binary. The ubuntu arm port has a similar issue while the arch linux arm port does not have this issue. Makes me wonder if this is a toolchain bug? Right now I am trying if 52.3.0esr does give the segfault as well, and later on I might try to build a debug build, which could take a long time to complete.
|
Here's an interesting project: It appears as though it can bootstrap the rust compiler from just C++, though it only works for x86_64 |
regarding the segfault of firefox-55.0.2 on arm, I read the suggestion that one should deactivate -schedule-insns which is part of the -O2 cflag, which is gentoo standard for firefox on gentoo: this needs to be altered into
but portage gets confused by two values for the option, hence shredders the mozconfig with --enable-optimize=-O2 in one line, and -fno-schedule-insns for the next. As a last ressort only for testing if the segfault goes away with the changed cflag, can I use |
@stefson Try something like |
The idea is good, but it's not working If I change the lines to it gives me this during src_configure Building firefox-55.0.2 with the following configuration later on complainig
and failing to configure Can I edit the mozconfig in the WORKDIR by hand, so that I know if this suggestion makes sense at all? |
Have you tried enabling the "custom-cflags" use flag and setting CFLAGS
and CXXFLAGS via package.env? This is what I use for firefox-52.2.0 on
musl arm.
|
in make.conf I have these cflags and, additionally in package.env, these during src_configure you can see that the checks for cflags and so on are going a bit on rampage, adding up many iterations of -fno-schedule-insns on top of each other, but nothing about -O2.
USE=" -bindist -+gmp-autoupdate -hardened -hwaccel -jack -nsplugin -pgo -selinux -test" No idea what is going on internally in the build system, but this binary segfaults straight away. I used custom-cfalgs and -optimization flag (overly agressive cflags are getting stripped by the way)
These are the packages that would be merged, in order: [ebuild R *] www-client/firefox-55.0.2::gentoo USE="custom-cflags custom-optimization dbus system-harfbuzz system-icu system-jpeg system-libevent system-sqlite -bindist -debug -gmp-autoupdate (-hardened) -hwaccel -jack -neon -nsplugin (-pgo) -pulseaudio (-selinux) -startup-notification (-system-cairo) -system-libvpx {-test} -wifi" L10N="de -ach -af -an -ar -as -ast -az -bg -bn-BD -bn-IN -br -bs -ca -cak -cs -cy -da -dsb -el -en-GB -en-ZA -eo -es-AR -es-CL -es-ES -es-MX -et -eu -fa -ff -fi -fr -fy -ga -gd -gl -gn -gu -he -hi -hr -hsb -hu -hy -id -is -it -ja -ka -kab -kk -km -kn -ko -lij -lt -lv -mai -mk -ml -mr -ms -nb -nl -nn -or -pa -pl -pt-BR -pt-PT -rm -ro -ru -si -sk -sl -son -sq -sr -sv -ta -te -th -tr -uk -uz -vi -xh -zh-CN -zh-TW" 229.425 KiB |
In the case of custom-optimization and custom-cflags, the ebuild does not fully honor CFLAGS from make.conf, they have to be set separately via /etc/portage/env and specified explecitly, CFLAGS="${CFLAGS} -fno-schedule-insns" does not work. For the segfault, I tried all kind of gcc (5.4.0-r3, 6.4.0, 7.1.0) and combinations of CFLAGS (-O2 -fno-schedule-insns, -g -O2 -fno-schedule-insns), to no positive results. So I went back to firefox-esr and am going to wait for further releases to test. Upstream bug is here: https://bugzilla.mozilla.org/show_bug.cgi?id=1391802 |
Any way we can have rust on-overlay at least? |
new deps for 63.0 (as of now) will be |
Regarding rust 1.31.1 by smaeul, the firefox ebuild need to be patched I make a quick and dirty ebuild for testing purpose only
Clean patch |
I made some test of Firefox 60.4, didn't get any segfault, however on any page loading :
On any keyboard input in the url bar this :
I get rid of this one by setting browser.urlbar.autocomplete.enabled to false I won't use firefox after the end of support for the 60.x anyway, nodejs as new dependency is not acceptable for me. |
If anyone has a memory starving system around, such as rpi, and feels like trying to go for a minimal desktop + X plus one browser - I managed to get a cross compile for firefox-esr working. How to reproduce:
This patch should fix it:
emerge with cross-emerge wrappers: emerge-${CHOST} -av firefox have fun :) (system-icu and system-sqlite are not working for me) |
For non-esr, the situation is a bit more complicated. In addition to the aforementioned:
enjoy :) and please share with me if you've done some runtime testing. |
Updated patch for firefox-66. This is for glibc toolchain, replace it with your own value of gcc.
Sadly it doesn't really work with the musl based rust-std's from smauel yet. |
anyone got a working //Edit: firefox needs it for elf-hack, despite using gcc as it's main compiler. |
i don't think i got sanitizers working at any point on a musl system. |
the ebuild from this overlay is working, but it's for slot 6. |
my dev overlay |
https://gist.github.com/anarchpenguin/36a394950bcfa5a2727ab4f2257a799f sorry I did not add to dev overlay, you can throw patch into /etc/portage/patches/sys-libs/compiler-rt-sanitizers |
Well, that seems to be the nuclear option. Is it still sufficent to make elf-hack work for firefox? |
|
I just emerged =firefox-60.7.2 with arm+musl, and it seems some symbols are missing:
the last two could be from spidermonkey, it's a known issue for v60: void-linux/void-packages#2598 Is there a way to understand where these missing symbols are from? |
Ok, I think I found the reason: since arm is slow and using |
68.0 compiles and runs fine. There is a single patch I have not included in the tree or the overlay for rust detection to work properly. |
Have you tried to emerge v68.0 with USE="lto" enabled? I keep hitting #689358, and with a workaround from the bug I got the same problems with missing symbols. |
The issue is well known. Upstream along with Gentoo devs are working to find a solution. I have done benchmarks for LTO to non LTO for musl and the gain just isn't enough for me to build with lto useflag enabled. https://dev.gentoo.org/~anarchy/benchmarks/musl-comparision-libc.txt If you want to see a full comparision not in diff format just go into benchmark directory they are there still. |
www-client/firefox-69.0_beta15::mozilla was built with the following: That is how firefox is built on this machine with is musl. |
I got Segmentation fault when build www-client/firefox-70.0::gentoo
USE flags:
|
Disable lto useflag which is known to cause an OOM, I will mask the useflag for mozilla packages via the profile shortly. |
--enable-elfhack is broken on arm for firefox-68.2.0, again |
For armv7: the build system has a bug, where there's some sort of race condition in I don't have a clue how to even try to debug this. But runtime testing went fine. If anyone is interested into the binary, I can send it over. |
how to use clang with cross compile: drop this as a wrapper into /usr/lib/llvm/x/bin/ and name it accordingly, firefox expects ${CHOST}-clang, and make it executeable with chmod +x
modelled by this example: the wrapper passes the whole |
Support is done on the forums. Please open a bug on bugzilla or a new ticket if you find a bug that is effecting musl. |
This used to be a place to chat and seek support on a lower level than bugzilla. Really I don't understand why you've decided to put an end to it. |
|
recently upstream has anounced some major changes
these both seem to be minor problems, gentoo-dev's are aware of it as far as I know.
@lluixhi - any progress in bootstrapping from a musl toolchain? It seems to depend on llvm-4 and clang, and cargo as well? I'd be happy to help out with compile and runtime testing.
The text was updated successfully, but these errors were encountered: