在 Iperf3 上工作
#!/bin/sh
wget https://dl.google.com/android/repository/android-ndk-r18-linux-x86_64.zip
sudo apt-get install unzip
unzip android-ndk-r18-linux-x86_64.zip
#--arch arm or arm64 https://developer.android.com/ndk/guides/standalone_toolchain
android-ndk-r18/build/tools/make_standalone_toolchain.py --arch arm --api 26 --install-dir=my-toolchain
# Add the standalone toolchain to the search path.
export PATH=$PATH:`pwd`/my-toolchain/bin
# Tell configure what tools to use. aarch64-linux-android
target_host=arm-linux-androideabi #aarch64-linux-android or arm-linux-androideabi
export AR=$target_host-ar
export AS=$target_host-clang
export CC=$target_host-clang
export CXX=$target_host-clang++
export LD=$target_host-ld
export STRIP=$target_host-strip
# Tell configure what flags Android requires.
export CFLAGS="-fPIE -fPIC"
export LDFLAGS="-pie"
sudo apt-get install build-essential git
git clone https://github.com/esnet/iperf
cd iperf/
echo manual edit src/iperf_api.c change to char template[] = "/data/local/tmp/iperf3.XXXXXX";
#--disable-profiling or edit src/Makefile.in deleting "-pg" from iperf3_profile_CFLAGS and iperf3_profile_LDFLAGS
#./configure --host=arm-linux-androideabi CFLAGS=-static CXXFLAGS=-static --disable-profiling
#make
##iperf2
#sudo apt-get install autotools-dev
#cp /usr/share/misc/config.{sub,guess} .
#adb push src/iperf3 /data/local/tmp
#adb shell chmod 755 /data/local/tmp/iperf3
#adb shell "/data/local/tmp/iperf3 -v"