1. 将tar-1.28.tar.gz放置到虚拟机/root/目录下,使用tar –xvjf tar-1.28.tar.gz进行解压。
2. 将CQ5交叉编译工具arm-linux-androideabi-4.6.tar.bz2放置到/root/文件目录下,解压缩。
3. 修改/etc/profile文件,在最后增加一行
export PATH="$PATH:/root/arm-linux-androideabi-4.6/bin/"对交叉编译器的路径进行声明,然后重启虚拟机。
4. 在tar-1.28文件目录下 执行
./configure --target=arm-linux-androideabi --host=arm-linux-androideabi配置交叉编译器
5. 执行make出现下面的错误,
CDPATH="${ZSH_VERSION+.}:"&& cd . && /bin/sh /root/tar-1.28/build-aux/missingaclocal-1.14 -I m4
/root/tar-1.28/build-aux/missing:行81: aclocal-1.14: 未找到命令
WARNING:'aclocal-1.14' is missing on your system.
You should only need it if youmodified 'acinclude.m4' or
'configure.ac' or m4 files included by'configure.ac'.
The 'aclocal' program is part of theGNU Automake package:
It also requires GNU Autoconf, GNU m4and Perl in order to run:
http://www.perl.org/
6. 执行autoreconf –ivf
7. 重新
./configure --target=arm-linux-androideabi --host=arm-linux-androideabi
配置出现configure: WARNING: if you wanted to setthe --build type, don't use --host. If a cross compiler is detected then crosscompile mode will be used 开头提示。后面提示checking host system type... Invalid configuration`arm-linux-androideabi': system `androideabi' not recognized configure: error:/bin/sh build-aux/config.sub arm-linux-androideabi failed编译出错的问题
8. 网上搜索最新的config.guess和config.Sub文件替换build-aux文件夹中的文件
9. 继续重新配置,时还会出现configure交叉编译器未开启的出错。
10. 修改configure 555行cross_compiling=yes。重新配置。
11. 配置通过后执行make进行编译,会出现mkfifo.c:32:1: error: redefinition of 'mkfifo'。重定义问题,将mkfifo.c文件中的'mkfifo'定义注释掉,继续编译
12. 出现tar.c:1351:5: error: 'SAVEDIR_SORT_INODE' undeclared here (not in a function)
tar.c:1354:1: error: staticassertion failed: "verify (ARRAY_CARDINALITY (sort_mode_arg) ==ARRAY_CARDINALITY (sort_mode_flag) + 1)"的错误
13. tar.c文件中的SAVEDIR_SORT_INODE定义出错,修改gnu文件夹中的savedir.h的定义。
enumsavedir_option
{
SAVEDIR_SORT_NONE,
SAVEDIR_SORT_NAME,
#ifD_INO_IN_DIRENT
SAVEDIR_SORT_INODE,
SAVEDIR_SORT_FASTREAD = SAVEDIR_SORT_INODE
#else
SAVEDIR_SORT_FASTREAD = SAVEDIR_SORT_NONE
#endif
};
修改为
#defineSAVEDIR_SORT_INODE 2
enumsavedir_option
{
SAVEDIR_SORT_NONE,
SAVEDIR_SORT_NAME,
#ifD_INO_IN_DIRENT
SAVEDIR_SORT_FASTREAD = SAVEDIR_SORT_INODE
#else
SAVEDIR_SORT_FASTREAD = SAVEDIR_SORT_NONE
#endif
}; strip
14. 继续编译tar文件生成在src文件中,通过arm-linux-androideabi- strip tar 对 tar文件进行压缩