Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android ndk 使用Android NDK工具链交叉编译Iperf:Iperf在主机上运行,但不在目标机上运行_Android Ndk_Arm_Cross Compiling_Ldflags - Fatal编程技术网

Android ndk 使用Android NDK工具链交叉编译Iperf:Iperf在主机上运行,但不在目标机上运行

Android ndk 使用Android NDK工具链交叉编译Iperf:Iperf在主机上运行,但不在目标机上运行,android-ndk,arm,cross-compiling,ldflags,Android Ndk,Arm,Cross Compiling,Ldflags,我正在尝试编译iperf源代码并在android设备上运行。我正在使用ubuntu服务器编译代码。我已经下载了iperf源代码以及Android NDK。我使用make-standalone-toolchain.sh构建了工具链。然后,我将工具链/bin添加到路径中。我运行了ARMLinuxAndroidabiGCC-v以确保它在我的路径中。 然后我转到iperf源代码,并使用以下命令对其进行配置 ./configure --host=arm-linux --prefix=$HOMER/iper

我正在尝试编译iperf源代码并在android设备上运行。我正在使用ubuntu服务器编译代码。我已经下载了iperf源代码以及Android NDK。我使用make-standalone-toolchain.sh构建了工具链。然后,我将工具链/bin添加到路径中。我运行了ARMLinuxAndroidabiGCC-v以确保它在我的路径中。 然后我转到iperf源代码,并使用以下命令对其进行配置

./configure --host=arm-linux --prefix=$HOMER/iperf_install CC=arm-linux-androideabi-gcc     CXX=arm-linux-androideabi-g++ CFLAGS=-static CXXFLAGS=-static
其中$HOMER是我的当前目录 在此之后,我使用命令:

make install
我转到安装文件夹perf_install,然后转到bin并使用

./iperf3
我可以在我的ubuntu服务器上运行iperf3,但不能在我的android设备上运行

配置时,我获得了以下日志:

checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-androideabi-gcc accepts -g... yes
checking for arm-linux-androideabi-gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of arm-linux-androideabi-gcc... gcc3
checking for arm-linux-ranlib... no
checking for ranlib... ranlib
configure: WARNING: using cross tools not prefixed with host triplet
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ld used by arm-linux-androideabi-gcc... /local/mnt/workspace/ssuryade/android-toolchain/arm-linux-androideabi/bin/ld
checking if the linker (/local/mnt/workspace/ssuryade/android-toolchain/arm-linux-androideabi/bin/ld) is GNU ld... yes
checking for /local/mnt/workspace/ssuryade/android-toolchain/arm-linux-androideabi/bin/ld option to reload object files... -r
checking for BSD-compatible nm... nm
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... arm-linux-androideabi-gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking whether we are using the GNU C++ compiler... yes
checking whether arm-linux-androideabi-g++ accepts -g... yes
checking dependency style of arm-linux-androideabi-g++... gcc3
checking how to run the C++ preprocessor... arm-linux-androideabi-g++ -E
checking for arm-linux-g77... no
checking for arm-linux-xlf... no
checking for arm-linux-f77... no
checking for arm-linux-frt... no
checking for arm-linux-pgf77... no
checking for arm-linux-cf77... no
checking for arm-linux-fort77... no
checking for arm-linux-fl32... no
checking for arm-linux-af77... no
checking for arm-linux-xlf90... no
checking for arm-linux-f90... no
checking for arm-linux-pgf90... no
checking for arm-linux-pghpf... no
checking for arm-linux-epcf90... no
checking for arm-linux-gfortran... no
checking for arm-linux-g95... no
checking for arm-linux-xlf95... no
checking for arm-linux-f95... no
checking for arm-linux-fort... no
checking for arm-linux-ifort... no
checking for arm-linux-ifc... no
checking for arm-linux-efc... no
checking for arm-linux-pgf95... no
checking for arm-linux-lf95... no
checking for arm-linux-ftn... no
checking for g77... g77
checking whether we are using the GNU Fortran 77 compiler... no
checking whether g77 accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse nm output from arm-linux-androideabi-gcc object... ok
checking for objdir... .libs
checking for arm-linux-ar... no
checking for ar... ar
checking for arm-linux-ranlib... ranlib
checking for arm-linux-strip... strip
checking if arm-linux-androideabi-gcc supports -fno-rtti -fno-exceptions... no
checking for arm-linux-androideabi-gcc option to produce PIC... -fPIC
checking if arm-linux-androideabi-gcc PIC flag -fPIC works... yes
checking if arm-linux-androideabi-gcc static flag -static works... yes
checking if arm-linux-androideabi-gcc supports -c -o file.o... yes
checking whether the arm-linux-androideabi-gcc linker (/local/mnt/workspace/ssuryade/android-toolchain/arm-linux-androideabi/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by arm-linux-androideabi-g++... /local/mnt/workspace/ssuryade/android-toolchain/arm-linux-androideabi/bin/ld
checking if the linker (/local/mnt/workspace/ssuryade/android-toolchain/arm-linux-androideabi/bin/ld) is GNU ld... yes
checking whether the arm-linux-androideabi-g++ linker (/local/mnt/workspace/ssuryade/android-toolchain/arm-linux-androideabi/bin/ld) supports shared libraries... yes
checking for arm-linux-androideabi-g++ option to produce PIC... -fPIC
checking if arm-linux-androideabi-g++ PIC flag -fPIC works... yes
checking if arm-linux-androideabi-g++ static flag -static works... yes
checking if arm-linux-androideabi-g++ supports -c -o file.o... yes
checking whether the arm-linux-androideabi-g++ linker (/local/mnt/workspace/ssuryade/android-toolchain/arm-linux-androideabi/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for g77 option to produce PIC... -fPIC
checking if g77 PIC flag -fPIC works... no
checking if g77 static flag -static works... no
checking if g77 supports -c -o file.o... no
checking whether the g77 linker (/local/mnt/workspace/ssuryade/android-toolchain/arm-linux-androideabi/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for ANSI C header files... (cached) yes
checking for library containing nanosleep... none required
checking for library containing hstrerror... none required
checking for an ANSI C-conforming const... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/config.h
config.status: src/config.h is unchanged
config.status: executing depfiles commands
ssuryade@hyd-lnxbld13:/local/mnt/workspace/ssuryade/iperf-3.0b5$ ls
AUTHORS  LICENSE   Makefile.am  README         TODO        bootstrap.sh  config.log     configure     cross-me.txt  cscope.out  libtool  tags
INSTALL  Makefile  Makefile.in  RELEASE_NOTES  aclocal.m4  config        config.status  configure.ac  cross_me.txt  examples    src
ssuryade@hyd-lnxbld13:/local/mnt/workspace/ssuryade/iperf-3.0b5$ cat cross_me.txt
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for arm-linux-strip... no
checking for strip... strip
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-gnu
checking for arm-linux-gcc... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for arm-linux-ranlib... no
checking for ranlib... ranlib
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... nm
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking whether we are using the GNU C++ compiler... no
checking whether ++ accepts -g... no
checking dependency style of ++... none
checking how to run the C++ preprocessor... /lib/cpp
checking for arm-linux-g77... no
checking for arm-linux-xlf... no
checking for arm-linux-f77... no
checking for arm-linux-frt... no
checking for arm-linux-pgf77... no
checking for arm-linux-cf77... no
checking for arm-linux-fort77... no
checking for arm-linux-fl32... no
checking for arm-linux-af77... no
checking for arm-linux-xlf90... no
checking for arm-linux-f90... no
checking for arm-linux-pgf90... no
checking for arm-linux-pghpf... no
checking for arm-linux-epcf90... no
checking for arm-linux-gfortran... no
checking for arm-linux-g95... no
checking for arm-linux-xlf95... no
checking for arm-linux-f95... no
checking for arm-linux-fort... no
checking for arm-linux-ifort... no
checking for arm-linux-ifc... no
checking for arm-linux-efc... no
checking for arm-linux-pgf95... no
checking for arm-linux-lf95... no
checking for arm-linux-ftn... no
checking for g77... g77
checking whether we are using the GNU Fortran 77 compiler... no
checking whether g77 accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse nm output from gcc object... ok
checking for objdir... .libs
checking for arm-linux-ar... no
checking for ar... ar
checking for arm-linux-ranlib... ranlib
checking for arm-linux-strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking whether the ++ linker (/usr/bin/ld) supports shared libraries... yes
libtool.m4: error: problem compiling CXX test program
checking for ++ option to produce PIC...
checking if ++ static flag  works... no
checking if ++ supports -c -o file.o... no
checking whether the ++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... unsupported
appending configuration tag "F77" to libtool
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for g77 option to produce PIC... -fPIC
checking if g77 PIC flag -fPIC works... no
checking if g77 static flag -static works... no
checking if g77 supports -c -o file.o... no
checking whether the g77 linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for ANSI C header files... (cached) yes
checking for library containing nanosleep... none required
checking for library containing hstrerror... none required
checking for an ANSI C-conforming const... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/config.h
config.status: src/config.h is unchanged
config.status: executing depfiles commands
我想知道为什么即使我用正确的编译器配置它,它也没有使用正确的编译器。使用LDFLAGS是否也会有所不同?这会有什么不同?我应该给出本地库的地址,还是应该给出android工具链中包含的库的地址


请帮忙

您可以从此处查看Dockerfile,其中包含Ubuntu使用Android SDK/NDK为Android设备编译iperf/iperf3的所有必要步骤。

1检查是否使用文件(即文件)为arm构建了二进制文件。/iperf3如果是x86,则从日志中可以看出您的配置是错误的。我得出结论,使安装成为新的。/configure忽略了交叉编译参数。试着用make代替。