11

I have been trying to compile a program for dbus and as suggested I did in the code as mention to a similar question. I did execute it as shown:

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`

I am still getting the following error:

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 

I installed the above mentioned packages, but still the error persists.

gung - Reinstate Monica
  • 11,583
  • 7
  • 60
  • 79
vku
  • 175
  • 1
  • 1
  • 10

1 Answers1

23

Have you installed the development packages for those libraries, or just the libraries themselves? On Debian/Ubuntu, you want libdbus-glib-1-dev and similar -dev packages for the others; on Fedora, you want dbus-glib-devel and similar.

wjt
  • 970
  • 7
  • 16
  • I'm curious about how you knew to install these packages. This solved my problem on Fedora, but I had no idea this package existed. Where should I have looked? thanks – natersoz Jul 29 '18 at 17:42
  • 1
    On Fedora you can check what provides a pkg-config package by running `dnf provides 'pkgconfig(dbus-glib-1)'` or just directly install whatever provides it with `dnf install 'pkgconfig(dbus-glib-1)'`. – wjt Jul 30 '18 at 08:08
  • 1
    `dnf search dbus-glib` would also have helped. I knew to install these packages after a decade of developing software using these libraries! – wjt Jul 30 '18 at 08:10