1. 程式人生 > >Ubuntu編譯OpenWRT 15.05提示"Build dependency:Please install the xxx"

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
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))