由于很多程序是用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. luci-bwc(记录流量功能)

    使用方法如下: root@openwrt:/# luci-bwcUsage:        luci-bwc [-t timeout] -i ifname             // ifname为 ...

  2. MySQL事务内幕与ACID

    MySQL的事务实现严格遵循ACID特性,即原子性(atomicity),一致性(consistency),隔离性(isolation),持久性(durability).为了避免一上来就陷入对ACID ...

  3. 文件传送,如此简单--ESFramework 4.0 快速上手(13)

    在所有的通信系统中,文件传送是最常见也是最重要的功能之一,ESFramework对文件传送的强大支持也是其亮点之一,使用ESFramework可以非常轻松地实现与文件传送相关的所有需求.ESPlus. ...

  4. hdu 2425 Hiking Trip (bfs+优先队列)

    Problem Description Hiking in the mountains is seldom an easy task for most people, as it is extreme ...

  5. C# 几个特殊运算符的理解和Nullable<T> 的研究

    可空值类型和?运算符 谈到运算符,大家一定很熟悉,但是对所有的运算符都能掌握吗? 看了下面代码再回答. Nullable<Int32> count = ; ; bool? flag = f ...

  6. wpf 异步加载 只需6段代码

    private BackgroundWorker worker = null; ProgressBar probar = new ProgressBar(); private int percentV ...

  7. java innerclass

    ---恢复内容开始--- 内部类: public class Inner{ public class Inner2{} } 创建内部类对象 .new public class Test {    in ...

  8. AS3.0杂记——Dictionary、Object与Array

    来源:http://blog.csdn.net/m_leonwang/article/details/8811829 Object.Array与Dictionary都是关联数组,就是用“键”来索引存储 ...

  9. drupal7 安装百度编辑器Ueditor及后续使用

    参考文章:drupal7安装百度编辑器ueditor 一.下载 1.需要下载安装的模块: 1.1.wysiwyg 1.2.ueditor 1.3Libraries 下载后安装在\sites\all\m ...

  10. Openlayer 3 的画线测量长度

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...