Difference between revisions of "Porting/Tor Browser"

From RCS Wiki
Jump to navigation Jump to search
(Add suggested workarounds from Mozilla bug)
(ESR 60 now works properly)
Line 1: Line 1:
 
Early efforts to port Tor Browser to POWER are underway.  The primary challenge is that Tor Browser uses an unusual build system (rbm) in order to ensure reproducible builds.  While Tor's configuration of rbm can cross-compile for Windows and macOS targets, it is not configured out of the box to cross-compile for GNU/Linux targets.  As a result, our early efforts are focused on modifying Tor's rbm configuration to support cross-compiling for non-x86 GNU/Linux targets; it is expected that this will be useful not only for POWER but also for targets like ARM.
 
Early efforts to port Tor Browser to POWER are underway.  The primary challenge is that Tor Browser uses an unusual build system (rbm) in order to ensure reproducible builds.  While Tor's configuration of rbm can cross-compile for Windows and macOS targets, it is not configured out of the box to cross-compile for GNU/Linux targets.  As a result, our early efforts are focused on modifying Tor's rbm configuration to support cross-compiling for non-x86 GNU/Linux targets; it is expected that this will be useful not only for POWER but also for targets like ARM.
  
Current source code is at:
+
Current source code is at: https://notabug.org/JeremyRand/tor-browser-build/src/armhf-esr60 (<code>armhf-esr60</code> branch)
 
 
* ESR 52 version (more stuff works; outdated; only useful for reference purposes): https://notabug.org/JeremyRand/tor-browser-build/src/armhf (<code>armhf</code> branch).
 
* ESR 60 version (less stuff works; more up to date; development effort should be targeted here): https://notabug.org/JeremyRand/tor-browser-build/src/armhf-esr60 (<code>armhf-esr60</code> branch)
 
  
 
If you're interested in joining the effort, talk to Jeremy_Rand or Jeremy_Rand_Talos in #talos-workstation.
 
If you're interested in joining the effort, talk to Jeremy_Rand or Jeremy_Rand_Talos in #talos-workstation.
  
 
== Build instructions ==
 
== Build instructions ==
 
=== ESR 52 ===
 
 
<code>./rbm/rbm build firefox --target release --target torbrowser-linux-arm</code>
 
 
=== ESR 60 ===
 
  
 
<code>./rbm/rbm build firefox --target nightly --target torbrowser-linux-arm</code>
 
<code>./rbm/rbm build firefox --target nightly --target torbrowser-linux-arm</code>
Line 22: Line 13:
 
=== Unfixed ===
 
=== Unfixed ===
  
==== Missing libssp.so.0 (affects both ESR 52 and ESR 60) ====
+
==== Missing libssp.so.0 ====
  
 
<code>./firefox: error while loading shared libraries: libssp.so.0: cannot open shared object file: No such file or directory</code>
 
<code>./firefox: error while loading shared libraries: libssp.so.0: cannot open shared object file: No such file or directory</code>
Line 28: Line 19:
 
* Workaround: add the <code>Browser</code> directory to your <code>LD_LIBRARY_PATH</code> in order for Tor Browser to find the library.
 
* Workaround: add the <code>Browser</code> directory to your <code>LD_LIBRARY_PATH</code> in order for Tor Browser to find the library.
 
* This should be fixable by porting the non-Firefox projects (one of which is responsible for setting the <code>LD_LIBRARY_PATH</code>).
 
* This should be fixable by porting the non-Firefox projects (one of which is responsible for setting the <code>LD_LIBRARY_PATH</code>).
 
==== Segfault immediately on startup (only affects ESR 60) ====
 
 
gdb output:
 
 
<nowiki>Starting program: /home/user/Downloads/tor-browser-arm/2018-10-21/Browser/firefox.real
 
[Thread debugging using libthread_db enabled]
 
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
 
 
Program received signal SIGSEGV, Segmentation fault.
 
0xb201eaaa in ?? ()
 
from /home/user/Downloads/tor-browser-arm/2018-10-21/Browser/libxul.so
 
(gdb) bt
 
#0 0xb201eaaa in ?? ()
 
from /home/user/Downloads/tor-browser-arm/2018-10-21/Browser/libxul.so
 
#1 0xb1f66000 in ?? ()
 
Backtrace stopped: previous frame identical to this frame (corrupt stack?)</nowiki>
 
 
* Not clear what's causing this.
 
* A very similar bug occurs with Debian's official <code>firefox-esr</code> version <code>60.2.2esr-1~deb9u1</code> package (<code>SIGSEGV</code> on startup, backtrace shows 2 addresses in <code>libxul.so</code> followed by a corrupt stack).
 
* Possibly related bugs:
 
** https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=902231
 
** https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/1711337
 
