简体   繁体   English

Make:指定交叉编译器路径时找不到命令

[英]Make: command not found when specifying cross compiler path

I am trying to compile a kernel on my FOX G20 V board. 我正在尝试在FOX G20 V板上编译内核。 In order to do so, I have to specify the cross compiler in one of the steps arm-linux-gnueabi . 为此,我必须在步骤arm-linux-gnueabi之一中指定交叉编译器。 The command is 该命令是

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- at91-ariag25.dtb 使ARCH = arm CROSS_COMPILE = arm-linux-gnueabi- at​​91-ariag25.dtb

So in order for the compiler to know where the executable of the cross compiler is, I specify it in the path by doing 因此,为了使编译器知道交叉编译器的可执行文件在哪里,我通过在路径中指定它

export PATH=$PATH:/home/path_goes_here/bin 导出PATH = $ PATH:/ home / path_goes_here / bin

When I do echo $PATH , I get the right path of the cross compiler. 当我echo $PATH ,我得到了交叉编译器的正确路径。 However, now when I do the make of my project, I receive: 但是,现在当我完成项目时,会收到:

make: command not found make:找不到命令

But when I don't specify the path of the compiler, the make works but when it reaches the point of the cross compiler, it gives me: 但是,当我不指定编译器的路径时,make可以工作,但是当它到达交叉编译器的地步时,它会给我:

make: arm-linux-gnueabi-gcc: Command not found make:arm-linux-gnueabi-gcc:找不到命令

I think that my make is not in my system path when I change it to the cross compiler. 当我将其更改为交叉编译器时,我认为我的make不在系统路径中。 Therefore, how can I add both the make and the cross compiler to the system path? 因此,如何将make和cross编译器都添加到系统路径中?

EDIT 编辑

My cross compiler is actually arm-linux-gnueabi-gcc-4.7 , and not arm-linux-gnueabi-gcc . 我的交叉编译器实际上是arm-linux-gnueabi-gcc-4.7 ,而不是arm-linux-gnueabi-gcc Yet when I specify the cross compiler in the make by doing CROSS_COMPILE=arm-linux-gnueabi- , I get: 但是,当我通过执行CROSS_COMPILE=arm-linux-gnueabi-make指定交叉编译器时,我得到:

make: arm-linux-gnueabi-gcc: Command not found make:arm-linux-gnueabi-gcc:找不到命令

Because arm-linux-gnueabi-gcc isn't the one it should be looking for. 因为arm-linux-gnueabi-gcc不是它应该寻找的那个。 Yet when I specify CROSS_COMPILE=arm-linux-gnueabi-gcc-4.7 , it appends gcc at the end of that and gives me: 但是当我指定CROSS_COMPILE=arm-linux-gnueabi-gcc-4.7 ,它将在末尾附加gcc并给我:

make: arm-linux-gnueabi-gcc-4.7gcc: Command not found make:arm-linux-gnueabi-gcc-4.7gcc:找不到命令

EDIT 2 编辑2

I simply renamed the cross compiler and that seemed to work. 我只是简单地重命名了交叉编译器,这似乎可行。 But now, I get the error: 但是现在,我得到了错误:

arm-linux-gnueabi-gcc: error trying to exec 'cc1': execvp: No such file or directory arm-linux-gnueabi-gcc:尝试执行“ cc1”时出错:execvp:无此类文件或目录

Setting CROSS_COMPILE is only a shorthand for setting all of CC=$(CROSS_COMPILE)cc AS=$(CROSS_COMPILE)as LD=$(CROSS_COMPILE)ld etc etc (just take a look at the top level Makefile with less(1) ) 设置CROSS_COMPILE仅是将所有CC=$(CROSS_COMPILE)cc AS=$(CROSS_COMPILE)as LD=$(CROSS_COMPILE)ld等的LD=$(CROSS_COMPILE)ld (只需看一下具有less(1)的顶级Makefile

So you should be able to do this 所以你应该能够做到这一点

$ export ARCH=arm
$ xc=arm-linux-gnueabi-
$ export CC=$(xc)gcc-4.7
$ export AS=$(xc)as-4.7
$ export LD=$(xc)ld-4.7
etc etc
$ make at91-ariag25.dtb

For each of the binaries in your toolchain, you should create symbolic links that obey the naming convention required by your Makefile. 对于工具链中的每个二进制文件,应创建符号链接,这些符号链接应遵循Makefile所需的命名约定。 The links should point to the respective binary that uses the non-conformant naming scheme. 链接应指向使用不一致标准命名方案的相应二进制文件。

cd /home/dico/gcc-4.7-arm-linux-gnueabi_4.7.2-1/usr/bin
ln -s arm-linux-gnueabi-gcc-4.7 arm-linux-gnueabi-gcc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM