Open Bug 1450742 Opened 7 years ago Updated 2 years ago

Cross Compiling Firefox Raspberry Pi

Categories

(Firefox Build System :: General: Unsupported Platforms, enhancement, P5)

enhancement

Tracking

(Not tracked)

People

(Reporter: pete, Unassigned)

Details

Attachments

(10 files)

Ok, I am attempting to cross compile Firefox 60 Beta for ARM - Raspberry Pi. I understand this hasn't been successfully done since 2013. I am using old docs as a guide and have gotten pretty far into the compilation. https://featherweightmusings.blogspot.com/2013/03/firefox-on-raspberry-pi.html I am hitting errors for code that requires -msse instruction set that is not support on ARM. So first off is it still possible to cross compile Firefox for ARM? Here is the error I am getting: 0:06.04 arm-unknown-linux-gnueabi-g++: error: unrecognized command line option '-msse2' 0:06.04 make[4]: *** [Unified_cpp_pture_differ_sse2_gn0.o] Error 1 0:06.04 make[3]: *** [media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn/target] Error 2 Any help would be appreciated.
Product: Firefox → Firefox Build System
I don't know if cross-compilation is still possible, but Firefox can be compiled on self-hosted ARMv7+NEON and aarch64 if you disable WebRTC and AV1. Additionally, on ARMv7 you need to disable debug symbols, too. In either case, the build host needs more RAM than a Raspberry Pi has.
Component: General → General: Unsupported Platforms
I am getting this error now after disabling: ac_add_options --disable-webrtc ac_add_options --disable-av1 In file included from /home/petejc/build/opt-rasppi-armv7-unknown-linux-gnueabihf/dist/system_wrappers/iosfwd:3:0, from /home/petejc/build/opt-rasppi-armv7-unknown-linux-gnueabihf/dist/stl_wrappers/iosfwd:44, from /opt/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/include/c++/6.3.1/ios:38, from /home/petejc/build/opt-rasppi-armv7-unknown-linux-gnueabihf/dist/system_wrappers/ios:3, from /home/petejc/build/opt-rasppi-armv7-unknown-linux-gnueabihf/dist/stl_wrappers/ios:44, from /opt/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/include/c++/6.3.1/ostream:38, from /home/petejc/build/opt-rasppi-armv7-unknown-linux-gnueabihf/dist/system_wrappers/ostream:3, from /home/petejc/build/opt-rasppi-armv7-unknown-linux-gnueabihf/dist/stl_wrappers/ostream:44, from /home/petejc/build/opt-rasppi-armv7-unknown-linux-gnueabihf/dist/include/mozilla/gfx/BasePoint.h:11, from /home/petejc/build/opt-rasppi-armv7-unknown-linux-gnueabihf/dist/include/mozilla/gfx/Point.h:14, from /home/petejc/build/opt-rasppi-armv7-unknown-linux-gnueabihf/dist/include/Units.h:11, from /home/petejc/build/opt-rasppi-armv7-unknown-linux-gnueabihf/dist/include/mozilla/widget/CompositorWidget.h:10, from /home/petejc/build/mozilla/gfx/gl/GLContextProviderGLX.cpp:19: /opt/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/include/c++/6.3.1/iosfwd:147:11: error: 'basic_stringbuf' does not name a type typedef basic_stringbuf<char> stringbuf; Is there a current working mozconfig for arm documented anywhere?
I don't believe there is one in our repos. Other people may have worked on one in the community, not sure.
Priority: -- → P5

it's certainly possible to cross compile firefox-60esr, use these:

--disable-webrtc ; or use patches from debian/ubuntu
--disable-elfhack ; it may not work (depends on distro)

use gcc for compiling, and pass --disable-stylo ; this avoids clang/llvm hassle.
Also it needs more memory at runtime, and it's both slow with our without compared to the performance of a full Desktop.

feel free to ask if you're still in trouble.

Will do. Thanks for the tips. I plan on resuming this work this summer if time allows.

If you can't make it before the new firefox-68esr, you might want to read about #1542622

11:35.13 error[E0432]: unresolved import simd_funcs
11:35.13 --> /home/petejc/build/mozilla/third_party/rust/encoding_rs/src/x_user_defined.rs:16:13
11:35.13 |
11:35.13 16 | use simd_funcs::*;
11:35.13 | ^^^^^^^^^^ maybe a missing crate simd_funcs?

Latest errors attempting to compile 68ESR release.

simd_funcs.rs is indeed on my system. Not sure why it's not importing.

well, I might help you, but can't unless you upload your full logs. It's certainly possible to make this work, I just cross compiled v68.3.0 half an hour ago.

Flags: needinfo?(pete)
Attached file build.log

Ubuntu 14.05 arm build log

Flags: needinfo?(pete)

you have to update your build host first, ubuntu 14.04 doesn't have recent enough toolchains.

