Opened 14 months ago

Last modified 3 weeks ago

#28766 assigned defect

Tor Build for Android

Reported by: sisbell Owned by: sisbell
Priority: Medium Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: tbb-mobile, tbb-rbm, tbb-parity, TorBrowserTeam202001
Cc: sisbell, gk, hans@…, tbb-team Actual Points:
Parent ID: #28704 Points: 1
Reviewer: Sponsor:

Description


Child Tickets

Attachments (1)

0001-move-Android-build-setup-into-enable-android-flag.patch (2.3 KB) - added by eighthave 4 months ago.

Download all attachments as: .zip

Change History (15)

comment:1 Changed 14 months ago by sisbell

Tor needs rust 1.28. However for android we are using 1.26.1. How should we handle this?

comment:2 Changed 14 months ago by boklm

For the linux nightly build, we build rust 1.28.0. Maybe we can do the same.

We can also start by building Tor without rust (like on Windows and macOS).

comment:3 in reply to:  2 Changed 14 months ago by gk

Replying to boklm:

For the linux nightly build, we build rust 1.28.0. Maybe we can do the same.

We can also start by building Tor without rust (like on Windows and macOS).

Yes, let's start without building Tor on Android with the newer Rust.

comment:4 Changed 11 months ago by gk

Keywords: tbb-parity added

tbb-parity items.

comment:5 Changed 4 months ago by eighthave

Cc: hans@… added

comment:6 Changed 4 months ago by eighthave

I just added a patch to move key Android configuration to ./configure --enable-android so that it is shared across all the builds. There is more stuff that can be moved there, that is not yet:

  • Android NDK version detection and enforcement (e.g. >= r19 or only exactly r20)
  • CFLAGS and LDFLAGS to find parity with Android NDK builds done with ndk-build, which automatically sets things there.
  • Perhaps the state of --disable-linker-hardening and --disable-gcc-hardening could also be maintained there, since we're all building with the Android NDK's clang.

The patch is attached, here's the diff:

diff --git a/configure.ac b/configure.ac
index a639ffaf3..afee6940c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,27 @@ else
             [Defined if we're building with OpenSSL or LibreSSL])
 fi
 
+dnl Enable Android only features.
+AC_ARG_ENABLE(android,
+     AS_HELP_STRING(--enable-android, [build with Android features enabled]))
+AM_CONDITIONAL([USE_ANDROID], [test "x$enable_android" = "xyes"])
+
+if test "x$enable_android" = "xyes"; then
+  AC_DEFINE([USE_ANDROID], [1], [Compile with Android specific features enabled])
+
+  dnl Check if the Android log library is available.
+  AC_CHECK_HEADERS([android/log.h])
+  AC_SEARCH_LIBS(__android_log_write, [log])
+
+  asciidoc=false
+  enable_html_manual=no
+  enable_manpage=no
+  enable_pic=yes
+  enable_system_torrc=no
+  enable_tool_name_check=no
+  have_systemd=no
+fi
+
 if test "$enable_static_tor" = "yes"; then
   enable_static_libevent="yes";
   enable_static_openssl="yes";
@@ -117,7 +138,7 @@ AC_ARG_ENABLE(asciidoc,
         "yes") asciidoc=true ;;
         "no")  asciidoc=false ;;
         *) AC_MSG_ERROR(bad value for --disable-asciidoc) ;;
-      esac], [asciidoc=true])
+      esac], [test "x$asciidoc" = "xtrue" && asciidoc=true])
 
 # systemd notify support
 AC_ARG_ENABLE(systemd,
@@ -227,20 +248,6 @@ if test x$enable_event_tracing_debug = xyes; then
   AC_DEFINE([TOR_EVENT_TRACING_ENABLED], [1], [Compile the event tracing instrumentation])
 fi
 
-dnl Enable Android only features.
-AC_ARG_ENABLE(android,
-     AS_HELP_STRING(--enable-android, [build with Android features enabled]))
-AM_CONDITIONAL([USE_ANDROID], [test "x$enable_android" = "xyes"])
-
-if test "x$enable_android" = "xyes"; then
-  AC_DEFINE([USE_ANDROID], [1], [Compile with Android specific features enabled])
-
-  dnl Check if the Android log library is available.
-  AC_CHECK_HEADERS([android/log.h])
-  AC_SEARCH_LIBS(__android_log_write, [log])
-
-fi
-
 dnl ---
 dnl Tor modules options. These options are namespaced with --disable-module-XXX
 dnl ---
-- 
2.20.1

comment:7 Changed 3 months ago by sysrqb

Points: 0.25

comment:8 Changed 3 months ago by gk

Points: 0.251

comment:9 Changed 3 months ago by sisbell

Do we know if this patch works with Android NDK 17b?

comment:10 Changed 3 months ago by eighthave

That configure.ac patch is now here for #31882:

I just got the gitlab-ci job for r17b working, so I can confirm that tor with my changes builds with NDK r17b, but this job does not include lzma or zstd.

comment:11 in reply to:  10 Changed 3 months ago by sisbell

Replying to eighthave:

That configure.ac patch is now here for #31882:

I just got the gitlab-ci job for r17b working, so I can confirm that tor with my changes builds with NDK r17b, but this job does not include lzma or zstd.

I'm assuming we need to open new tickets for building these libraries? Or is this something we can live without for now?

comment:12 Changed 2 months ago by sysrqb

Keywords: TorBrowserTeam201912 added; TorBrowserTeam201812 removed
Owner: changed from tbb-team to sisbell
Status: newassigned

comment:13 Changed 2 months ago by sysrqb

Cc: tbb-team added

comment:14 Changed 3 weeks ago by sysrqb

Keywords: TorBrowserTeam202001 added; TorBrowserTeam201912 removed
Note: See TracTickets for help on using tickets.