I've learn today when fixing sphinxsearch that there's a subtile difference pg_config --includedir /usr/include/pgsql -lpq when pkg-config --cflags --libs libpq -I/usr/include/pgsql -lpq I had to sed remove the -I to make software happy (otherwise I've got -I-I/usr/include/pgsql