我需要为armhf编译内核3.4,这需要gcc-4.9。
cmd行是:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- tegra_defconfig
(在这里我不确定是否需要设置CROSS_COMPILE)
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
问题是我无法使用ubuntu来使用gcc-4.9,这不可用,我不得不将xenial添加到“ sources.list”文件中,现在我可以在系统上使用它了,但无法使用它。
然后,将CC=gcc-4.9
添加到命令中将不会使用arm-linux-gnueabihf
定义的CROSS_COMPILE
前缀。
update-alternatives
无法将gcc-4.9识别为第二个c编译器。
有谁看到解决这个问题的方法?
请不要只发表“安装xenial”之类的评论。
答案 0 :(得分:0)
在此线程中:How to change the default GCC compiler in Ubuntu?
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50
sudo update-alternatives --set gcc /usr/bin/gcc-4.9
gcc --version
gcc (Ubuntu 4.9.3-13ubuntu2) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
坚持我的观点(交叉编译):
sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-4.9 50
sudo update-alternatives --set arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-4.9
对于内核3.xx和更低版本的perl是必需的,在完成perlbrew use perl-5.10.0
和perlbrew init
之后,可以克服perlbrew install perl-5.10.0
的错误(请仔细阅读最后两个的输出命令)。
请注意,即使在交叉编译时,也需要将主机的gcc设置为4.9 因为配置生成器需要它。