Monday, 25 August 2014

How to compile iperf3 for Windows

I was able to compile the binary for iperf3.0.6 code-base. The procedure is almost same as described in above blog with few changes.

1) Install Cygwin on windows : Download from

2) Run setup-x86.exe -> On the page of package selection screen click on 'Devel' so that 'Default' changes to 'Install' . We need development tools for compiling the code.

3) Download iper3.0.6 from

4) Copy it in c:\cygwin directory , unzip the iperf folder and copy the main directory to this (c:\cygwin folder)

5) Open the cygwin shell prompt, go to c:\cygwin\iperf-3-0.6 directory

6) ./configure  -> it should work fine

6) make
Making all in src
make[1]: Entering directory '/cygdrive/c/cygwin/iperf-3.0.6/iperf-3.0.6/src'
make  all-am
make[2]: Entering directory '/cygdrive/c/cygwin/iperf-3.0.6/iperf-3.0.6/src'
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT cjson.lo -MD -MP -MF .deps/cjson.Tpo -c -o cjson.lo cjson.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT cjson.lo -MD -MP -MF .deps/cjson.Tpo -c cjson.c  -DDLL_EXPORT -DPIC -o .libs/cjson.o
cjson.c: In function 'cJSON_strcasecmp':
cjson.c:58:2: warning: array subscript has type 'char' [-Wchar-subscripts]
  for ( ; tolower(*s1) == tolower(*s2); ++s1, ++s2)
cjson.c:58:2: warning: array subscript has type 'char' [-Wchar-subscripts]
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT cjson.lo -MD -MP -MF .deps/cjson.Tpo -c cjson.c -o cjson.o >/dev/null 2>&1
mv -f .deps/cjson.Tpo .deps/cjson.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT iperf_api.lo -MD -MP -MF .deps/iperf_api.Tpo -c -o iperf_api.lo iperf_api.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_api.lo -MD -MP -MF .deps/iperf_api.Tpo -c iperf_api.c  -DDLL_EXPORT -DPIC -o .libs/iperf_api.o
In file included from iperf_api.c:40:0:
iperf_api.h:227:5: error: conflicting types for 'iprintf'
 int iprintf(struct iperf_test *test, const char *format, ...) __attribute__ ((format(printf,2,3)));
In file included from /usr/include/stdio.h:29:0,
                 from iperf_api.c:13:
/usr/include/stdio.h:259:5: note: previous declaration of 'iprintf' was here
 int _EXFUN(iprintf, (const char *, ...)
iperf_api.c:2583:1: error: conflicting types for 'iprintf'
 iprintf(struct iperf_test *test, const char* format, ...)
In file included from /usr/include/stdio.h:29:0,
                 from iperf_api.c:13:
/usr/include/stdio.h:259:5: note: previous declaration of 'iprintf' was here
 int _EXFUN(iprintf, (const char *, ...)
Makefile:838: recipe for target 'iperf_api.lo' failed
make[2]: *** [iperf_api.lo] Error 1
make[2]: Leaving directory '/cygdrive/c/cygwin/iperf-3.0.6/iperf-3.0.6/src'
Makefile:615: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/cygdrive/c/cygwin/iperf-3.0.6/iperf-3.0.6/src'
Makefile:369: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1


Got above error , looks like iprintf is defined at two places at /usr/include/stdio.h
and at iperf_api.c

Resolution :
search for declaration of iprintf in iperf_api.c files and replace it with another function name iiprintf. I have used Editplus for editing the files. Now search for the the same function iprintf in all files and replace it with iiprintf almost 3 files and 55 places need to be changed.

or use below command (not tested but got from above ref link)

cd ./src
find ./ -iname "*.[ch]" |xargs -n1 sed -i s'#iprintf#newprintf#g'

7) Again run make , it should pass this time

8) make install

9) copy /usr/local/bin/iperf3.exe -> to another folder where all files will be kept , lets name it as  "iperf306"

10) Now copy below files from C:\cygwin\bin into iperf306
  • cygwin1.dll
  • cyggcc_s-1.dll
  • cygstdc++-6.dll
11) copy the whole folder iperf306 to another pc and try running it

12) if while starting server or client you get below error , means ipv6 is not supported on the Windows machine.

 iperf3: error - unable to start listener for connections: Protocol not available

Try running with -4 option

iperf3.exe -4 -s

iperf3,exe -4 -c

13)  Now server is starting fine but below error came:

iperf3: error - unable to create a new stream: No such file or directory

Still trying to understand the issue , meanwhile if anyone can help , will be just GREAT  !

Will update if found solution.

Happy trying !

Updated : Sept 15, 2015

As per suggestions from Daniel in comments I did below changes and compiled the code again. Now it is working fine.


char template[] = "/tmp/iperf3.XXXXXX";


char template[] = "./iperf3.XXXXXX";

