Ubuntu编译OpenWRT 15.05提示"Build dependency:Please install the xxx"

在Ubuntu 18.04.1上编译OpenWrt Chaos Calmer的时候碰到了以下问题,记录一下。

Build dependency: Please install the GNU C Compiler (gcc)
Build dependency: Please reinstall the GNU C Compiler - it appears to be broken
Build dependency: Please install the GNU C++ Compiler (g++)
Build dependency: Please reinstall the GNU C++ Compiler - it appears to be broken
Build dependency: Please install the Objective Caml compiler (ocaml-nox) v3.12 or later
Build dependency: Please install ncurses. (Missing libncurses.so or ncurses.h)
Build dependency: Please install zlib. (Missing libz.so or zlib.h)
Build dependency: Please install the openssl library (with development headers)
Build dependency: Please install Python 2.x
Build dependency: Please install the Subversion client
Build dependency: Please install Git (git-core) >= 1.6.5

如果有碰到提示 - Unable to locate package xxx
请先参考https://blog.csdn.net/xiangxianghehe/article/details/80112149
把源换成国内源


Build dependency: Please install the GNU C Compiler (gcc)
Build dependency: Please reinstall the GNU C Compiler - it appears to be broken
原因
缺少gcc编译器
解决方法
安装gcc编译器
$ sudo apt-get install gcc

Build dependency: Please install the GNU C++ Compiler (g++)
Build dependency: Please reinstall the GNU C++ Compiler - it appears to be broken
原因
缺少g++编译器
解决方法
安装g++编译器
$ sudo apt-get install g++

Build dependency: Please install the Objective Caml compiler (ocaml-nox) v3.12 or later
原因
缺少ocaml编译器
解决方法
安装ocaml编译器
$ sudo apt-get install ocaml

注:此处用Ubuntu原来的源会碰到错误提示“Unable to locate package ocaml”,更换为阿里云后正常安装


Build dependency: Please install ncurses. (Missing libncurses.so or ncurses.h)
原因
缺少libncurses.so
解决方法
安装libncurses.so
$ sudo apt-get install libncurses5-dev

Build dependency: Please install zlib. (Missing libz.so or zlib.h)
原因
缺少libz.so
解决方法
安装libz.so
$ sudo apt-get install zlib1g-dev

Please install the openssl library (with development headers)
原因
缺少openssl库
解决方法
安装openssl库
$ sudo apt-get install libssl-dev

Build dependency: Please install Python 2.x
原因
缺少Python 2
解决方法
安装Python 2
$ sudo apt-get install python

Build dependency: Please install the Subversion client
原因
缺少subversion
解决方法
安装subversion
$ sudo apt-get install subversion

Build dependency: Please install Git (git-core) >= 1.6.5
原因一
缺少git
解决方法
安装git
$ sudo apt-get install git

注:如果已经安装git但是仍然收到该错误提示,请参考原因二,如果没有请忽略原因二。

原因二
已经安装git,但是版本是2.x
查看git版本
$ git --version
git version 2.17.1

由于对git版本的检测方式有缺陷导致,OpenWRT已经在
2016-03-05 21:07提交(4c80909fa141fe2921c62bd17b2b04153031df18)中修复该问题

解决方法
请参考 https://github.com/openwrt/openwrt/commit/4c80909fa141fe2921c62bd17b2b04153031df18
修改文件 include/prereq-build.mk 中git版本的判断命令。
我这里的判断命令依然是 git clone 2>&1 | grep – –recursive))
将其修改为 git –exec-path | xargs -I % – grep -q – –recursive %/git-submodule))
$(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
-   git clone 2>&1 | grep -- --recursive))
+   git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))

你可能感兴趣的:(Ubuntu编译OpenWRT 15.05提示"Build dependency:Please install the xxx")