macos 使用 pkg-config 宏 PKG_CHECK_MODULES 失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8578181/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using the pkg-config macro PKG_CHECK_MODULES failing
提问by ericg
I'm sure this is a fairly simple problem. I have a very simple configure.ac file which I am using to just learn how autoconf & pkg-config work together. The confgure.ac
file looks like:
我确信这是一个相当简单的问题。我有一个非常简单的 configure.ac 文件,我用它来学习 autoconf 和 pkg-config 如何协同工作。该confgure.ac
文件如下所示:
AC_PREREQ(2.61)
AC_INIT(autoconf_test, 1.0, [email protected])
PKG_CHECK_MODULES(libusbmuxd, libusbmuxd >= 0.1.4)
I can then execute autoconf from the command line and it does produce a configure script. However, when I run the configure script, I get the following error:
然后我可以从命令行执行 autoconf,它会生成一个配置脚本。但是,当我运行配置脚本时,出现以下错误:
./configure: line 1618: syntax error near unexpected token `libusbmuxd,'
./configure: line 1618: `PKG_CHECK_MODULES(libusbmuxd, libusbmuxd >= 0.1.4)'
If I use the pkg-config program from the command line to check to see whether it can find this library, it succeeds.
如果我从命令行使用 pkg-config 程序来检查它是否可以找到这个库,它就成功了。
/usr/lib/pkgconfig $pkg-config --libs --cflags --modversion libusbmuxd
1.0.7
-I/usr/local/Cellar/usbmuxd/1.0.7/include -L/usr/local/Cellar/usbmuxd/1.0.7/lib -lusbmuxd
So, it seems clear that for some reason the PGK_CHECK_MODULE
macro cannot be located and I am not sure why.
所以,很明显,由于某种原因PGK_CHECK_MODULE
无法找到宏,我不确定为什么。
This probably isn't OS specific, but I am using Mac OS X 10.6.8.
这可能不是特定于操作系统的,但我使用的是 Mac OS X 10.6.8。
回答by William Pursell
When you are bootstrapping (ie, running autoreconf), aclocal is unable to find pkg.m4. This is because pkg-config was either not installed or has been installed somewhere that aclocal does not know about. (ie, it was installed with a different prefix than automake.) There is actually a large school of thought that says that the best way to use pkg-config with the autotools is to not use it. If you look through the autoconf mailing list archive, you will see this debated ad-nauseum. I'm not saying that you should avoid using pkg-config (although I do believe it is best to do so), but please be aware that many people to recommend avoiding it completely.
当您进行引导(即运行 autoreconf)时,aclocal 无法找到 pkg.m4。这是因为 pkg-config 要么没有安装,要么已经安装在 aclocal 不知道的地方。(即,它安装时使用的前缀与 automake 不同。)实际上,有很多观点认为将 pkg-config 与 autotools 一起使用的最佳方法是不使用它。如果您查看 autoconf 邮件列表存档,您将看到这个争论不休的广告。我并不是说你应该避免使用 pkg-config(虽然我相信这样做是最好的),但请注意,很多人建议完全避免使用它。
回答by Sean Martin
It seems the homebrew people decided this wasn't their problem and swept it into a warning. super frustrating since no one will see since no one is using homebrew or automake and expecting to have to dig deep into the details of what is wrong. Here's the link.
似乎自制软件的人认为这不是他们的问题,并把它变成了警告。超级令人沮丧,因为没有人会看到,因为没有人使用自制软件或汽车制造,并期望深入挖掘错误的细节。这是链接。