Is this even possible? Can a Tor binary file be compiled to work on Linux, Windows, OSX, iOS, and Android? We would like to package the binary file so we can launch Tor from our application. Could we build Tor from source on a Linux computer for the different CPU architectures? Is the Tor binary all we need? We currently have the application working on a Linux computer by copy-and-pasting the Tor binary to a different folder than the one installed on the computer and launch Tor from there with a custom torrc. Is the binary reading other files on our computer to launch, or can just this one binary file be packaged and it will at least work on other Linux computers that match the same CPU architecture?

Is there official documentation about this process anywhere?

Thank you.

2 Answers 2


I don't think there is official documentation on cross-compiling tor, but it should be possible for most platforms (not sure about iOS). I don't know specifically what steps to take, but you might get ideas if you ask on #tor on the OFTC IRC channel if you don't get an answer here.

Tor by default dynamically links to other libraries such as OpenSSL and Libevent. These can be statically linked instead using the --enable-static-openssl and --enable-static-libevent options for the configure script. There will be other libraries dynamically linked as well, and you can see these by running ldd tor on the tor binary. Typically if you statically link Libevent and OpenSSL, the tor binary should run on any similar Linux systems with the same architecture, but it's not guaranteed to run on all of them.

As an example, if you download the Tor Browser for Linux, the tor-browser/Browser/TorBrowser/Tor directory contains the tor binary as well as the three libraries libcrypto.so.1.1, libevent-2.1.so.6, and libssl.so.1.1. Running ldd tor shows that it is dynamically linked to a few other standard libraries as well.

$ ldd tor
    linux-vdso.so.1 (0x00007fff809ff000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd2a7bfc000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd2a785e000)
    libevent-2.1.so.6 => /usr/lib/x86_64-linux-gnu/libevent-2.1.so.6 (0x00007fd2a760d000)
    libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fd2a7380000)
    libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fd2a6eb5000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd2a6cad000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd2a6aa9000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd2a66b8000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd2a6499000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fd2a8370000)


I'm not very familiar with other platforms as I only build tor for Linux. I'm not sure why the TBB team doesn't statically link libssl, libcrypto, and libevent on Linux, but that would be a good question to ask them on either #tor-dev IRC or the tor-dev mailing list. The geoip and geoip6 files are databases for linking relay IP addresses to approximate locations, and obfs4proxy is a binary that allows Tor users to connect to the network through bridges that support obfs4. This is a separate optional program.

OnionBrowser recently changed to use tor from the iCepa project. I think iOS is tricky because you cannot fork and run a separate process, so you need to bundle tor as a library rather than running it directly. Tor itself isn't designed this way, so iCepa's Tor.framework has done some extra stuff to make this work. As for Android, I think Briar gets their tor binary from the guardian project's Android build which originally came from Orbot. You might also want to look into how the official Tor Browser for Android bundles tor into their app (I think it's this).

  • 1
    Thank you for your response. It definitely opened up new research for us. We now found there is a --enable-static-tor option when using ./configure during building from source. But we were trying to look at other code too. Like OnionShare, which seems to be just pulling binaries from Windows/macOS Tor Browsers, along with three other files (geoip, geoip6, and obfs4proxy)? Would that mean at least on those two operating systems the Tor binary from the browser is static? And maybe the binary for the GNU/Linux Tor Browser is not static?
    – user30237
    May 10, 2020 at 6:00
  • Then for iOS, how is OnionBrowser doing it? We cannot find any included binary nor where exactly the binary is executed. Therefore how is Onion Browser connecting to the Tor network? (But of course we are new to all this so...) For Android, we found where Tor seems to be executed in Briar, but not where there is any binary. But maybe these are all static binaries for Android from the Tor Project itself?
    – user30237
    May 10, 2020 at 6:03
  • These are just "rhetorical" questions. Thinking out loud.
    – user30237
    May 10, 2020 at 6:04
  • gotoner: I added as much as I know to the post. I don't think the situation is very simple, but if no one here can help more, definitely ask the Tor devs if they have suggestions, I'm sure they'd be happy to see more apps using Tor.
    – Steve
    May 10, 2020 at 6:38
  • Thanks so much @Steve! You have been extremely helpful.
    – user30237
    May 10, 2020 at 12:42

I've used Guardian Project's compiled Tor Android binaries in my Android library named as TorAndroid. You can check it here: https://github.com/mirsamantajbakhsh/TorAndroid

If you want compiled versions for Android, just check the main repo of Guardian Project: https://github.com/guardianproject/gpmaven/tree/master/org/torproject/tor-android-binary

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy