开发者

Missing crt1 and crti when crosscompiling

I'am trying to build a cross compile toolchain based on GCC4.5 and newlib with gold and link-time-optimization enabled. GCC compiles fine but it did not generate the crt1.o or crti.o files. Therefore when I tries to use the compiler for building Newlib it complains with the message:

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

When searching for files named crt* in the directory where GCC4.5 is installed i got the following result:

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

From the GCC spec's it seems like gcc needs both the crtbegin.o and the crti.o files, but only one of them is available.

*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} 

Following is the flags i used when compiling 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 

I'm sure on if this is due to I configured GCC wrongly, or "stuff" simply do not work this way, or if the files crti.o should come from somewhere else.

Thanks in advance

Allan W. Nielsen


Some crt* files come not from the compiler, but from the C library. I suspect this is the case here for your crt1.o and crti.o.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