谷动谷力

 找回密码
 立即注册
谷动谷力 首页 嵌入式 查看内容

【openwrt】ubuntu20环境下x编译openwrt15(Chaos Calmer)因GCC版本太...

2023-6-23 19:38| 发布者: sunsili| 查看: 30| 评论: 0|原作者: sunsili

摘要: 【openwrt】ubuntu20环境下x编译openwrt15(Chaos Calmer)因GCC版本太高 而编译不通过 【现象】 编译出错提示: In file included from include/linux/compiler.h:54, from /home/fan/openwrt_CC_mt76xx_zhuotk_sour ...
【openwrt】ubuntu20环境下x编译openwrt15(Chaos Calmer)因GCC版本太高 而编译不通过

【现象】
编译出错提示:
In file included from include/linux/compiler.h:54,
from /home/fan/openwrt_CC_mt76xx_zhuotk_source/build_dir/host/u-boot-2014.10/arch/sandbox/include/asm/bitops.h:20,
from include/linux/bitops.h:110,
from /home/fan/openwrt_CC_mt76xx_zhuotk_source/build_dir/host/u-boot-2014.10/include/common.h:20:
include/linux/compiler-gcc.h:114:1: fatal error: linux/compiler-gcc9.h: No such file or directory
114 | #include gcc_header(GNUC)
| ^~~~
compilation terminated.
make[6]: *** [/home/fan/openwrt_CC_mt76xx_zhuotk_source/build_dir/host/u-boot-2014.10/scripts/Makefile.autoconf:64: include/autoconf.mk] Error 1
make[5]: *** [/home/fan/openwrt_CC_mt76xx_zhuotk_source/build_dir/host/u-boot-2014.10/Makefile:464: silentoldconfig] Error 1
make[4]: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/uboot.release'.  Stop.
make[4]: Leaving directory '/home/fan/openwrt_CC_mt76xx_zhuotk_source/build_dir/host/u-boot-2014.10'
make[3]: *** [Makefile:48: /home/fan/openwrt_CC_mt76xx_zhuotk_source/build_dir/host/u-boot-2014.10/.built] Error 2

【原因】
ubuntu20默认的gcc9版本太高了,怕有其它问题,所以首先我是将gcc进行降版本,并切换为gcc-4.8
Ubuntu20.04终端安装、切换低版本gcc/g++

【解决方法】
增加源
sudo vim /etc/apt/sources.list
添加
deb http://dk.archive.ubuntu.com/ubuntu/ xenial main
deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe

更新源
sudo apt-get update
安装gcc5,g++5
sudo apt-get install g++-5 gcc-5
安装gcc4,g++4
sudo apt-get install g++-4.8 gcc-4.8
设置优先级
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/g++-4.8 40
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/g++-5 50
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/g++-9 90
选择gcc版本
sudo update-alternatives --config gcc



鲜花

握手

雷人

路过

鸡蛋

相关阅读

发表评论

最新评论

最新热点

QQ|Archiver|手机版|深圳市光明谷科技有限公司|光明谷商城|Sunshine Silicon Corpporation ( 粤ICP备14060730号|Sitemap

GMT+8, 2024-9-30 23:14 , Processed in 0.147722 second(s), 35 queries .

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

返回顶部