How to compile iperf3 for Android

Recife, Pernambuco, Brazil

First things first

In order to get iperf3 compiled for Android you'll need:

Android Toolchain

Compiling for Android? We're gonna need an Android Toolchain! That's why we have just downloaded the Android NDK. So let's make a toolchain available.

  • — toolchain: the name of the toolchain you're making. Android NDK comes with some toolchains. To check which ones are available go to the folder toolchains under your Android NDK location
  • — arch: name of the processor architecture you're building to, in this case we're using arm as the majority of Android devices run on this architecture
  • — install-dir: this is the directory where the toolchain will be installed
  • — platform: as in Android projects, this is the Android API version you're building to
  • — force: this parameter ensure that you're doing a fresh install. If there's any file in the install-dir related to the toolchain, it'll be erased and new ones will be created

Getting there!

Once you have the toolchain installed it's time to pay iperf3 some attention.

  • — host: system we're compiling to. In this case we're using arm-none-eabi that abstracts processor vendors and customisation, so it "should run" on any arm based device
  • CXX: C++ compiler
  • CXXFLAGS: flags for C++ compiler
  • CC: C compiler
  • CFLAGS: flags for C compiler
  • AR: archiver
  • RANLIB: indexer
  • — prefix: directory where iperf3 will be installed

Make it!

Final step is to make it:

This is it

That's all! After finishing building you can use the iperf3 executable in your Android devices via adb or in your application.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store