我正在尝试构建一个基于GCC4.5和newlib的交叉编译工具链,并启用gold和链接时间优化。GCC编译得很好,但它没有生成crt1.o或crti.o文件。因此,当我尝试使用编译器构建Newlib时,它会报错并显示以下消息:
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在安装GCC4.5的目录中搜索名为crt*的文件时,我得到了以下结果:
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需要crtegin.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·尼尔森
发布于 2011-01-01 23:04:20
有些crt*文件不是来自编译器,而是来自C库。我怀疑这就是你的crt1.o和crti.o的情况。
https://stackoverflow.com/questions/3299511
复制相似问题