Command:
./configure --host=arm-linux-gnueabihf --prefix=/home/ec2-user/iperf_install/ CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ CFLAGS=-static CXXFLAGS=-static
main.c:62: error: undefined reference to '__gnu_mcount_nc'
main.c:124: error: undefined reference to '__gnu_mcount_nc'
main.c:131: error: undefined reference to '__gnu_mcount_nc'
cjson.c:50: error: undefined reference to '__gnu_mcount_nc'
collect2: error: ld returned 1 exit status
I am trying to compile iperf3 binary for android. I am very disappointed that there is no concrete information for compiling iperf3 binary for android. Could someone please help?
Thanks,
-Hardik
cjson.c:50: error: undefined reference to '__gnu_mcount_nc'
cjson.c:56: error: undefined reference to '__gnu_mcount_nc'
cjson.c:72: error: undefined reference to '__gnu_mcount_nc'
cjson.c:85: error: undefined reference to '__gnu_mcount_nc'
iperf3 doesn't officially support Android and we don't have the resources to take this on. So tagging as "help wanted".
We note that iperf2 officially supports Android. Perhaps that might be a more suitable platform?
I am facing the same issue, is there any suggestion for this?
I've replaced the Configure script with CMake for my purposes. I'm pretty sure I could get this compiling for Android, but currently I'm compiling for iOS.
https://github.com/palmerc/iperf
[Update]
Setting HAVE_ENDIAN 1
cmake -D ANDROID_PLATFORM=android-21 -G Ninja -D CMAKE_TOOLCHAIN_FILE=../android-ndk/android-ndk-r16b/build/cmake/android.toolchain.cmake ../iperf
cmake --build .
Worked. I also tested with -D ANDROID_ABI=arm64-v8a
If someone wants, I can submit the CMake build as a pull request
Alternatively, edit src/Makefile.in, deleting "-pg" from iperf3_profile_CFLAGS and iperf3_profile_LDFLAGS.
Here are three workarounds for this problem, in order from least effort to most effort:
At the time the linking of the iperf3 profiled executable fails, the "normal" iperf3 executable is probably already created...at least it is on my systems. So if you are willing to accept the error exit from the make process (and a little bit of wasted work on the build host), you might not need to do anything.
After the configure
step, there will be a definition in src/Makefile
that looks like this:
noinst_PROGRAMS = t_timer$(EXEEXT) t_units$(EXEEXT) t_uuid$(EXEEXT) \
iperf3_profile$(EXEEXT)
If you edit it to look like this, it will disable the build of the profiled iperf3:
noinst_PROGRAMS = t_timer$(EXEEXT) t_units$(EXEEXT) t_uuid$(EXEEXT)
src/Makefile.am
and change the line reading like this:noinst_PROGRAMS = t_timer t_units t_uuid iperf3_profile
To look like this:
noinst_PROGRAMS = t_timer t_units t_uuid
And then run ./bootstrap.sh
, that will regenerate the project Makefiles to make the exclusion of the profiled iperf3 executable permanant (within that source tree).
At this point I'm inclined to just write this up as an FAQ item and close the issue.
OR:
./configure --disable-profiling --host=arm-linux-androideabi
Most helpful comment
OR:
./configure --disable-profiling --host=arm-linux-androideabi