minigui 3.2.0:對mgncs剪裁遇到的問題error: The pkg-config script could not be found or is too old.
阿新 • • 發佈:2018-11-01
考慮到嵌入式平臺的儲存和執行空間都有限,在向目標平臺移植時肯定要對minigui及其元件進行剪裁,刪除掉不需要的功能和特性,以縮小程式體積,對mgncs做剪裁時遇到了一個非常奇怪的問題,雖然解決了,但現在也沒找到根本原因:
根據configure --help
的提示使用--enable-fashionrdr=no
禁用fashion 渲染器(fashion render) 時報錯了.
錯誤資訊(片段)如下:
./configure --enable-fashionrdr=no
.....
checking for xmlFree in -lxml2... yes
checking for MINIGUI... no
configure: error: in `/home/gyd/workspace/facelock/dependencies/libmgncs-1.2.0':
configure: error: The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables MINIGUI_CFLAGS
and MINIGUI_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See `config.log' for more details
錯誤提示非常明確找不到pkg-config
,但明明我是安裝了pkg-config
而且可以正常使用的。
如果我不使用--enable-fashionrdr=no
這個引數禁用fashion render,configure
就可以正常執行。顯然問題不出在是不是安裝pkg-config
於是找到configure.ac
中與--enable-fashionrdr
上面的邏輯很清楚,
enable_rdr_fashion
中儲存了命令列輸入的--enable-fashionrdr
的值(enable_rdr_fashion
預設為在程式碼最開始設定為yes
),當
--enable-fashionrdr=yes
時,會執行PKG_CHECK_MODULES([MGPLUS], [mgplus >= 1.4.0])
,檢查minigui的mgplus元件是否安裝。而為no
時,不會執行這個動作。於是我做了個簡單的測試,刪除PKG_CHECK_MODULES([MGPLUS], [mgplus >= 1.4.0])
這一行,則即使不指定--enable-fashionrdr=no
,也會報錯了。所以可以總結:只要執行了
PKG_CHECK_MODULES([MGPLUS], [mgplus >= 1.4.0])
就不會報錯。
於是我做了如下修改:不論--enable-fashionrdr
為yes
或no
,都執行PKG_CHECK_MODULES([MGPLUS], [mgplus >= 1.4.0])
,就不再報錯
為什麼?!
按理說pkg-config
檢查MiniGUI
與檢查mGPlus
是相互獨立,互不影響的事件,
但是事實就是PKG_CHECK_MODULES([MGPLUS], [mgplus >= 1.4.0])
這一行是否執行會影響到後面的PKG_CHECK_MODULES([MINIGUI], [minigui >= 3.2.0])
,兩個看似沒有邏輯關係的事件產生了關聯。
太奇怪了,到現在也沒找到原因。