help needed to compile a C program

macports at macports at
Fri Apr 13 16:21:56 UTC 2018

I'm trying to use DejaVu fonts in rrdtool and it fails; rrdtool depends on pango, and currently I think that pango is my bottleneck.
To verify this I found a tiny program ( <>) that fails to compile.

#include <glib.h>
#include <pango/pangocairo.h>

static void
list_fonts ()
    int i;
    PangoFontFamily ** families;
    int n_families;
    PangoFontMap * fontmap;

    fontmap = pango_cairo_font_map_get_default();
    pango_font_map_list_families (fontmap, & families, & n_families);
    printf ("There are %d families\n", n_families);
    for (i = 0; i < n_families; i++) {
        PangoFontFamily * family = families[i];
        const char * family_name;

        family_name = pango_font_family_get_name (family);
        printf ("Family %d: %s\n", i, family_name);
    g_free (families);

int main (int argc, char ** argv)
    list_fonts ();
    return 0;

with makefile:
pango-list-typefaces:   pango-list-typefaces.c
        cc -o $@ -Wall -g pango-list-typefaces.c \
        $(pkg-config --cflags --libs pango) \
        $(pkg-config --cflags --libs cairo) \
        $(pkg-config --cflags --libs pangocairo) \Currently 
        $(pkg-config --cflags --libs glib-2.0)

and error:
make pango-list-typefaces
cc     pango-list-typefaces.c   -o pango-list-typefaces
pango-list-typefaces.c:1:10: fatal error: 'glib.h' file not found
#include "glib.h"
1 error generated.

- What does Macports do for includes/libraries/etc, or -if nothing- what should I do to use them from Macports?

Currently I have glib2 installed, but there is also glib2-devel, and they conflict with each other.
Same for pango and pango-devel.
- What is the difference?
- Which should I use?

I don't know what the include path will be. 
- How should I use 'port provides glib.h' ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the macports-users mailing list