我试图建立一个基于GCC4.5和newlib的交叉编译工具链,并启用了黄金和链接时优化。 GCC编译得很好,但没有生成crt1.o或crti.o文件。因此,当我尝试使用编译器来编译Newlib它与消息抱怨:交叉编译时缺少crt1和crti
ld: error: cannot open crti.o: No such file or directory
ld: error: cannot open crtn.o: No such file or directory
ld: error: cannot find -lc
当名为CRT *在GCC4.5安装我得到了以下结果目录中的文件搜索:
find ../../../tooltarget/ -name "crt*" -print #(result modified to consume less space)
crtprec80.o, crtend.o, crtfastmath.o, crtbegin.o, crtendS.o, crtprec32.o, crtbeginS.o, crtbeginT.o, crtprec64.o
从GCC规范看来,gcc似乎需要crtbegin.o和crti.o文件,但只有其中一个可用。
*startfile:
%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o
%s;:crtbegin.o%s}
以下是编译GCC时,我使用的标志:
--prefix=${TTP}/usr --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-awn-linux-gnu
--with-gmp=${TTP}/usr --with-mpc=${TTP}/usr
--with-mpfr=${TTP}/usr --with-libelf=${TTP}/usr
--enable-languages=c --enable-lto
--disable-nls --disable-shared
--disable-multilib --disable-decimal-float
--disable-libmudflap --disable-libssp
--disable-libgomp --disable-threads
--without-headers --with-newlib
--with-build-sysroot=${TTP} --with-build-time-tools=${TTP}/usr/bin
我敢肯定,如果上这是由于我错误地配置GCC或“东西”根本就没有这种工作方式,或者如果文件crti.o应该来自其他地方。
在此先感谢
艾伦·W·尼尔森
[crti.o文件丢失]的可能重复(http://stackoverflow.com/questions/91576/crti-o-file-missing) – user2284570 2014-07-19 09:14:17
我刚刚解决了这样一个问题,使用gcc build添加'--host = x86_64'到'。/ configure'脚本,但不知道是否有帮助。 – ton 2017-02-19 00:11:27