[webkit-qt] Trouble building QtWebKit
Srinath Avadhanula
srinathava at gmail.com
Mon Mar 21 11:33:14 PDT 2011
Hi,
After some digging around, I finally figured out what was going on. I
am capturing it here for the sake of the next guy who might have the
same problem and uses google...
On Fri, Mar 18, 2011 at 8:47 PM, Srinath Avadhanula
<srinathava at gmail.com> wrote:
>
> make[2]: Entering directory `/local/savadhan/tmp/webkit/WebKitBuild/Release/WebKit/qt/tests/qwebframe'
> g++ -m64 -Wl,-O1 -Wl,-rpath,/local/savadhan/tmp/webkit/WebKitBuild/Release/lib -Wl,-rpath,/local/savadhan/QtSDK/Desktop/Qt/472/gcc/lib -o tst_qwebframe obj/release/tst_qwebframe.o obj/release/qrc_tst_qwebframe.o -L/local/savadhan/tmp/webkit/WebKitBuild/Release/lib -L/local/savadhan/QtSDK/Desktop/Qt/472/gcc/lib -lQtWebKit -lQtDeclarative -lQtTest -lQtGui -lQtNetwork -lQtCore -lpthread
> obj/release/tst_qwebframe.o: In function `MyQObject::qt_metacall(QMetaObject::Call, int, void**)':
> tst_qwebframe.cpp:(.text+0xfe5): undefined reference to `QWebElement::QWebElement(QWebElement const&)'
> tst_qwebframe.cpp:(.text+0xff0): undefined reference to `QWebElement::operator=(QWebElement const&)'
It turns out that QWEBKIT_EXPORT is actually defined to be nothing. In
other words, in qwebkitglobal.h, the macro falls through to line #45
of the following:
41 #if !defined(QWEBKIT_EXPORT)
42 # if defined(QT_SHARED)
43 # define QWEBKIT_EXPORT Q_DECL_EXPORT
44 # else
45 # define QWEBKIT_EXPORT
46 # endif
47 #endif
I made sure this is the case by putting in an extra definition to
QWEBKIT_EXPORT around line #50. The compiler then complained about a
redundant declaration and pointed to line #45 as the previous
declaration. I also verified this by dumping the preprocessor output
to a text file and ensuring that I did not see a
__attribute__((visibility("default"))) around the QWebElement class
declaration in qwebelement.h.
Moreover qwebelement.cpp is compiled with -fno-visbility. This means
that this symbol is never exported from libQtWebKit.so. This is why
there were a whole bunch of undefined symbol linker errors when
building the tests. I modified qwebkitglobal.h #45 to just #define
QWEBKIT_EXPORT to Q_DECL_EXPORT and now I can get the whole thing
built. I am not quite sure where QT_SHARED is supposed to be declared
and why it is undefined in my build. It doesn't seem to be #defined
anywhere in the Qt include files and the QtWebKit build instructions
do not mention anything about this.
But for now, this works for me and I got a working
libQtWebKit.so.4.9.0 built against Qt 4.7.2.
Regards,
Srinath
More information about the webkit-qt
mailing list