在 debian 上构建交叉编译器时出错
我想交叉编译powerpc的内核。我尝试在 x86_64 Ubuntu 10.04 和 i386 Debian Lenny 上执行此操作,但遇到了完全相同的问题。我按照 http://wiki.debian.org/BuildingCrossCompilers 上的说明进行操作,当我尝试构建时binutils 通过给出以下命令:
fakeroot debian/rules binary-cross
我得到这个结果:(
[snip]
make[3]: Entering directory `/home/anthony/cross-toolchain/binutils-2.20.1/builddir-powerpc-linux-gnu/libiberty'
if [ x"-fpic" != x ]; then \
gcc -c -DHAVE_CONFIG_H -g -O2 -Wno-format-security -I. -I../../libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic -fpic ../../libiberty/regex.c -o pic/regex.o; \
else true; fi
In file included from /usr/include/stdlib.h:320,
from ../../libiberty/regex.c:128:
/usr/include/sys/types.h:100: error: two or more data types in declaration specifiers
make[3]: *** [regex.o] Error 1
[snip]
这是因为 types.h 尝试 typedef pid_t,但是,它已被 #define 为 int。如果我通过 types.h 内的 #undef pid_t 解决这个问题,我在其他地方遇到了与 intptr_t 类似的问题,等等。)
I want to cross compile the kernel for powerpc. I've tried doing it on a x86_64 Ubuntu 10.04, and on a i386 Debian Lenny, and I get exactly the same problem. I follow the instructions at http://wiki.debian.org/BuildingCrossCompilers, and when I try to build the binutils by giving the following command:
fakeroot debian/rules binary-cross
I get this result:
[snip]
make[3]: Entering directory `/home/anthony/cross-toolchain/binutils-2.20.1/builddir-powerpc-linux-gnu/libiberty'
if [ x"-fpic" != x ]; then \
gcc -c -DHAVE_CONFIG_H -g -O2 -Wno-format-security -I. -I../../libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic -fpic ../../libiberty/regex.c -o pic/regex.o; \
else true; fi
In file included from /usr/include/stdlib.h:320,
from ../../libiberty/regex.c:128:
/usr/include/sys/types.h:100: error: two or more data types in declaration specifiers
make[3]: *** [regex.o] Error 1
[snip]
(This is because types.h attempts to typedef pid_t, which, however, has been #defined to int. If I hack around this problem by #undef pid_t inside types.h, I get a similar problem elsewhere with intptr_t, and so on and so on.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您需要做的只是交叉编译内核,您应该能够执行以下操作:
确保您的路径中有交叉编译器。要设置 CROSS_COMPILE 变量,如果您的 gcc 交叉编译器命令是 ppc_74xx-gcc,您需要设置 CROSS_COMPILE=ppc_74xx-
您可以查看此链接以了解更多信息信息 http://wiki.ppckernel.org/w/Cross_compiling_a_64-bit_PowerPC_Linux_Kernel
如果您如果您想从头开始构建自己的跨工具链,请查看 http://trac.cross-lfs.org/ 这个站点向您展示如何从头开始交叉编译 Linux,包括构建您自己的工具链、内核、用户空间等。
If all you need to do is cross-compile the kernel, you should be able to do the following:
Make sure you have the cross-compiler in your path. For setting the CROSS_COMPILE variable, if your cross-compiler command for gcc is ppc_74xx-gcc you'd set CROSS_COMPILE=ppc_74xx-
You can take a look at this link for more info http://wiki.ppckernel.org/w/Cross_compiling_a_64-bit_PowerPC_Linux_Kernel
If you're looking at building your own cross-toolchain from scratch, check out http://trac.cross-lfs.org/ This site shows you how to cross-compile Linux from scratch, including building your own toolchain, kernel, user space, etc.