为 i386 构建 crti.o
我正在尝试构建一个交叉编译器,其中 x86_64 为主机,i386 为目标。 我收到(所有常见的)crti.o: No such file 错误。 我该如何从 glibc(或可能是 gcc)源显式构建这些文件,而不是从发行版中获取已经构建的 crti.o 和 crtn.o ?
仅供参考,我很清楚 x86_64 编译器的 -m32 选项。 我更喜欢只有 32 位的编译器环境。 另外,我不想使用任何已经构建的 i386 编译器的原因是因为我计划根据我的测试需求混合和匹配 glibc/binutils/gcc 版本。
谢谢, 陈兹
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一种可能性(来自此处< /a>)
Here's one possibility (from here)
您确定正确配置了交叉编译吗? 应该是
当您在
x86_64
上运行构建时,编译器才能在x86_64
上运行,从而为i386
生成代码。如果您使用了 CHOST = i386-pc-linux-gnu,您将尝试生成 32 位二进制文件,这需要与 32 位 libc 链接。 如果您已经有 32 位
libc
,那很好,但听起来您没有。IE
Are you sure you're using configuring the cross-compile correctly? It should be
as you're running a build on an
x86_64
, for a compiler to run on anx86_64
, which generates code for ani386
.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-bitlibc
. Which is fine, if you already have a 32-bitlibc
, but it sounds like you don't.i.e.