Bug 36826

Summary: [Qt] QtWebkit.pc is broken
Product: WebKit Reporter: Fathi Boudra <fabo>
Component: Tools / TestsAssignee: Jocelyn Turcotte <jturcotte>
Status: CLOSED FIXED    
Severity: Critical CC: debfx, hausmann, jturcotte, laszlo.gombos, rclbelem
Priority: P2 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Bug Depends on:    
Bug Blocks: 35784    
Attachments:
Description Flags
broken pkgconfig file
none
Patch that might help
none
correct QtWebKit.pc generated from Qt source
none
Patch hausmann: review+

Description Fathi Boudra 2010-03-30 08:00:32 PDT
QtWebKit.pc is broken.

See libdir and Libs.private values:
libdir=${prefi/usr/lib
Libs.private: -L../JavaScriptCore -L/usr/X11/usr/lib -L/u/usr/lib -ljscore -lXrender -lsqlite3 -lphonon -lQtXmlPatterns -lQtGui -lQtNetwork -lQtCore -lpthread -lXext -lX11 -lm

Same code is used to generate the pkgconfig file on Qt 4.6.2 but is not reproducible with QtWebKit from Qt 4.6.2 source code.
Comment 1 Fathi Boudra 2010-03-30 08:01:49 PDT
Created attachment 52039 [details]
broken pkgconfig file
Comment 2 Jocelyn Turcotte 2010-03-30 11:02:25 PDT
Created attachment 52055 [details]
Patch that might help

Can you try with this patch in trunk?
Comment 3 Jocelyn Turcotte 2010-03-31 08:22:35 PDT
(In reply to comment #2)
> Created an attachment (id=52055) [details]
> Patch that might help
> 
> Can you try with this patch in trunk?

Sorry it won't work, against what I thought, LIBS_PRIVATE is only available for static library targets.

By looking at pkg-config's documentation, Libs.private is used when the application would link QtWebKit statically, which we want to drop support to be able to build JavaScriptCore as a static library to use aggressive optimization exclusively for it.

What exactly is the problem at the end?
Do you need static linking against QtWebKit?
Can you omit the Libs.private line when generating the .pc file?
Comment 4 Fathi Boudra 2010-04-05 00:26:49 PDT
some values are truncated.

see libdir value: "${prefi/usr/lib"
it should be "${prefix}/lib" instead of "${prefi/usr/lib".

same for Libs.private, see "-L/usr/X11/usr/lib" and "-L/u/usr/lib" strings.
it should be "-L/usr/lib/X11" and "-L/usr/lib".

That's the problem.
Comment 5 Fathi Boudra 2010-04-05 00:30:04 PDT
Created attachment 52519 [details]
correct QtWebKit.pc generated from Qt source

correct QtWebKit.pc generated from Qt 4.6.2 source
Comment 6 Felix Geyer 2010-05-30 04:30:01 PDT
*** Bug 39573 has been marked as a duplicate of this bug. ***
Comment 7 Felix Geyer 2010-05-30 04:33:26 PDT
From my duplicate bug report:

The following commands in WebCore/WebCore.pro can corrupt QtWebKit.pc:
lib_replace.match = $$DESTDIR
lib_replace.replace = $$[QT_INSTALL_LIBS]
QMAKE_PKGCONFIG_INSTALL_REPLACE += lib_replace

The problem is that .match/.replace doesn't replace plain strings but regular expressions.

If $$DESTDIR == "../lib", the resulting command is:
sed -e "s,../lib,/usr/lib,g" "../lib/pkgconfig/QtWebKit.pc" >"/build/buildd/qtwebkit-4.7~beta1/debian/tmp/usr/lib/pkgconfig/QtWebKit.pc"

"." matches any character so "libdir=${prefix}/lib" is being replaced by "libdir=${prefi/usr/lib".

I'm not sure why this path replacement is needed at all.
Comment 8 Jocelyn Turcotte 2010-06-01 05:43:32 PDT
Created attachment 57532 [details]
Patch

Thanks for the investigation, this patch should fix the problem.
Comment 9 Simon Hausmann 2010-06-01 06:26:15 PDT
Comment on attachment 57532 [details]
Patch

Landing by hand
Comment 10 Simon Hausmann 2010-06-01 06:26:59 PDT
Committed r60475: <http://trac.webkit.org/changeset/60475>
Comment 11 Simon Hausmann 2010-06-01 06:28:26 PDT
Revision r60475 cherry-picked into qtwebkit-2.0 with commit 9a83f22bc41a2016b6bbf495bfd32b3a659038c8
Comment 12 Simon Hausmann 2010-06-01 07:35:34 PDT
(In reply to comment #11)
> Revision r60475 cherry-picked into qtwebkit-2.0 with commit 9a83f22bc41a2016b6bbf495bfd32b3a659038c8

Sorry, the correct sha1 in 19f3a076250e739dde943683f5b3abd44ff916be