Webkit-gtk2 not found when building third party software

Hello, I've installed webkit-gtk2 and gtk20 in order to build surf, the browser from suckless.org.
The files have been installed in /usr/local/include and /usr/local/lib as expected.
When i try building surf, these library aren't found, errors about it are spitted to stdout and the build fails.
In the config.mk file, i've changes the /usr/lib to /usr/local/lib and the /usr/include to /usr/local/include but it wasn't sufficient.
Any Idea about what i could have missed.
 
Here is the begin of the build command output :
Code:
%make clean install
cleaning
surf build options:
CFLAGS   = -std=c99 -pedantic -Wall -Os -I. -I/usr/local/include  -DVERSION="0.4"
LDFLAGS  = -s -L/usr/local/lib -lc  -lgthread-2.0
CC       = cc
CC surf.c
surf.c:8:21: error: gtk/gtk.h: No such file or directory
surf.c:9:22: error: gdk/gdkx.h: No such file or directory
surf.c:10:21: error: gdk/gdk.h: No such file or directory
surf.c:11:28: error: gdk/gdkkeysyms.h: No such file or directory
surf.c:18:27: error: webkit/webkit.h: No such file or directory
surf.c:19:25: error: glib/gstdio.h: No such file or directory
surf.c:20:39: error: JavaScriptCore/JavaScript.h: No such file or directory

And here is the config.mk :
Code:
# surf version
VERSION = 0.4

# Customize below to fit your system

# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man

GTKINC=$(shell pkg-config --cflags gtk+-2.0 webkit-1.0)
GTKLIB=$(shell pkg-config --libs gtk+-2.0 webkit-1.0)

# includes and libs
#INCS = -I. -I/usr/include ${GTKINC}
#LIBS = -L/usr/lib -lc ${GTKLIB} -lgthread-2.0
INCS = -I. -I/usr/local/include ${GTKINC} 
LIBS = -L/usr/local/lib -lc ${GTKLIB} -lgthread-2.0

# flags
CPPFLAGS = -DVERSION=\"${VERSION}\"
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS = -s ${LIBS}

# Solaris
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = ${LIBS}

# compiler and linker
CC = cc
Hope it can give someone a hint about what is wrong...
 
The compiler doesn't find various include files (gtk, webkit, ...).
Did you install gtk and webkit from ports?

Check the output of:
$ pkg-config --cflags gtk+-2.0 webkit-1.0
$ pkg-config --libs gtk+-2.0 webkit-1.0

These should give the correct flags for compiling/linking. If not, then probably there's something wrong with your installation of gtk and/or webkit.
 
  • Thanks
Reactions: eol
I put the output of the two commands in correct place in config.mk and now it builds just fine!

Thanks a lot!

I don't understand why it didn't work as expected sooner.
Code:
GTKINC=$(shell pkg-config --cflags gtk+-2.0 webkit-1.0)
GTKLIB=$(shell pkg-config --libs gtk+-2.0 webkit-1.0)
What was wrong with these two lines?

Excuse me if my questions are naives, my freebsd install is one day old and that's my first one so I'm at bottom my learning curve. :)
 
I guess these are gmake specific, and you probably used make.

See the following test Makefile:
Code:
GTKINC=$(shell pkg-config --cflags gtk+-2.0 webkit-1.0)
GTKLIB=$(shell pkg-config --libs gtk+-2.0 webkit-1.0)

honk:
        @echo $(GTKINC)
        @echo $(GTKLIB)

gives...

Code:
[CMD="$"]make honk[/CMD]

[CMD="$"]gmake honk[/CMD]
-D_THREAD_SAFE -I/usr/local/include/gtk-2.0 -I/usr/local/lib/gtk-2.0/include -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr
/local/include/pango-1.0 -I/usr/local/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/pixman-1 
-I/usr/local/include/freetype2 -I/usr/local/include/webkit-1.0 -I/usr/local/include/webkit-1.0/webkit -I/usr/local/include/libsoup-2.4 -I/usr
/local/include/libxml2 -pthread -L/usr/local/lib -lwebkit-1.0 -lgtk-x11-2.0 -lsoup-2.4 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 
-lpangocairo-1.0 -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lpangoft2-1.0 -lXfixes -lcairo -lX11 -lpango-1.0 
-lm -lfreetype -lfontconfig -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0
 
Interestingly, if the creator of that Makefile would have used:
Code:
GTKINC=`pkg-config --cflags gtk+-2.0 webkit-1.0`
GTKLIB=`pkg-config --libs gtk+-2.0 webkit-1.0`

... it *would* work with make *and* gmake :P
 
  • Thanks
Reactions: eol
mickey said:
Interestingly, if the creator of that Makefile would have used:
Code:
GTKINC=`pkg-config --cflags gtk+-2.0 webkit-1.0`
GTKLIB=`pkg-config --libs gtk+-2.0 webkit-1.0`

... it *would* work with make *and* gmake :P

You're right, i applied this last solution in the config.mk file as it's easier to read on that the sustitution of the full command output.

I gave feedback upstream about the build issue and the solution you provided.
Thank you again.
 
Back
Top