Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Source code for something that won't compile has the line #include <dbus/dbus.h> but in real life that header file is in /usr/include/dbus-1.0/ Similar situation exists for the dbus-c++ package.

Why doesn't Ubuntu provide a symlink /usr/include/dbus pointing to the dbus-1.0 directory? Is this an bug in the dbus package? If intended, what it the purpose?

Is it a proper fix to add a symlink myself?

(Changing the source is not practical - there are many files, and they need to match what other people have.)


Ok, I totally misunderstood the situation, though it still comes down to a problem I think should be solved by a symlink. The dbus directory referred to in the #include statement is a deeper level directory under /usr/include/dbus-1.0/. The real problem is that the file dbus-arch-deps.h appears to be missing, but is actually stored in the weird location /usr/lib/x86_64-linux-gnu/dbus-1.0/include/dbus/ . So now, why doesn't Ubuntu provide a symlink to this in /usr/include/dbus-1.0/dbus, or actually store it there?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

dbus include paths are meant to be retrieved by a call to

pkg-config dbus-1 --cflags

you can compile a program using dbus by

cc dbus-example.c -o dbus-example $(pkg-config dbus-1 --cflags)


make dbus-example CFLAGS+="$(pkg-config dbus-1 --cflags)"

dbus headers are included by the line

#include <dbus/dbus.h>

this "weird include paths" increase the flexibility towards future versions of dbus or other architectures.

share|improve this answer

don_jones' answer seems to cover how the basic setup that will work. But it's not how it should be, there is a long development history for this.

Why? I don't have much background on this, but these what I could think of:

  • About default location or symlink /usr/include/dbus

    The system is prepared to have multiple versions of the same library which are not compatible. It will be too difficult to debug, if can't know which version is /usr/include/dbus. I'm not talking about single lib, but if all lib used this method. Even with symlinks, then you have find and check all link in the usr/include tree, it is not practical.

    So the compilation time flags are best approach for this. However, you shouldn't set this flags yourself manually, make a look on the GNU autotools. This is A brief introduction to the GNU Autotools.

  • About dbus-arch-deps.h

    Yes, it should be stored there in x86_64-linux-gnu path. As the name states, it is an architecture dependent header and you will multiple files with same name for each architecture. Starting from 12.04, Ubuntu became multiarch. (Even before 12.04, you can cross compile, different arch).

    In precise: libdbus-1-dev:i386 /usr/lib/i386-linux-gnu/dbus-1.0/include/dbus/dbus-arch-deps.h

    You don't have to include that header manually but autoconf will take care of that.

There is other alternatives, example: cmake. This question is old, but it may open the door for anyone looking for the same thing.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.