LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: good02xaut

另一中LFS的安装

[复制链接]
 楼主| 发表于 2006-2-19 19:22:27 | 显示全部楼层
Post by 终极幻想
问题是:
然后在i686下运行i686-ppc(ppc-linux-gcc)将产生运行于ppc下的GCC(./configure --target=arm),但这个GCC用来编译出在arm下运行的代码。
[color="Red"]完全同意

没有 i686.ppc-arm 的 toolchain,你的 i686.i686-ppc 是产生不了 ppc.ppc-arm  toolchain 的。帅哥可以试试,我这个是以前看到的信息,我正在实验中。

这句没明白什么意思,不好意思;)

按照我附件的流程,其实中间把在i386上做一个ppc上本地编译器的过程给省了。所以将来在ppc上是没有本地编译器的。就好比我的机子上没有gcc,但我可以从别人的那拷贝一个arm-linux-gcc交叉编译器过来用的。
回复 支持 反对

使用道具 举报

发表于 2006-2-19 19:23:53 | 显示全部楼层
我暂时先退出讨论,之前是凭经验发表意见的,等有了实际经验在说。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-2-19 19:28:10 | 显示全部楼层
楼上可以试试。
最好的就是用arm-linux-gcc编译一个gcc出来
在i386的机子上:
./configure --target=arm 。。。
make(编译器为:arm-linux-gcc),只编译一遍gcc,不能用bootstrap
如果能够编译成功,那么就一定可以按照我说的来了。
回复 支持 反对

使用道具 举报

发表于 2006-2-19 19:29:22 | 显示全部楼层
Post by good02xaut

i686-ppc 不能直接编译出 ppc-arm 的 toolchain?这是什么意思?
我画的流程哪里有问题,你直接在里面改比较好理解。
.
.
.
如果./configure --target=arm
      make (ppc-linux-gcc作为编译器)
这样做违背了交叉编译器的规则,那我就相信“i686-ppc 不能直接编译出 ppc-arm ”。


1。你画的是没问题,但是事实上是做不到的。我的这句话你是不是还是觉得不对?我在实验,你也实验一下,这样好对照。:)。

2。你这个 configure 出来的结果应该是 i686.i686-arm,你的 ppc-linux-gcc编译器是什么意思?是说 host=ppc target=linux 么?看看我上边红字的约定,不然容易造成混乱。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-2-19 19:53:50 | 显示全部楼层
ppc-linux-gcc是交叉编译器。他运行于386平台,编译出来的代码可以在ppc上执行。
configure 出来的结果应该是 i686.i686-arm?
这个结果取决与makefile中选的CC

CC=gcc,你说的没错,用本地编译器编译,出来的肯定就是个运行于386平台
CC=ppc-linux-gcc呢?这可是在用交叉编译器编译程序呢,出来的程序(gcc)怎么会在386上运行呢?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-2-19 19:57:05 | 显示全部楼层
http://gcc.gnu.org/install/old.html

Installing GCC: Old documentation

2.Specify the host, build and target machine configurations. You do this when you run the configure script.
The build machine is the system which you are using, the host machine is the system where you want to run the resulting compiler (normally the build machine), and the target machine is the system for which you want the compiler to generate code.

看来一步就可以搞定了,build=386 host=ppc target=arm。呵呵。
不过这是老的安装参数,新版gcc好像没有build和host参数了。
回复 支持 反对

使用道具 举报

发表于 2006-2-19 20:07:54 | 显示全部楼层
呵呵,一步是可以搞定,不过是要你的 toolchain 都齐全的情况下。你现在是要建立 toolchain,:)。鸡和蛋的问题。

你试试用gcc这么做一次,肯定失败。
--build --host --target 都存在,怎么可能不存在呢。呵呵。
给你看看你所想的结果:

[html]
# ../gcc-4.0.2/configure \
     --build=i686-pc-linux-gnu \
     --host=x86_64-pc-linux-gnu \
     --target=i386-pc-linux-gnu
loading cache ./config.cache
checking host system type... x86_64-pc-linux-gnu
checking target system type... i386-pc-linux-gnu
checking build system type... i686-pc-linux-gnu
checking for a BSD compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for x86_64-pc-linux-gnu-gnatbind... no
checking for gnatbind... gnatbind
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for correct version of gmp.h... no
The following languages will be built: c,c++,java,objc
*** This configuration is not supported in the following subdirectories:
     target-libada target-libgfortran
    (Any other directories should still work fine.)
checking for bison... bison
checking for bison... bison -y
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... flex
checking for flex... flex
checking for makeinfo... makeinfo
../gcc-4.0.2/configure: line 3020: x86_64-pc-linux-gnu-gcc: command not found
*** The command 'x86_64-pc-linux-gnu-gcc -o conftest -g -O2    conftest.c' failed.
*** You must set the environment variable CC to a working compiler.

[/html]
回复 支持 反对

使用道具 举报

发表于 2006-2-19 20:12:25 | 显示全部楼层
Post by good02xaut
ppc-linux-gcc是交叉编译器。他运行于386平台,编译出来的代码可以在ppc上执行。
configure 出来的结果应该是 i686.i686-arm?
这个结果取决与makefile中选的CC

CC=gcc,你说的没错,用本地编译器编译,出来的肯定就是个运行于386平台
CC=ppc-linux-gcc呢?这可是在用交叉编译器编译程序呢,出来的程序(gcc)怎么会在386上运行呢?


ppc-linux-gcc:运行于 i386 平台。为 ppc 编译程序。你应该用 i386-ppc gcc来表示。这个是标准的表示方法。你的表达正好反过来了。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-2-19 20:17:16 | 显示全部楼层
我现在彻底清楚了。
../gcc-4.0.2/configure \
     --build=i686-pc-linux-gnu \
     --host=x86_64-pc-linux-gnu \
     --target=i386-pc-linux-gnu
配置以后,其实编译时,make 会自动去找x86_64-pc-linux-gnu编译器的。我说的都是显示指定,而现在是通过配置,有make去完成了。
还是回到从前说的:
../gcc-4.0.2/configure \
     --build=i686 \
     --host=ppc \
     --target=arm
这样执行一下你看看,系统肯定会提示找不到ppc-linux-gcc这个东东。
这不正视校验我画的流程了吗,现有交叉编译器,然后直接编译gcc就可以了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-2-19 20:20:26 | 显示全部楼层

是我的错

Post by 终极幻想
ppc-linux-gcc:运行于 i386 平台。为 ppc 编译程序。你应该用 i386-ppc gcc来表示。这个是标准的表示方法。你的表达正好反过来了。

按照约定是你说的

不过我表达的意思,版主应该清楚了吧

标准命名更正后,流程:
  /***host-target-gcc***/

./configure --target =ppc  --host=386  --build=386
/make (i386-i386-gcc是编译器)
     ||
     ||第一次编译
   ||
./configure --target=arm  --host=ppc --build=386
/make (i386-ppc-gcc是编译器)
   ||
    || 第二次编译
    ||
ppc-arm-gcc
回复 支持 反对

使用道具 举报

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

本版积分规则

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