LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2505|回复: 4

求助,制作交叉编译gcc时出现错误

[复制链接]
发表于 2007-5-21 12:22:20 | 显示全部楼层 |阅读模式
checking whether make sets $(MAKE)... yes
checking for arm-linux-strip... /mygod/arm/arm-linux/bin/strip
checking for --enable-version-specific-runtime-libs... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking for arm-linux-gcc... /mygod/gcc-4.2.0/host-i686-pc-linux-gnu/gcc/xgcc -B/mygod/gcc-4.2.0/host-i686-pc-linux-gnu/gcc/ -B/mygod/arm/arm-linux/bin/ -B/mygod/arm/arm-linux/lib/ -isystem /mygod/arm/arm-linux/include -isystem /mygod/arm/arm-linux/sys-include
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
make[1]: *** [configure-target-libmudflap] 错误 1
make[1]: Leaving directory `/mygod/gcc-4.2.0'
make: *** [all] 错误 2

我的配置参数如下
./configure --target=arm-linux --prefix=/mygod/arm --disable-shared --disable-threads --disable-nls --with-newlib --enable-languages=c --without-headers --with-binutils=/mygod/arm/arm-linux/bin
发表于 2007-5-22 13:43:43 | 显示全部楼层
./configure --host=arm-linux --build=i386-linux ....

--host 是你编完后想要跑得平台(如arm) ,--build是你做交叉编译的平台( 如x86),--target是你生成交叉编译器的平台,也就是说你如果想要编译生成arm-linux-gcc编译器,你需要用这个选项,一般情况下没有用的。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-23 14:03:55 | 显示全部楼层
Post by popman
./configure --host=arm-linux --build=i386-linux ....

--host 是你编完后想要跑得平台(如arm) ,--build是你做交叉编译的平台( 如x86),--target是你生成交叉编译器的平台,也就是说你如果想要编译生成arm-linux-gcc编译器,你需要用这个选项,一般情况下没有用的。

--target应该是交叉编译器生成二进制文件运行的平台,也就是目标系统平台。--target=arm-linux  --host应该是i386-linux是我交叉编译器要跑的平台。
不过还是要谢谢你哦,我已经解决了添加--disable-libmudflap,将这一项给禁了就行了,反正是第一遍编译只需要arm-linux-gcc
回复 支持 反对

使用道具 举报

发表于 2007-5-24 14:06:26 | 显示全部楼层
Post by cnsword
--target应该是交叉编译器生成二进制文件运行的平台,也就是目标系统平台。--target=arm-linux  --host应该是i386-linux是我交叉编译器要跑的平台。
不过还是要谢谢你哦,我已经解决了添加--disable-libmudflap,将这一项给禁了就行了,反正是第一遍编译只需要arm-linux-gcc


====不好意思,没看清你的标题,总结一下:

GNU 有一本关于这方面的书,叫autobook-1.5

我引用一下:
“When building cross compilation tools, there are two different systems involved: the system on which the tools will run, and the system for which the tools will generate code. The system on which the tools will run is called the host system. The system for which the tools generate code is called the target system.”

-----当编译一个交叉编译工具时(如:arm-gcc),--host=i386-linux --target=arm-linux

Building with a Cross Compiler

“Building a program on one system and running it on another is sometimes referred to as a Canadian Cross.”

“The system on which the tools are being built is called the build system. The system on which the tools will run is called the host system. For example, if you are building a Solaris program on a GNU/Linux system, as in the previous example, the build system would be GNU/Linux, and the host system would be Solaris.”

--如果是用一个交叉编译器进行build时(这种方式叫做 Canadian Cross),--build=i386-linux, --host=arm-linux.

再来个复杂点的,

“build a cross compiler using a cross compiler”

--“In this case, the system for which the resulting cross compiler generates code is the target system.”

--“An example of building a cross compiler using a Canadian Cross would be building a Windows cross MIPS ELF compiler on a GNU/Linux system. In this case the build system would be GNU/Linux, the host system would be Windows, and the target system would be MIPS ELF. “

--如果我们想在linux下编一个交叉编译器A,使它A能够运行在windows上面,并且该工具A在windows下编译程序后生成的程序能够跑在mips下,那么--target=mips-elf --host=windows --build=i386-linux
回复 支持 反对

使用道具 举报

发表于 2010-3-9 11:30:50 | 显示全部楼层
我一开始也是和你一样的错误按照你的方法禁用那一个选项还是出错。最后在CLFS 上看到设置环境变量:

cat >> ~/.bashrc << EOF
unset CFLAGS
unset CXXFLAGS
EOF

然后加gcc编译选项彻底解决了选项如下:

../gcc-4.2.4/configure --target=arm-linux --prefix=$PREFIX --disable-shared --disable-threads --disable-nls --with-newlib --enable-languages=c --without-headers --with-sysroot=$PREFIX --disable-multilib --disable-decimal-float --disable-libgomp --disable-libmudflap --disable-libssp
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表