Difference between revisions of "Porting/Tor Browser"

From RCS Wiki
Jump to navigation Jump to search
(Add build instructions, list of current known errors, and task list)
(Mark startup script errors as fixed)
(34 intermediate revisions by 2 users not shown)
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 https://notabug.org/JeremyRand/tor-browser-build/src/armhf If you're interested in joining the effort, talk to Jeremy_Rand or Jeremy_Rand_Talos in #talos-workstation.
+
Current source code is at: 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.
  
 
== Build instructions ==
 
== Build instructions ==
  
<code>./rbm/rbm build firefox --target release --target torbrowser-linux-arm</code>
+
<nowiki>make nightly-linux-arm</nowiki>
 +
 
 +
== Errors / Troubleshooting ==
 +
 
 +
=== Unfixed ===
 +
 
 +
==== Missing Pluggable Transports ====
 +
 
 +
The <code>fteproxy</code> and <code>snowflake</code> pluggable transports are disabled for non-x86 GNU/Linux targets.  These pluggable transports are already non-mandatory for building Tor Browser, and getting them to build for cross-compiled GNU/Linux targets was deemed to be too much of a time sink.
 +
 
 +
=== Fixed ===
 +
 
 +
==== syscall not declared ====
 +
 
 +
<code>/var/tmp/build/firefox-f8f42fea2af3/js/src/jsnativestack.cpp:69:31: error: 'syscall' was not declared in this scope</code>
 +
 
 +
* This is because <code>jsnativestack.cpp</code> forgot to <code>#include <unistd.h></code>.
 +
* This is fixed in all releases of Tor Browser based on ESR 60.
 +
* For ESR 52, I fixed it by applying a short patch to add the missing include.
 +
 
 +
==== getpid not declared ====
 +
 
 +
<code>/var/tmp/build/firefox-f8f42fea2af3/js/src/jsnativestack.cpp:77:27: error: 'getpid' was not declared in this scope</code>
 +
 
 +
* Also caused by missing <code>#include <unistd.h></code> in <code>jsnativestack.cpp</code>
 +
* Same fixes as above.
 +
 
 +
==== Missing libssp.so.0 (file is actually gone) ====
 +
 
 +
<code>./firefox: error while loading shared libraries: libssp.so.0: cannot open shared object file: No such file or directory</code>
 +
 
 +
* 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.
 +
 
 +
==== Segfault ====
 +
 
 +
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
 +
 
 +
==== Missing libssp.so.0 (file is present but Tor Browser doesn't see it) ====
 +
 
 +
<code>./firefox: error while loading shared libraries: libssp.so.0: cannot open shared object file: No such file or directory</code>
 +
 
 +
* Workaround: add the <code>Browser</code> directory to your <code>LD_LIBRARY_PATH</code> in order for Tor Browser to find the library.
 +
* Fixed by editing the startup shell script.
  
== Build errors ==
+
==== SSE2 not detected ====
  
* <code>/var/tmp/build/firefox-f8f42fea2af3/js/src/jsnativestack.cpp:69:31: error: 'syscall' was not declared in this scope</code>
+
* Workaround: just manually comment out the SSE2 check in the shell script.
** This is because <code>jsnativestack.cpp</code> forgot to <code>#include <unistd.h></code>.  This is fixed in all releases of Tor Browser based on ESR 60.  It should also be fixable in ESR 52 by applying a 1-line patch to add the missing include.
+
* Fixed by editing the startup shell script.
* <code>/var/tmp/build/firefox-f8f42fea2af3/js/src/jsnativestack.cpp:77:27: error: 'getpid' was not declared in this scope</code>
 
** Also caused by missing <code>#include <unistd.h></code> in <code>jsnativestack.cpp</code>; same fixes as above.
 
  
 
== Task list ==
 
== Task list ==
  
* Port this to newer versions of Tor Browser that use Firefox ESR 60.  This will require making Rust work.
+
* (DONE!)  Finish porting this to Firefox ESR 60.
* Build the projects besides Firefox.
+
* (DONE!)  Build openssl without errors.
 +
* (DONE!)  Build libevent without errors.
 +
* (DONE!)  Build tor without errors.
 +
* (DONE!)  Build firefox-langpacks without errors.
 +
* (DONE!)  Build tor-launcher without errors.
 +
* (DONE!)  Build torbutton without errors.
 +
* (DONE!)  Build python without errors.
 +
* (DONE!)  Build https-everywhere without errors.
 +
* (DONE!) Build fonts without errors.
 +
* (DONE!)  Build meek without errors.
 +
* (DONE!)  Build obfs4 without errors.
 +
* (DONE!)  Build tor-browser without errors.
 +
* (DONE!)  Build release without errors.
 +
* (DONE!)  Add linux-arm targets to Makefile.
 +
* Test the openssl, libevent, tor, firefox-langpacks, tor-launcher, torbutton, python, https-everywhere, fonts, meek, obfs4, tor-browser, and release binaries.
 +
* Re-enable the fteproxy and snowflake projects (low priority).
 +
* Fine-tune the compiler settings. (Are we inadvertently excluding some ARM devices that we want to support?  Should we enable Neon?)
 
* 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.)
 +
 +
== Upstream Tickets ==
 +
 +
* [http://ea5faa5po25cf7fb.onion/projects/tor/ticket/12631 Tor Browser for ARM architecture] (development effort is currently focused here)
 +
* [http://ea5faa5po25cf7fb.onion/projects/tor/ticket/28326 Tor Browser for PPC64LE]
 +
 +
[[Category:Ports]]

Revision as of 04:20, 23 March 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

make nightly-linux-arm

Errors / Troubleshooting

Unfixed

Missing Pluggable Transports

The fteproxy and snowflake pluggable transports are disabled for non-x86 GNU/Linux targets. These pluggable transports are already non-mandatory for building Tor Browser, and getting them to build for cross-compiled GNU/Linux targets was deemed to be too much of a time sink.

Fixed

syscall not declared

/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.
  • For ESR 52, I fixed it by applying a short patch to add the missing include.

getpid not declared

/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.

Missing libssp.so.0 (file is actually gone)

./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

Segfault immediately on startup in libxul.so

Missing libssp.so.0 (file is present but Tor Browser doesn't see it)

./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.
  • Fixed by editing the startup shell script.

SSE2 not detected

  • Workaround: just manually comment out the SSE2 check in the shell script.
  • Fixed by editing the startup shell script.

Task list

  • (DONE!) Finish porting this to Firefox ESR 60.
  • (DONE!) Build openssl without errors.
  • (DONE!) Build libevent without errors.
  • (DONE!) Build tor without errors.
  • (DONE!) Build firefox-langpacks without errors.
  • (DONE!) Build tor-launcher without errors.
  • (DONE!) Build torbutton without errors.
  • (DONE!) Build python without errors.
  • (DONE!) Build https-everywhere without errors.
  • (DONE!) Build fonts without errors.
  • (DONE!) Build meek without errors.
  • (DONE!) Build obfs4 without errors.
  • (DONE!) Build tor-browser without errors.
  • (DONE!) Build release without errors.
  • (DONE!) Add linux-arm targets to Makefile.
  • Test the openssl, libevent, tor, firefox-langpacks, tor-launcher, torbutton, python, https-everywhere, fonts, meek, obfs4, tor-browser, and release binaries.
  • Re-enable the fteproxy and snowflake projects (low priority).
  • Fine-tune the compiler settings. (Are we inadvertently excluding some ARM devices that we want to support? Should we enable Neon?)
  • 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