Hi,
I'm trying to use:
go tool cgo -godefs defs.go
to generate some definitions. Unfortunately on two machines (OSX 10.11.3 and CentOS6) with v1.5.3, it refuses to find glib.h, failing with:
In file included from vips.h:2,
from /home/karl.austin/go/src/mylib/defs.go:6:
/usr/local/include/vips/vips.h:85:18: error: glib.h: No such file or directory
/usr/local/include/vips/vips.h:86:25: error: glib/gstdio.h: No such file or directory
/usr/local/include/vips/vips.h:87:21: error: gmodule.h: No such file or directory
/usr/local/include/vips/vips.h:88:25: error: glib-object.h: No such file or directory
Contents of defs.go:
package mylib
/*
#cgo pkg-config: vips#include "vips.h"
*/
import "C"
<type defs here>
vips.h has the following includes:
#include <stdlib.h>
#include <vips/vips.h>
#include <vips/vips7compat.h>
Output from pkg-config:
pkg-config --libs vips
-pthread -lvips -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0
pkg-config --cflags vips
-pthread -fopenmp -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libxml2 -I/usr/include/ImageMagick -I/usr/include/libpng12
It's the same if I specify CFLAGS and LDFLAGS manually instead of using pkg-config. glib.h is in the directory where pkg-config thinks it is:
/usr/include/glib-2.0/glib.h
I'm at a loss as to what to try next. Any pointers in the right direction would be appreciated, I must be doing something stupid, but I've been staring at it for so long now I can't see what.