Mir

mir_client_library.h includes non-existent file "mir_toolkit/c_types.h"

Bug #1161064 reported by Sturm Flut
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mir
Invalid
High
Unassigned

Bug Description

As reported to alan_g on the #ubuntu-mir IRC channel:

I installed all Mir packages from the mir-team/staging PPA and started writing a minimal Mir client outside of the Mir codebase. At the beginning of my code I

#include <mir/client/mir_toolkit/mir_client_library.h>

which in turn includes

#include "mir_toolkit/c_types.h"
#include <mir_toolkit/common.h>

The first include, "mir_toolkit/c_types.h", cannot be resolved since the wanted header file resides in /usr/include/mir/client/mir_toolkit/c_types.h and /usr/include/mir/client/ is not part of the default include path of the C compiler. IMO there are two solutions to this:

1. /usr/include/mir/client/ has to be manually added to the compiler include path, which is unexpected since one part of the header files is specified relative to the default include path and the other part not

2. /usr/include/mir/client/mir_toolkit/mir_client_library.h has to be modified to include

#include <mir/client/mir_toolkit/c_types.h>
#include <mir_toolkit/common.h>

which resolves everything gracefully.

Steps to reprodce:
1. Copy one of the examples to a path outside of the mir codebase, e.g. cp examples/demo_client_unaccelerated.c /tmp/mirclient.c
2. Substitute #include "mir_toolkit/mir_client_library.h" with #include <mir/client/mir_toolkit/mir_client_library.h>
3. Compile:

sturmflut@fire:/tmp$ LANG=C gcc -std=c99 -o /tmp/mirclient /tmp/mirclient.c -lmirclient
In file included from /tmp/mirclient.c:19:0:
/usr/include/mir/client/mir_toolkit/mir_client_library.h:21:33: fatal error: mir_toolkit/c_types.h: No such file or directory
compilation terminated.

summary: - Mir client header files seem to be incorrect
+ mir_client_library.h includes non-existent file "mir_toolkit/c_types.h"
Changed in mir:
importance: Undecided → High
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Currently, the correct way to get the include path for those common headers is to take the output of:
   pkg-config mircommon --cflags
So in GNU make you would:
   CFLAGS += $(shell pkg-config mircommon --cflags)

However, there is an extra problem here. Using pkgconfig "mirclient" should automatically include "mircommon" and its cflags. But it doesn't.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I take that back. It already works perfectly. You need to use:
    pkg-config mirclient --cflags
and that will give you the common include path too, which allows you to find "mir_toolkit/c_types.h".

So please try adding that to your cflags.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I agree it is not nice that Mir client development forces you to use pkg-config to find headers. I raised this concern when the change was made. Although Mir is not the only SDK that forces you to use pkg-config.

Changed in mir:
status: New → Incomplete
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Full example of how to compile external clients:

1. If mir was not installed to a system directory, but locally, you will need to set:
  export PKG_CONFIG_PATH=$mirdir/lib/pkgconfig

2. gcc -std=c99 -o demo demo_client.c `pkg-config mirclient --cflags --libs`

This works right now. So bug invalid.

Changed in mir:
status: Incomplete → Invalid
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Daniel, It doesn't force you to use pkg-config to use the Mir libraries, this is just the easiest method. Note of course you can just do a -I/usr/include/mirclient -I/usr/include/mircommon yourself and it would work fine.

The fact is the old style /usr/include/foo just doesn't hold up to modern requirements (i.e. versioning of libraries).

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Robert, I know. Discussion continues in bug 1161240.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.