Bug 18996 - Build of WebKit Qt fails on Linux due to .pri file problem.
Summary: Build of WebKit Qt fails on Linux due to .pri file problem.
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-11 05:21 PDT by Clemmitt Sigler
Modified: 2008-06-09 17:39 PDT (History)
2 users (show)

See Also:


Attachments
Patch for pcre.pri to remove independent compilation of chartables.c (688 bytes, patch)
2008-05-18 04:48 PDT, Clemmitt Sigler
hausmann: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Clemmitt Sigler 2008-05-11 05:21:45 PDT
Building WebKit Qt on Linux i386, Gentoo, gentoo-sources-2.6.24-r7, gcc version 4.1.2 (Gentoo 4.1.2 p1.0.2), qt-4.3.3:

Building via command `WebKit/WebKitTools/Scripts/build-webkit --qt' fails to link libQtWebKit.so.4.3.3 due to multiply defining the array kjs_pcre_default_tables from source file WebKit/JavaScriptCore/pcre/chartables.c.

The problem is that WebKit/JavaScriptCore/pcre/pcre_tables.cpp now has as its last statement '#include "chartables.c",' but WebKit/JavaScriptCore/pcre/pcre.pri adds this generator at the end:

# GENERATOR: "chartables.c": compile and execute the chartables generator (and add it to sources)
DFTABLES = $$PWD/dftables
ctgen.input = DFTABLES
ctgen.output = $$GENERATED_SOURCES_DIR/chartables.c
ctgen.commands = perl $$DFTABLES ${QMAKE_FILE_OUT}
ctgen.CONFIG += target_predeps no_link
ctgen.variable_out = GENERATED_SOURCES
ctgen.dependency_type = TYPE_C
ctgen.clean = ${QMAKE_FILE_OUT} ${QMAKE_VAR_GENERATED_SOURCES_DIR}${QMAKE_FILE_BASE}
addExtraCompiler(ctgen)

Patch for WebKit/JavaScriptCore/pcre/pcre.pri:
================================================
--- WebKit/JavaScriptCore/pcre/pcre.pri.orig    2008-04-24 18:00:00.000000000 -0400
+++ WebKit/JavaScriptCore/pcre/pcre.pri 2008-05-10 08:59:39.000000000 -0400
@@ -21,14 +21,3 @@
         return(true)
     }
 }
-
-# GENERATOR: "chartables.c": compile and execute the chartables generator (and add it to sources)
-DFTABLES = $$PWD/dftables
-ctgen.input = DFTABLES
-ctgen.output = $$GENERATED_SOURCES_DIR/chartables.c
-ctgen.commands = perl $$DFTABLES ${QMAKE_FILE_OUT}
-ctgen.CONFIG += target_predeps no_link
-ctgen.variable_out = GENERATED_SOURCES
-ctgen.dependency_type = TYPE_C
-ctgen.clean = ${QMAKE_FILE_OUT} ${QMAKE_VAR_GENERATED_SOURCES_DIR}${QMAKE_FILE_BASE}
-addExtraCompiler(ctgen)
================================================

HTH.

Clemmitt Sigler
Comment 1 Clemmitt Sigler 2008-05-18 04:48:01 PDT
Created attachment 21220 [details]
Patch for pcre.pri to remove independent compilation of chartables.c

Patch for pcre.pri to remove independent compilation of chartables.c, which is #include'd in pcre_tables.cpp.  This is for the Qt/qmake build.   Without this patch, kjs_pcre_default_tables is doubly defined, causing linking to fail with an error.  I'm running Gentoo Linux with kernel 2.6.24-gentoo-r7, gcc version Gentoo 4.1.2 p1.0.2, glibc-2.6.1, and Qt Open Source Edition version 4.3.3.
Comment 2 Clemmitt Sigler 2008-05-18 04:56:31 PDT
(In reply to comment #0)

This issue caused my build to fail *every*time*.  As such, I'm a little surprised that the build appears to be working elsewhere (like here:

http://build.webkit.org/builders/trunk-qt-linux-release )

Is this a WORKSFORME resolution?  If so, I can't figure out why this wouldn't cause a problem for everyone.  The way the qmake build is currently configured, it seems certain to me that the array kjs_pcre_default_tables will be doubly defined.  Shouldn't this cause a fatal linker error every time?  Or am I batty?  TIA.

Clemmitt Sigler
Comment 3 Clemmitt Sigler 2008-05-27 20:23:18 PDT
(In reply to comment #2)

Hello once more,

Has anyone triaged this bug yet?  I double-checked my WebKit SVN tree to make sure nothing was in error, and there were no problems with the downloaded code.  I *still* can't get the Linux/*NIX WebKit QT build to complete without this error while building libQtWebKit.so.4.3.3.  The only solution I've found is to patch pcre.pri as I've attached.  Then it all builds without error and works as expected.

Thought I'd try to raise someone's interest one last time.  TIA.

Clemmitt Sigler
Comment 4 Pierre-Luc Beaudoin 2008-05-29 12:08:18 PDT
I believe this bug hasn't been triaged yet because most of the devs are using Qt 4.4, so we can't verify you're assumptions. 
Comment 5 Clemmitt Sigler 2008-05-30 10:20:21 PDT
(In reply to comment #4)
> I believe this bug hasn't been triaged yet because most of the devs are using
> Qt 4.4, so we can't verify you're assumptions. 

Thanks for the reply :^)

It's true that I'm not a Qmake expert.  However, if I understand the way the .pro/.pri files work (I do know how a "#include chartables.c" preprocesser statement works!), it seems to me that chartables.c would both be included in the compiled pcre_tables.o object file and also be compiled separately into chartables.o, so that when the .so is linked the array kjs_pcre_default_tables must be doubly defined.  It looks to me like there's no way around this error.

Am I nuts?  Am I just plain wrong?  Does the Qt V4.4 Qmake pick up on this multiple definition and correct for it automatically?  Sorry for being so dense.

Clemmitt Sigler
Comment 6 Simon Hausmann 2008-06-04 12:13:14 PDT
Comment on attachment 21220 [details]
Patch for pcre.pri to remove independent compilation of chartables.c

I'm sorry, this patch looks wrong to me. The purpose of this rule in pcre.pri is to _generate_ chartables.c, so it can be included from pcre_tables.c. Without this rule in a clean build environment chartables.c is not generated at all. Could it be that you have a stable chartables.c somewhere? Or did you perhaps modify some other file so that the file is generated twice for you? Can you check the generated Makefile for traces of chartables.c after you have applied your patch?
Comment 7 Clemmitt Sigler 2008-06-09 17:39:12 PDT
(In reply to comment #6)
> (From update of attachment 21220 [details] [edit])
> I'm sorry, this patch looks wrong to me. The purpose of this rule in pcre.pri
> is to _generate_ chartables.c, so it can be included from pcre_tables.c.
> Without this rule in a clean build environment chartables.c is not generated
> at all. Could it be that you have a stable chartables.c somewhere?

Thanks for your reply :^)  Sorry this has taken me so long to reply to.  This is clearly my error.  I'm not sure when/how this problem entered my build tree.  I found chartables.c and chartables.o files in these subdirs:

WebKitBuild/Release/JavaScriptCore/kjs/tmp/
WebKitBuild/Release/WebCore/tmp/

and also this remnant file:

JavaScriptCore/pcre/.deps/libJavaScriptCore_la-chartables.Plo

These were left over even after running `WebKitTools/Scripts/build-webkit --qt --clean'.  I removed these files, cleaned the tree again, and now the Qt build works correctly every time _without_ the pcre.pri patch I attached.

Closing this bug report as WORKSFORME.  Thanks again.

Clemmitt Sigler