Thanks Daniel and Rion for your comments.


  1. grep source for /tmp/iperf3.XXXXXX and change the name

    1. Not working. It appears that the iperf3 is working inside Cygwin directory on Windows, but if I copy files and move out of Cygwin, the above error comes. May be some of the dependency files are missing but still not able to solve it.

    2. I change code to => char template[] = "./iperf3.XXXXXX";
      And this issue has gone.

    3. Thanks Daniel. Made below changes and now it is working fine.


      char template[] = "/tmp/iperf3.XXXXXX";


      char template[] = "./iperf3.XXXXXX";

  2. nice write up - works on 3.0.9 as well.

  3. works on 3.0.11 as well, but just noticed that if you try and the -J on server or client it crashes here is stackdump

    Exception: STATUS_ACCESS_VIOLATION at eip=6112D943
    eax=00000000 ebx=20051D10 ecx=00000000 edx=00000000 esi=00000000 edi=00000000
    ebp=0022AB28 esp=0022AB24 program=C:\iperf3_11\iperf3.exe, pid 4740, thread main
    cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
    Stack trace:
    Frame Function Args
    0022AB28 6112D943 (00000000, 0022AC61, 00000001, 0040C8C8)
    0022AC08 0040A310 (00000003, 0022AC2C, 20028290, 00000000)
    0022ACF8 610082DE (00000000, 0022CD84, 610073E0, 00000000)
    0022CD58 61006044 (0022CD84, 00000000, 00000000, 00000000)
    0022FF28 610061B6 (610073E0, 00000000, 00000002, 00000003)
    0022FF48 61007164 (0040ECF0, 00000000, 00000001, 00000000)
    0022FF68 0040E4B2 (0040ECF0, 0022FFA8, 755EB9D2, 002E36B4)
    0022FF88 00401015 (7FFD9000, 0022FFD4, 772537EB, 7FFD9000)
    0022FF94 75B4EE1C (7FFD9000, 741F1C53, 00000000, 00000000)
    0022FFD4 772537EB (00401000, 7FFD9000, 00000000, 00000000)
    0022FFEC 772537BE (00401000, 7FFD9000, 00000000, 78746341)
    End of stack trace

    Any ideas?

  4. It runs out of the /src directory. If the .libs subdirectory is not present, it loads and exits. This seems to indicate that it is looking for something in that directory like an object file.

  5. 1. copy cygncursesw-10.dll cygintl-8.dll cygiconv-2.dll cygreadline7.dll from c:\cygwin directory to c:\iperf3_11
    2. copy uname.exe from c:\cygwin directory to c:\windows\system32
    3. make c:\tmp directory
    4. make c:\bin directory, copy sh.exe from c:\cygwin directory

    then, you can run iperf.exe -s -J without errors.

    any better suggestions?

  6. Resolution :
    search for declaration of iprintf in iperf_api.c files and replace it with another function name iiprintf. I have used Editplus for editing the files. Now search for the the same function iprintf in all files and replace it with iiprintf almost 3 files and 55 places need to be changed.


    perhaps this should be better clearified, as non coder ;) i was just happy to find this kind of step by step instruction , normally im not too dumb to understand such kind of instructions.

    so i felt in the same error, and started to look for "iprintf" in file "iperf_api.c" , so i replaced the string "iprintf" to "iiprintf" , and then replaced in /src every file containing "iprintf" to "iiprintf" , so my result via mass replacing shows me :

    C:\cygwin\iperf-3.0.11\src\iperf_api.c, 44
    C:\cygwin\iperf-3.0.11\src\iperf_api.c.bak, 44
    C:\cygwin\iperf-3.0.11\src\iperf_api.h, 1
    C:\cygwin\iperf-3.0.11\src\iperf_client_api.c, 5
    C:\cygwin\iperf-3.0.11\src\iperf_server_api.c, 6
    100 items replaced in 5 files.

    hope thats ok ?

  7. update: seems this was a bad idea , causing output error to be the same and shows me something like this "iiiprintf("

    perhaps someone can explain so dumb guy the solution ;-)

    so again : where/what to replace exactly ?

  8. Hi again, i started from scratch and used instead of mass-replacement just the "find" command to replace the iprintf strings, the error is gone, but make and make install result in a binary .exe at all but getting error when trying to start.

    during "make" lots of strange errors came, not sure if this works properly for 3.0.11 , perhaps someone who can crosscheck with 3.0.11 can reply with the steps he done so far,


  9. Am little busy in other things, if you want to use compiled binary of 3.0.7, you can join!forum/embeddedsystemtesting

    I have uploaded the files there.

    You have to make sure cyggcc_s-1.dll,cygstdc++-6.dll, cygwin1.dll and binary .exe file all are in the same folder.

  10. I'm trying to copile iperf 3.0.11 using Cygwin x64 (to build x64 version of iperf) but got 2 ./configure errrors :
    checking if gcc supports -fno-rtti -fno-exceptions... ./configure: line 8317: diff: command not found no
    nanosleep() required for timing operations.

    Of course, I've installed all "Debug" packages (including coreutils-debuginfo" but without success.
    Could you help me, please ? Thanks in advence ;)

    1. I reply to myself: error for missing diff is fixed (adding "diffutils" package) but still having error for missing nanosleep function)

    2. I didn't see anything that missing nanosleep?

      checking for library containing nanosleep... none required

    3. Sorry, it was a newbie issue, I added wrong packages to cygwin... ("debug" instead of "devel"...) and now it works like a charm, thanks !

  11. Just test on 3.1b3 and works just fine on current cygwin version, only dll needed is the cygwin1.dll

    D:\iperf3.1_b3>iperf3.exe -v
    iperf 3.1b3
    CYGWIN_NT-6.1 i5-w7 2.1.0(0.287/5/3) 2015-07-14 21:28 x86_64
    Optional features available: None

  12. instructions still work for current 3.1.4

    > iperf3.exe -v
    iperf 3.1.4
    CYGWIN_NT-6.3 i5-win 2.6.0(0.304/5/3) 2016-08-31 14:32 x86_64
    Optional features available: None


Related Posts Plugin for WordPress, Blogger...