由于很多程序是用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. html .css 实现图片滑动和自动播放特效移动端 HTML 5中添加了以touch 开头的事件

    <!DOCTYPE HTML> <html> <head> <meta charset="utf-8">     <meta ...

  2. Xcode-App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure.

    在xcode中上报数据时候,logserver一直没有数据,后来发现控制台有一个提示: 找了半天是因为Xcode7禁止明码的HTTP请求,而自己使用的是Xcode7.2.1 解决办法:修改info.p ...

  3. 数学之欧拉函数 &几道poj欧拉题

    欧拉函数总结+证明 欧拉函数总结2 POJ 1284 原根 #include<iostream> #include<cstdio> #include<cstring> ...

  4. Markdown - Github specific

    这篇文章的内容,必须到github的页面才能全部生效. Github specific Github allows for mistakes There are also Tables in gith ...

  5. jquery 固定导航

    网页代码: <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head> & ...

  6. opkg

    opkg是个安装器,小乔,功能全. root@hbg:/# opkg files opkgPackage opkg (9c97d5ecd795709c8584e972bfdf3aee3a5b846d- ...

  7. Java 中值传递和引用传递 区分

    详细参见  http://blog.csdn.net/zzp_403184692/article/details/8184751

  8. Linux中如何设置java环境变量

    这里介绍Linux下如何设置java环境变量. 工具/原料 Linux java环境变量 方法/步骤 1 查看java的安装路径   查看java执行路径   配置java环境变量   java的安装 ...

  9. 解决Firefox访问12306"连接不受信任"的问题

    用Firefox访问12306.cn, 总是提示"This Connection is Untrusted", 曾经有个"Add Exception" 按钮, ...

  10. 关于NLog的target和Layout

    这个没啥好说的,都是用别人的东西,看文档就行了,写的很详细. https://github.com/NLog/NLog/wiki/Configuration-file https://github.c ...