(1)配置交叉编译链接
make-standalone-toolchain.sh
然后
make-standalone-toolchain.sh
然后配置PATH,CC,C++
export CC="aarch64-linux-android-gcc -pie -fPIE --sysroot=..."
export CXX="aarch64-linux-android-g++ -pie -fPIE --sysroot=..."
export CXXFLAGS="-lstdc++"
(2)下载源码
./configure --host=aarch64-linux-android --target=aarch64-linux-android --prefix=.......out
make
make install
-----------------
问题
(1) 找不到stdio_ext.h这个文件
需要将android 6.0中的./bionic/libc/include/stdio_ext.h 拷贝到sysroot环境中。
https://android.googlesource.com/platform/bionic/+/android-6.0.1_r73/libc/include/stdio_ext.h
可以从这里下到
(2)../common/sim-events.h:94:3: error: unknown type name 'SIM_ELAPSED_TIME'
SIM_ELAPSED_TIME resume_wallclock;
需要在sim-events.h中添加 #include "sim-utils.h"
(3) ./memory.h:29:44: error: unknown type name 'sim_cpu'
在sim/aarch64/cpustate.h中增加#include "sim-base.h"
(4)linux-thread-db.c: In function 'thread_from_lwp':
linux-thread-db.c:344:5: error: 'td_thrhandle_t' has no member named 'th_unique'
th.th_unique = 0;
//th.th_unique = 0;将该文件中的这行注释掉
(5)undefined reference to `setpwent'
修改complete.c对应行
改为:
#if defined(HAVE_GETPWENT)
setpwent();
#endif
(6)linux-low.c:130:3: error: conflicting types for 'Elf64_auxv_t'
} Elf64_auxv_t;
修改sysroot/usr/include/elf.h文件,将冲突名,改为其他名称
(7)tracepoint-ipa.o: In function `get_timestamp':
/home/secniu/works/android_tools/android_gdb/gdb-7.11/gdb/gdbserver/tracepoint.c:7349: undefined reference to `rpl_gettimeofday'
(8) line 81: makeinfo: command not found
安装makeinfo命令,ubuntu环境需要安装texinfo命令
-----------
refer :
http://blog.youkuaiyun.com/xiaolli/article/details/52650036