建立i386的crti.o [英] Building crti.o for i386

查看:197
本文介绍了建立i386的crti.o的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个交叉编译器,x86_64是主机,i386是目标。我得到(所有常见的)crti.o:没有这样的文件错误。而不是从发行版中抓取已经构建的crti.o和crtn.o ...我怎么可以从glibc(或者可能是gcc)源代码中显式构建这些文件?



FYI,我很清楚x86_64编译器的-m32选项。我宁愿只有一个32位编译器环境。另外,我不想使用任何gazillion已经构建的i386编译器的原因是因为我计划根据我的测试需要来混合和匹配glibc / binutils / gcc版本。



感谢,
Chenz

解决方案

您确定使用正确配置交叉编译吗?它应该是

 CBUILD = CHOST = x86_64-pc-linux-gnu 
CTARGET = i386-pc-linux-gnu x86_64 上运行构建时,要使编译器在上运行, x86_64 ,它为 i386 生成代码。



如果使用 CHOST = i386-pc-linux-gnu ,您将尝试生成32位二进制文​​件,这需要与32位 libc 。这很好,如果你已经有一个32位的 libc ,但听起来你没有。



ie

 $ tar xvjf gcc  -  *。tar.bz2 
$ cd gcc - * /
$ mkdir build
$ cd build
$ ../configure --build = x86_64-pc-linux-gnu --host = x86_64-pc-linux-gnu --target = i386-pc-linux-gnu


I am trying to build a cross-compiler with x86_64 being the host and i386 being the target. I'm getting the (all to common) crti.o: No such file error. Instead of grabbing an already built crti.o and crtn.o from a distro... how might I go about building these files explicitly from glibc (or possibly gcc) sources?

FYI, I am well aware of the -m32 option for x86_64 compilers. I'd prefer to just have a 32bit-only compiler environment. Also, the reason I don't want to use any of the gazillion already build i386 compilers is because I plan on mixing and matching glibc/binutils/gcc versions depending on my testing needs.

Thanks, Chenz

解决方案

Are you sure you're using configuring the cross-compile correctly? It should be

CBUILD = CHOST = x86_64-pc-linux-gnu
CTARGET = i386-pc-linux-gnu

as you're running a build on an x86_64, for a compiler to run on an x86_64, which generates code for an i386.

If you used CHOST = i386-pc-linux-gnu, you'll be trying to generate 32-bit binaries, which will need to link with a 32-bit libc. Which is fine, if you already have a 32-bit libc, but it sounds like you don't.

i.e.

$ tar xvjf gcc-*.tar.bz2
$ cd gcc-*/
$ mkdir build
$ cd build
$ ../configure --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=i386-pc-linux-gnu

这篇关于建立i386的crti.o的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