Bug 22811 - Underlinking in Programs_UnitTests (GTK+ build)
Summary: Underlinking in Programs_UnitTests (GTK+ build)
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2008-12-11 14:27 PST by Adam Williamson
Modified: 2009-02-19 13:43 PST (History)
1 user (show)

See Also:

underlink fix (316 bytes, patch)
2008-12-11 14:29 PST, Adam Williamson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Williamson 2008-12-11 14:27:07 PST
Since the unit tests were added to the webkit GTK+ build by zecke (in 39082), there's a linking problem. If you build with -Wl,--as-needed -Wl,--no-undefined (which strictly exposes underlinking issues), the build fails with the following:

gcc -fno-strict-aliasing -O2 -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fno-exceptions -fvisibility=hidden -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -O2 -Wl,--as-needed -Wl,--no-undefined -o Programs/.libs/UnitTests WebKit/gtk/tests/Programs_UnitTests-main.o  ./.libs/libwebkit-1.0.so /usr/lib64/libgtk-x11-2.0.so /usr/lib64/libgdk-x11-2.0.so /usr/lib64/libatk-1.0.so /usr/lib64/libgio-2.0.so /usr/lib64/libpangoft2-1.0.so /usr/lib64/libgdk_pixbuf-2.0.so /usr/lib64/libpangocairo-1.0.so /usr/lib64/libcairo.so /usr/lib64/libpango-1.0.so /usr/lib64/libfreetype.so -lz /usr/lib64/libfontconfig.so /usr/lib64/libgobject-2.0.so /usr/lib64/libgmodule-2.0.so /usr/lib64/libglib-2.0.so 
WebKit/gtk/tests/Programs_UnitTests-main.o: In function `main':
/home/mandrake/rpm/BUILD/WebKit-r39090/WebKit/gtk/tests/main.c:27: undefined reference to `g_thread_init'

The attached patch fixes this - I'm not sure if it's a correct fix, it may be overbroad, but I couldn't find a LIBS variable which seemed more correct, so I just added GLOBALDEPS_LIBS.
Comment 1 Adam Williamson 2008-12-11 14:29:13 PST
Created attachment 25964 [details]
underlink fix
Comment 2 Jan Alonzo 2009-02-19 12:37:41 PST
Comment on attachment 25964 [details]
underlink fix

> --- WebKit-r39090/GNUmakefile.am	2008-12-07 19:56:15.000000000 -0800
> +++ WebKit-r39090/GNUmakefile.am.new	2008-12-11 13:09:30.000000000 -0800
> @@ -481,7 +481,9 @@
>  Programs_UnitTests_LDADD = \
>  	libwebkit-1.0.la \
> -	$(GTK_LIBS)
> +	$(GTK_LIBS)	\
> +	

Hi! GLOBALDEPS_LIBS is too much. Please link against GLIB_LIBS instead.

Comment 3 Adam Williamson 2009-02-19 12:47:52 PST
Ah, thanks. I figured there was a less huge variable I could use, but couldn't figure out what it was :)
Comment 4 Christian Dywan 2009-02-19 13:43:18 PST
2009-02-19  Christian Dywan  <christian@twotoasts.de>

        Rubber-stamped by Holger Freyther.

        Underlinking in Programs_UnitTests (GTK+ build)

        * GNUmakefile.am: Add GLIB_LIBS to unit test library flags.