由于很多程序是用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. Chapter 2 Open Book——24

    Mike kept up a string of complaints on the way to building four. mike去教学楼的路上一直嘀咕抱怨着. Once inside the ...

  2. VS2013使用EF与mysql数据库.

    一个VS2013的mvc+EF+mysql的项目,需要连接Mysql数据库 一,下载一个mysql-for-visualstudio-1.2.3.msi,在自己的电脑上安装,这个是解决在创建实体模型( ...

  3. javascript生成新标签的三种方法

    javascript生成新标签的三种方法:http://www.cnblogs.com/online-link/p/6062423.html

  4. display: inline-block兼容性写法

    display:inline-block;*display:inline;*zoom:1;

  5. Map获取键值,Map的几种遍历方法

    Map 类提供了一个称为entrySet()的方法,这个方法返回一个Map.Entry实例化后的对象集.接着,Map.Entry类提供了一个 getKey()方法和一个getValue()方法,Map ...

  6. 大数据除法(Large data division)

    题目描述 Description 除法是计算中的基础运算,虽然规则简单,但是位数太多了,也难免会出错.现在的问题是:给定任意位数(足够大就可以啦O(∩_∩)O)的一个被除数,再给定一个long lon ...

  7. onmousedown活用之碰撞效果

    通过绝对定位,在页面中随意位置设置两个div; 也就是说div 是拖动的框,div1和div2是被触碰的框; <!DOCTYPE html> <html> <head&g ...

  8. photoshop的页面制作练习2

  9. QML与Qt C++ 交互机制探讨与总结

    介绍 QML和 C++对象可以通过,signals,slots和 属性修改进行交互.对于一个C++对象,任何数据都可以通过Qt的 Meta-Object System暴露给QML(何总方法,后面介绍) ...

  10. HTTP SOAP Request

    public string SoapRequest(string url, string message, string type, Encoding encoding) { string resul ...