Any suggestions?
Ubuntu 18.04?
Thanks

debian 10 is your best bet at the moment, given that the distro running on the rpi is a debian based distro.

you must be aware of dependencies.

Upgraded to Debain 10 installed arm toolchain and libs.
Getting same rust import error posted above.

Maybe I should use an older version of rust.
I am using 1.39 (latest)
[Nope, doesn't work.]

I commented out: --enable-rust-simd
To see if that will work.

Attached image incomplete type

Keep running into this error now.

That's due to an androidism in spidermonkey.

Basically it assumes that all arm is android, hence it relies on sys/user.h from Android headers.

use this patch to incoperate the missing bits from linux-headers: https://bugzilla.mozilla.org/show_bug.cgi?id=1526653#c20

Is there an arm patch for mdb.c?

Do you have that header installed, specifically for the use of cross compiling?

Ok, I think I see the problem.

This unresolved import simd_funcs issue is persistent.

simd_funcs.rs is indeed present. Not sure why the import is failing here.

Attached image firefox-66.0-lto.png

Make sure to have applied all patches from ubuntu, specifically for arm. I know you propably didn't, as the wasm bug you hit in #18 is fixed by a patch which is used by ubuntu. The rules/debian file will tell you which of the patches you need. Also make sure that your rustc is the same as used for the official ubuntu binary, for most new version of rust there's a bit to patch for the firefox source code tree.

Also it seems to me that your usage of clang is part of the problem. While it might be true that mozilla themselves and ubuntu prefere clang over gcc for building their binaries, it doesn't mean that cross compiling with the same patches and config options will be an easy task.

I added a screenshot from my own rpi2, with the proof that using gcc for compilation does give a working binary. But this is from gentoo, not ubuntu.

Will do thanks...

I added a screenshot from my own rpi2

Since you have successfully built FF68 for rpi, can you post your core patch and mozconfig files here?
That would be very helpful.
Thanks

Here is a good link on how to install Debian apt source.
https://wiki.debian.org/BuildingTutorial
I am looking at the source files and count 395 patch files.
I have always built mozilla directly and never used an OS distribution patched sources.
So this is new to me.

I must say that I find it really frustrating to see that you don't seem to have any idea how to build packages for your distro, but not sharing any valueable information with us to make your case understandable shows a serious lack of respect. I'm glad to help you out if I can with cross compile specific bugs, but be aware that it's not my job to solve your problems with understanding how your distro works. Please contact them in their irc, or find other ways of support to understand how to build packages. Then how to cross build packages.

It's 22. The number of patches in the patchset. It's beyond me how you can count 395.

I am almost finished compiling the debian 10 (buster) arm for rpi distro. I am a mozilla developer who builds mozilla directly from source on all platforms and like I said, I never worked with debian or any other Linux distro source packaging system. I read the doc I posted today and it became pretty clear how to proceed. I think this was all assumed.

When I verify this build has succeeded, I intend to document this process for others. Note, this is a mozilla bug that I filed so my context was not in the debian source build/packaging world. So from the start, I think there was a giant misconception here.

Anyway, I greatly appreciate your help. I should soon have a Debian patched arm build of firefox-esr-68.2.0 completed and successful. I can take it from there.

Again thanks for the help. It really is appreciated.

Peace

Attached image success.png
Attached image pi-ss.png

To Summarize

  1. I installed Debian 10 (buster) x86_64 to a VM
  2. I then installed the Raspberry Pi distribution of buster
  3. Using chroot, I then installed via apt
    a. Firefox build dependencies
    b. Firefox Debian source distribution
  4. Then built the Debian cross compiled source for arm pi
  5. Verified on a pi system

This overall, is a baroque process which I will document in detail step by step. Also using the existing outdated documentation it became very confusing. For example using crosstool-ng is unnecessary. Also, installing mozilla build dependencies using ./mach bootstrap was also unnecessary as the correct toolchain can be installed via apt.

I'm glad you've made it, still it's kind of amusing to see the host and target both being arm, despite that you cross compiled the binary. You could propably relax the cflags a bit, those linking errors targeted by disabling schedule-insns were due to a bug somewhere in <gcc-6.4.0 I believe. Still having these in the setup might be a bug at debian.

Attached image independent.png

Interesting, I was able to cross compile for raspi from an independent mercurial cloned FIREFOX_68_2_0esr_RELEASE with only two minor patches and a fairly simple .mozconfig file independent of the apt Debian source release. This is very good. Makes the process a lot easier for moz developers IMO.

Attached image ff91-raspi.png

Firefox91.4.0-esr running on Raspberry Pi.

Debian 10 Buster builds posted here: https://www.mozdevgroup.com/dropbox/firefox/91/raspi/

Summary: Cross Compiling Firefox 60 Beta for ARM Raspberry Pi → Cross Compiling Firefox Raspberry Pi
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: