Bug 50519

Summary: [Qt] [WK2] WebKit2 enabled build fails to link
Product: WebKit Reporter: Laszlo Gombos <laszlo.gombos>
Component: PlatformAssignee: Andras Becsi <abecsi>
Status: RESOLVED FIXED    
Severity: Normal CC: abecsi, ossy
Priority: P4 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Attachments:
Description Flags
proposed fix none

Laszlo Gombos
Reported 2010-12-04 06:42:10 PST
build-webkit --qt --minimal CONFIG+=webkit2 results in the following linnking error: /usr/bin/ld: ../WebKit2/release/libwebkit2.a(ThreadLauncherQt.o): in function WebKit::ThreadLauncher::createWebThread():ThreadLauncherQt.cpp(.text+0xea): error: undefined reference to 'WTF::createThread(void* (*)(void*), void*, char const*)' /usr/bin/ld: ../WebKit2/release/libwebkit2.a(WebProcess.o): in function WebKit::WebProcess::initialize(QString, RunLoop*):WebProcess.cpp(.text+0x1852): error: undefined reference to 'WTF::createThread(void* (*)(void*), void*, char const*)' collect2: ld returned 1 exit status make[1]: *** [../lib/libQtWebKit.so.4.9.0] Error 1
Attachments
proposed fix (13.39 KB, patch)
2010-12-20 07:23 PST, Andras Becsi
no flags
Andras Becsi
Comment 1 2010-12-20 07:23:32 PST
Created attachment 76996 [details] proposed fix This patch also adds missing ENABLE(DATABASE) guards to fix the build. The linking issue is caused by a more complex problem. In a default WebKit2 build WebCore links to the static jscore library, and because some parts of WebCore (IconDatabase, ImageResizerThread, DatabaseThread, LocalStorageThread, WorkerThread) are using createThread, the linker doesn't remove the symbol so it is present afterwards when linking to the static webkit2 lib, but in a minimal build these parts are guarded by various ENABLE guards so because they are not needed in WebCore the linker removes the symbol, but the WebKit2 ThreadLauncher nonetheless needs the symbol, hence the linking fails. This patch adds -whole-archive to JavaScriptCore.pri's addJavaScriptCoreLib to explicitly force the linker to keep all the symbols of the archive. This is only a workaround and should serve as a temporary solution until we find a proper solution, how to refactor the build system.
Andras Becsi
Comment 2 2010-12-20 07:29:16 PST
(In reply to comment #1) > Created an attachment (id=76996) [details] > proposed fix > > This patch also adds missing ENABLE(DATABASE) guards to fix the build. > > The linking issue is caused by a more complex problem. > In a default WebKit2 build WebCore links to the static jscore library, and because some parts of WebCore (IconDatabase, ImageResizerThread, DatabaseThread, LocalStorageThread, WorkerThread) are using createThread, the linker doesn't remove the symbol so it is present afterwards when linking to the static webkit2 lib, but in a minimal build these parts are guarded by various ENABLE guards so because they are not needed in WebCore the linker removes the symbol, but the WebKit2 ThreadLauncher nonetheless needs the symbol, hence the linking fails. > This patch adds -whole-archive to JavaScriptCore.pri's addJavaScriptCoreLib to explicitly force the linker to keep all the symbols of the archive. > > This is only a workaround and should serve as a temporary solution until we find a proper solution, how to refactor the build system. The whole-archive change should be inside a webkit2 guard, but before I update the patch I'll wait for some opinions.
Laszlo Gombos
Comment 3 2010-12-20 09:47:31 PST
This perhaps is another reason to _not_ build WebKit2 as a separate library - and instead build it into the WebKit library directly like many other WebKit features.
Kenneth Rohde Christiansen
Comment 4 2010-12-24 03:06:19 PST
Comment on attachment 76996 [details] proposed fix View in context: https://bugs.webkit.org/attachment.cgi?id=76996&action=review > JavaScriptCore/JavaScriptCore.pri:88 > - LIBS += -l$$JAVASCRIPTCORE_TARGET > + LIBS += -Wl,-whole-archive -l$$JAVASCRIPTCORE_TARGET -Wl,-no-whole-archive I think this change is different from the rest of this patch. Please split up.
Andras Becsi
Comment 5 2011-01-20 10:20:08 PST
A workaround to use whole-archive was landed in r76263 which fixes the issue for now until the build system gets redesigned. (See https://bugs.webkit.org/show_bug.cgi?id=51339) Closing this bug.
Note You need to log in before you can comment on or make changes to this bug.