** https://bugzilla.mozilla.org/show_bug.cgi?id=1452128
 
*** Suggested workarounds (any, not all):
 
**** Revert https://bugzilla.mozilla.org/show_bug.cgi?id=1238661 and build with gcc-7.3/glibc-2.25/binutils-2.29.1
 
**** Build with Clang
 
**** <code>--disable-stylo</code> (seems to be what Arch Linux ARM does; Mozilla doesn't recommend it)
 
  
 
=== Fixed ===
 
=== Fixed ===
Line 66: Line 29:
 
** Workaround: copy <code>libssp.so*</code> from the <code>gcc-cross</code> output tar into the <code>Browser</code> directory of the <code>firefox</code> output.
 
** Workaround: copy <code>libssp.so*</code> from the <code>gcc-cross</code> output tar into the <code>Browser</code> directory of the <code>firefox</code> output.
 
** Fixed in the Firefox rbm build script as of 2018 Oct 10.
 
** Fixed in the Firefox rbm build script as of 2018 Oct 10.
 +
* Segfault immediately on startup in <code>libxul.so</code>
 +
** Only affects ESR 60; ESR 52 unaffected
 +
** Fixed by doing all of these:
 +
*** Upgrade to gcc 7.3.0 / binutils 2.29.1
 +
*** Build with <code>ac_add_options --disable-elf-hack</code>
 +
*** Build with <code>ac_add_options --disable-stylo</code>
 +
** Possibly related bugs:
 +
*** https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=902231
 +
*** https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/1711337
 +
*** https://bugzilla.mozilla.org/show_bug.cgi?id=1452128
  
 
== Task list ==
 
== Task list ==
  
* Finish porting this to Firefox ESR 60.
+
* (DONE!)  Finish porting this to Firefox ESR 60.
 
* Build the projects besides Firefox.
 
* Build the projects besides Firefox.
 
* Generalize the GNU/Linux cross-compiling changes so that they work on target arches besides armhf.  (ppc64be, ppc64le, and aarch64 are all likely to be useful.)
 
* Generalize the GNU/Linux cross-compiling changes so that they work on target arches besides armhf.  (ppc64be, ppc64le, and aarch64 are all likely to be useful.)

Revision as of 04:03, 8 January 2019

Early efforts to port Tor Browser to POWER are underway. The primary challenge is that Tor Browser uses an unusual build system (rbm) in order to ensure reproducible builds. While Tor's configuration of rbm can cross-compile for Windows and macOS targets, it is not configured out of the box to cross-compile for GNU/Linux targets. As a result, our early efforts are focused on modifying Tor's rbm configuration to support cross-compiling for non-x86 GNU/Linux targets; it is expected that this will be useful not only for POWER but also for targets like ARM.

Current source code is at: https://notabug.org/JeremyRand/tor-browser-build/src/armhf-esr60 (armhf-esr60 branch)

If you're interested in joining the effort, talk to Jeremy_Rand or Jeremy_Rand_Talos in #talos-workstation.

Build instructions

./rbm/rbm build firefox --target nightly --target torbrowser-linux-arm

Errors / Troubleshooting

Unfixed

Missing libssp.so.0

./firefox: error while loading shared libraries: libssp.so.0: cannot open shared object file: No such file or directory

  • Workaround: add the Browser directory to your LD_LIBRARY_PATH in order for Tor Browser to find the library.
  • This should be fixable by porting the non-Firefox projects (one of which is responsible for setting the LD_LIBRARY_PATH).

Fixed

  • /var/tmp/build/firefox-f8f42fea2af3/js/src/jsnativestack.cpp:69:31: error: 'syscall' was not declared in this scope
    • This is because jsnativestack.cpp forgot to #include <unistd.h>. This is fixed in all releases of Tor Browser based on ESR 60. Since we're still using ESR 52 for now, I fixed it by applying a short patch to add the missing include.
  • /var/tmp/build/firefox-f8f42fea2af3/js/src/jsnativestack.cpp:77:27: error: 'getpid' was not declared in this scope
    • Also caused by missing #include <unistd.h> in jsnativestack.cpp; same fixes as above.
  • ./firefox: error while loading shared libraries: libssp.so.0: cannot open shared object file: No such file or directory
    • Workaround: copy libssp.so* from the gcc-cross output tar into the Browser directory of the firefox output.
    • Fixed in the Firefox rbm build script as of 2018 Oct 10.
  • Segfault immediately on startup in libxul.so

Task list

  • (DONE!) Finish porting this to Firefox ESR 60.
  • Build the projects besides Firefox.
  • Generalize the GNU/Linux cross-compiling changes so that they work on target arches besides armhf. (ppc64be, ppc64le, and aarch64 are all likely to be useful.)

Upstream Tickets