【问题标题】:D-Bus linking issueD-Bus 链接问题
【发布时间】:2013-02-20 18:49:24
【问题描述】:

我一直在尝试为dbus 编译一个程序,并且正如我在代码中提到的类似问题所建议的那样。如图所示,我确实执行了它:

gcc `pkg-config --cflags dbus-glib-1` \
  `pkg-config --cflags dbus-1` \
  `pkg-config --cflags glib-2.0` \
   dbus-example.c \
  `pkg-config --libs dbus-glib-1` \
  `pkg-config --libs dbus-1` \
  `pkg-config --libs glib-2.0`

我仍然收到以下错误:

Package dbus-glib-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `dbus-glib-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'dbus-glib-1' found
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found
Package dbus-glib-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `dbus-glib-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'dbus-glib-1' found
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found 

我安装了上述软件包,但错误仍然存​​在。

【问题讨论】:

    标签: linker-errors dbus pkg-config


    【解决方案1】:

    您是否安装了这些库的开发包,还是仅安装了这些库本身?在 Debian/Ubuntu 上,您需要 libdbus-glib-1-dev 和其他类似的 -dev 软件包;在 Fedora 上,你需要 dbus-glib-devel 和类似的。

    【讨论】:

    • 我很好奇您是如何知道安装这些软件包的。这解决了我在 Fedora 上的问题,但我不知道这个包存在。我应该去哪里看?谢谢
    • 在 Fedora 上,您可以通过运行 dnf provides 'pkgconfig(dbus-glib-1)' 来检查提供 pkg-config 软件包的内容,或者直接安装 dnf install 'pkgconfig(dbus-glib-1)' 提供的任何内容。
    • dnf search dbus-glib 也会有所帮助。在使用这些库开发软件十年后,我知道要安装这些软件包!
    猜你喜欢
    • 2018-06-26
    • 1970-01-01
    • 1970-01-01
    • 2011-10-29
    • 2015-08-17
    • 2010-12-01
    • 2011-12-08
    • 2019-10-10
    • 2018-12-09
    相关资源
    最近更新 更多