Pages

Iperf for ARM: cross-compile

What is Iperf? 
"Iperf was developed by NLANR/DAST as a modern alternative for measuring maximum TCP and UDP bandwidth performance. Iperf allows the tuning of various parameters and UDP characteristics. Iperf reports bandwidth, delay jitter, datagram loss." [1] 

Download Iperf 2.x
Iperf 2.x is hosted in source forge server. The latest stable Iperf 2.x version can be downloaded from here

Compile Iperf for your ARM device
In this example I have used the Iperf version 2.0.5 and the Sourcery G++ Lite 2010q1-188 toolchain [2]

1. Setting up compiler variables
$ export CROSS_COMPILE=arm-none-linux-gnueabi-
$ export CC=${CROSS_COMPILE}gcc
$ export CPP=${CROSS_COMPILE}cpp
$ export CXX=${CROSS_COMPILE}g++
$ export LD=${CROSS_COMPILE}ld
$ export AR=${CROSS_COMPILE}ar
2. Start Iperf configuration
$ configure --build=arm-none-linux-gnueabi \
            --host=armv9-none-linux-gnueabi
3. Compile Iperf tool statically
$ make CFLAGS=-static CXXFLAGS=-static
4. The Iperf executable binary is located at src folder of the root compilation path. The following is an example of the output when the ARM device is acting as a server (This tutorial doesn't cover Iperf measurement process):
bash-4.0# ./iperf -s -w 2M -i 1
-----------------------------------------------------
Server listening on TCP port 5001
TCP window size:  256 KByte (WARNING: requested 2.00 MByte)
-----------------------------------------------------
[  4] local 128.247.75.107 port 5001 connected with 128.247.75.64 port 48647
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0- 1.0 sec  11.0 MBytes  92.0 Mbits/sec
[  4]  1.0- 2.0 sec  11.2 MBytes  94.0 Mbits/sec
[  4]  2.0- 3.0 sec  11.2 MBytes  94.1 Mbits/sec
[  4]  3.0- 4.0 sec  11.2 MBytes  94.1 Mbits/sec
[  4]  4.0- 5.0 sec  11.2 MBytes  93.9 Mbits/sec
[  4]  5.0- 6.0 sec  11.2 MBytes  94.2 Mbits/sec
[  4]  6.0- 7.0 sec  8.42 MBytes  70.7 Mbits/sec
[  4]  7.0- 8.0 sec  11.2 MBytes  93.6 Mbits/sec
[  4]  8.0- 9.0 sec  11.2 MBytes  94.1 Mbits/sec
[  4]  9.0-10.0 sec  11.2 MBytes  94.0 Mbits/sec
[  4]  0.0-10.0 sec   109 MBytes  91.5 Mbits/sec
Troubleshooting
If a undefined reference to 'rpl_malloc' problem occurs during the compilation process you can do the following as mentioned in this forum thread:
$ export ac_cv_func_malloc_0_nonnull=yes
 Note: Preferable to start a clean build after setting up this variable to avoid further errors.


[1] http://sourceforge.net/projects/iperf/
[2] https://sourcery.mentor.com/sgpp/lite/arm/portal/release1294

5 comments:

  1. Hi, I followed the steps, configured and made "iperf3", but get this error:

    iperf-master/src$ ./iperf3 -s
    /lib/ld-linux.so.3: No such file or directory
    iperf-master/src$ file iperf3
    iperf3: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.16, BuildID[sha1]=14e8f0fadbba0bb786975ddf28e3d3b6d8ca79b5, not stripped
    iperf-master/src$ ls ~/Downloads/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabi/libc/lib/ld-linux*
    /Downloads/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabi/libc/lib/ld-linux.so.3

    This tutorial compiles iperf tool statically, right? Why so I get a dynamically linked executable? Whatś worse, it complains the missing of an existing library.

    Any clue?

    ReplyDelete
    Replies
    1. Solved. Some lib is missing in my system.
      do "sudo apt install glibc-*" to install the lids. Now it is working.

      Delete
    2. Solved!
      the problem is that the iperf3 is [Requesting program interpreter: /lib/ld-linux.so.3]
      Linking the requested library in the cross compiling tool-chain to the requested location solved it.

      Delete
  2. Still, how to statically compile iperf??

    ReplyDelete
    Replies
    1. --enable-static --disable-shared worked for me

      Delete