PKG_CHECK_MODULES for somelib++
我正在尝试使我的 C++ 中的自动工具项目链接到库,该库源自 C 库 (libsomelib.so),但也绑定到 c++ (libsomelib++.so)。我尝试使用 PKG_CHECK_MODULES 来检查此软件包是否已安装,并使用自动工具链接它。然而,这两个库都位于一个包中(c++ 版本需要配置标志),并且只有一个 .pc 文件,其中独立于配置设置,只有一行
Libs: -L${libdir} -lsomelib
没有提及 ++ 版本。我在其他程序中注意到也没有单独的 ++.pc 文件。因此自动链接 ++ 版本是不可能的。我考虑过手动添加 -lsomelib++ 到链接标志,但这相当丑陋(如果有人在没有 --with-cxx 标志的情况下编译它,它将无法工作)。我还可以通过 AC_SEARCH_LIBS 测试它是否存在,但由于它是 C++ 库,所以不是那么简单。
缺少 ++.pc 文件是软件包分发者的错误还是它是一些更深层次的想法,而我不知道如何使用它?
如果有人真的很好奇,我会说有问题的包是 ossp-uuid。
I am trying to make my autotools project in C++ link against library, that originates as C library (libsomelib.so), but also has bindings to c++ (libsomelib++.so). I ma trying to use PKG_CHECK_MODULES to check if this package is installed, and use autotools to link against it. However both libs come in one package (c++ version requires configure flag), and have only one .pc file, in which independently of configuration settings there is only line
Libs: -L${libdir} -lsomelib
without any mentioning of ++ version. There is also no separate ++.pc file that i noticed at other programs. Therefore automatic linking against ++ version is impossible. I thought about manually adding -lsomelib++ to linking flags, but that's rather ugly (and it will not work if somebody compiled it without --with-cxx flag). I could also test for it's existence by AC_SEARCH_LIBS, but since it's C++ library it's not so straightforward.
Is missing ++.pc file mistake of package distributor or is it some deeper idea, and i don't know how to use it?
If somebody is really qurious i will say that package in question is ossp-uuid.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,丢失的 ++.pc 通常暗示打包者的遗漏。
顺便说一句:如果简单 (DCE) UUID 就足够了,您可以考虑 e2fsprogs/util-linux 的 libuuid(如果您运行此操作系统)。
Yes, the missing ++.pc usually hints towards an omission on behalf of the packager.
BTW: If simple (DCE) UUIDs are sufficient, you could consider e2fsprogs/util-linux's libuuid (in case you run this OS).