由于很多程序是用makefile编译linux应用程序的,如果移植到android就要重新写Android.mk,对于不熟悉这个的人来说,特别麻烦,所以这里介绍只修改makefile就能移植到android板子上面。还有试过这种方式,今天就试试。

首先设置export PATH=~/rowboat-android/wl18xx-snq/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin:$PATH 设置arm-linux-androideabi交叉编译工具链

网络上下载iperf 并解压

./configure   CC=arm-linux-androideabi-gcc  CFLAGS=--sysroot=/home/snq/rowboat-android/wl18xx-snq/android-ndk-r9d/platforms/android-17/arch-arm/

生成config.h 和Makefile脚本

然后make all

出现下面的编译结果

g++ -Wall -O2 -o iperf --sysroot=/home/snq/rowboat-android/wl18xx-snq/android-ndk-r9d/platforms/android-17/arch-arm/ -DHAVE_CONFIG_H Client.o Extractor.o Launch.o List.o Listener.o Locale.o PerfSocket.o ReportCSV.o ReportDefault.o Reporter.o Server.o Settings.o SocketAddr.o gnu_getopt.o gnu_getopt_long.o main.o service.o sockets.o stdio.o tcp_window_size.o ../compat/libcompat.a
/usr/bin/ld: Extractor.o: Relocations in generic ELF (EM: 40)
Extractor.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status

google结果显示

http://stackoverflow.com/questions/8168950/cross-compiling-c-project-relocations-in-generic-elf-em-3

export CXX=/home/matt/CodeSourcery/bin/arm-none-linux-gnueabi-g++

大多都说是g++问题,修改每个makefile里面g++相关的CXX,不要在设置./configure 的时候修改

出显示不能

checking whether the C++ compiler works... no
configure: error: in `/home/snq/rowboat-android/wl18xx-snq/iperf-2.0.5':
configure: error: C++ compiler cannot create executables
See `config.log' for more details.

所有的地方都修改arm-none-linux-gnueabi-g++ 替换g++ 不然会出现很多错误,基本都是这个引起的

继续编译出现

undefined reference to `__gxx_personality_v0'

error: undefined reference to ‘__cxa_end_cleanup’

两个错误

google之后

http://blog.csdn.net/ctroll/article/details/8629419

http://stackoverflow.com/questions/329059/what-is-gxx-personality-v0-for

在CFLAGS后面添加

-fno-exceptions  -lstdc++

还有一个 错误

undefined reference to rpl_malloc

http://blog.csdn.net/linux_lyb/article/details/3536911

后来发现config.h.in里定义了    
#undef malloc
#undef realloc

把这两个去掉, 编译顺利通过。

 
 

iperf linux版本移植到android (使用工具链方式不是使用Android.mk)的更多相关文章

  1. Linux下获取arm的交叉编译工具链

    转载请注明文章:Linux下获取arm的交叉编译工具链 出处:多客博图 这里介绍,Linux下获取arm的交叉编译工具链,比如arm-linux-gnueabihf-gcc.arm-linux-gne ...

  2. Android NDK 工具链的使用方法(Standalone Toolchain)

    转载:http://blog.csdn.net/smfwuxiao/article/details/6587709 首先需要确定目标机器的指令集. 如果是 x86 的机器,用 x86-4.4.3 版本 ...

  3. Linux简单程序实例(GNU工具链,进程,线程,无名管道pipe,基于fd的文件操作,信号,scoket)

    一, GNU工具链简介: (1)编译代码步骤: 预处理 -> 编译 -> 汇编 -> 链接: 预处理:去掉注释,进行宏替换,头文件包含等工作: gcc -E test.c -o te ...

  4. android更换工具链

    欢迎转载opendevkit文章, 文章原始地址: http://www.opendevkit.com/?e=73 android编译系统是跟随android源码一起发布的,使用了gcc编译器,也就是 ...

  5. Android开源工具项目集合

    最近因为要去外派了,工欲善其事,必先利其器!所以又回顾了一下自己github上所收藏的项目,也算是温故而知新吧. 最流行的Android组件大全 http://www.open-open.com/li ...

  6. 53. Android常用工具类

    主要介绍总结的Android开发中常用的工具类,大部分同样适用于Java.目前包括HttpUtils.DownloadManagerPro.ShellUtils.PackageUtils.Prefer ...

  7. 【转】Android常用工具类

    主要介绍总结的Android开发中常用的工具类,大部分同样适用于Java. 目前包括HttpUtils.DownloadManagerPro.ShellUtils.PackageUtils.Prefe ...

  8. Android流媒体开发之路二:NDK开发Android端RTMP直播推流程序

    NDK开发Android端RTMP直播推流程序 经过一番折腾,成功把RTMP直播推流代码,通过NDK交叉编译的方式,移植到了Android下,从而实现了Android端采集摄像头和麦克缝数据,然后进行 ...

  9. Buildroot构建指南——工具链

    Linux系统的交叉编译工具链用来将源代码变成bin文件或者库文件的一个软件.一般大家默认工具链等于gcc或者arm-linux-gcc,但是实际上,gcc只是工具链的编译器部分,不是全部,制作一个工 ...

随机推荐

  1. day01(RESTful Web Service、SVN)

    今日大纲 搭建SSM环境 基于SSM环境实现用户管理系统 学习RESTful Web Service 学习SVN 统一开发环境 JDK1.7 32? 64? -- 64 Eclipse 使用4.4.1 ...

  2. ELK配置说明及个人理解

    ELK是开源的日志查询系统,由三个开源工具组成:Elasticsearch.Logstash和Kibana; Elasticsearch的功能主要用于进行日志数据的存储及查询. Logstash提供日 ...

  3. 谷歌浏览器js debug

  4. Java线程经典面试题

    53道Java线程面试题 下面是Java线程相关的热门面试题,你可以用它来好好准备面试. 1) 什么是线程? 线程是操作系统能够进行运算调度的最小单位,它被包含在进程之中,是进程中的实际运作单位.程序 ...

  5. 2016NEFU集训第n+3场 D - Bicycle Race

    Description Maria participates in a bicycle race. The speedway takes place on the shores of Lake Luc ...

  6. ECOS-Ecstore 后台管理地址修改

    ECStore默认出厂的后台管理地址是: http://域名/index.php/shopadmin http://域名/shopadmin [配置过rewrite后,并开启伪静态] 如果想要更个性的 ...

  7. tableview选择的时候不要cell的高亮显示样式

    1.若用方法: //-(BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)ind ...

  8. ClassLoader类加载解惑

    1.通过类加载器获取路径: String path = Thread.currentThread().getContextClassLoader().getResource("." ...

  9. for计算100以内的偶数和

    #include "stdio.h" void main() { ,sum=; ;d++) { ==) { sum=sum+d; } }printf("100以内所有偶数 ...

  10. HDU 3416 Marriage Match IV

    最短路+最大流 #include<cstdio> #include<cstring> #include<string> #include<cmath> ...