ubuntu交叉编译android平台可执行C程序

来源:互联网 发布:asp源码修改工具 编辑:程序博客网 时间:2024/05/21 11:03

ubuntu安装软件 arm-linux-androideabi-gcc ,使用该编译器编译即可,由与我的需要运行在android6.0+,直接这么编译运行会出现

error: only position independent executables (PIE) are supported.

解决方法是,在该gcc编译下加一项 加-fPIE -pie即可

另外遇到了一个问题,在执行程序时有这样的提示

CANNOT LINK EXECUTABLE: cannot locate symbol "__exidx_end" referenced by 
解决方法是在.c文件的任意位置添加如下代码,重新编译即可

#ifdef __cplusplus    extern "C" {#endifvoid __exidx_start() {}void __exidx_end()   {}#ifdef __cplusplus    }#endif

0 0
原创粉丝点击