您的位置:首页 > 运维架构 > Linux

iperf linux版本移植到android (使用工具链方式不是使用Android.mk)

2015-04-14 15:55 483 查看
由于很多程序是用makefile编译linux应用程序的,如果移植到android就要重新写Android.mk,对于不熟悉这个的人来说,特别麻烦,所以这里介绍只修改makefile就能移植到android板子上面。还有试过这种方式,今天就试试。首先设置exportPATH=~/rowboat-android/wl18xx-snq/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin:$PATH设置arm-linux-androideabi交叉编译工具链网络上下载iperf并解压./configureCC=arm-linux-androideabi-gccCFLAGS=--sysroot=/home/snq/rowboat-android/wl18xx-snq/android-ndk-r9d/platforms/android-17/arch-arm/生成config.h和Makefile脚本然后makeall出现下面的编译结果g++-Wall-O2-oiperf--sysroot=/home/snq/rowboat-android/wl18xx-snq/android-ndk-r9d/platforms/android-17/arch-arm/-DHAVE_CONFIG_HClient.oExtractor.oLaunch.oList.oListener.oLocale.oPerfSocket.oReportCSV.oReportDefault.oReporter.oServer.oSettings.oSocketAddr.ognu_getopt.ognu_getopt_long.omain.oservice.osockets.ostdio.otcp_window_size.o../compat/libcompat.a/usr/bin/ld:Extractor.o:RelocationsingenericELF(EM:40)Extractor.o:couldnotreadsymbols:Fileinwrongformatcollect2:ldreturned1exitstatusgoogle结果显示http://stackoverflow.com/questions/8168950/cross-compiling-c-project-relocations-in-generic-elf-em-3
exportCXX=/home/matt/CodeSourcery/bin/arm-none-linux-gnueabi-g++
大多都说是g++问题,修改每个makefile里面g++相关的CXX,不要在设置./configure的时候修改出显示不能checkingwhethertheC++compilerworks...noconfigure:error:in`/home/snq/rowboat-android/wl18xx-snq/iperf-2.0.5':configure:error:C++compilercannotcreateexecutablesSee`config.log'formoredetails.所有的地方都修改
arm-none-linux-gnueabi-g++
替换g++不然会出现很多错误,基本都是这个引起的继续编译出现
undefinedreferenceto`__gxx_personality_v0'
error:undefinedreferenceto‘__cxa_end_cleanup’
两个错误google之后/article/2298167.htmlhttp://stackoverflow.com/questions/329059/what-is-gxx-personality-v0-for在CFLAGS后面添加-fno-exceptions-lstdc++还有一个错误

undefinedreferencetorpl_malloc

http://blog.csdn.net/linux_lyb/article/details/3536911后来发现config.h.in里定义了#undefmalloc#undefrealloc把这两个去掉,编译顺利通过。

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: