minigui 3.2.0:对mgncs剪裁遇到的问题error: The pkg-config script could not be found or is too old.

版权声明:本文为博主原创文章,转载请注明源地址。 https://blog.csdn.net/10km/article/details/83378572

考虑到嵌入式平台的存储和运行空间都有限,在向目标平台移植时肯定要对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-fashionrdryesno,都执行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]),两个看似没有逻辑关系的事件产生了关联。
太奇怪了,到现在也没找到原因。

猜你喜欢

转载自blog.csdn.net/10km/article/details/83378572