Building patched QT

657 views
Skip to first unread message

Kj Tsanaktsidis

unread,
Apr 11, 2013, 8:49:34 PM4/11/13
to wkhtmlt...@googlegroups.com
Hello,

I posted this on the issue tracker but this is probably a more appropriate forum since it's not a bug per se, so I'll cross post it here. I'm trying to write a patch for wkhtmltopdf on Windows. However, I'm having a lot of trouble compiling the patched QT version found at http://gitorious.org/~antialize/qt/antializes-qt. Looking at the group, I don't seem to be the only person having this problem, but it doesn't look like anybody's found a real solution yet.

I'm using MinGW (gcc 4.3.2) on Windows 7. I'm using the following configure line:

.\configure -release -static -fast -exceptions -no-accessibility -no-stl -no-sql-ibase -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-qt3support -xmlpatterns -no-phonon -no-phonon-backend -webkit -no-scripttools -no-mmx -no-3dnow -no-sse -no-sse2  -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -graphicssystem raster -opensource -nomake tools -nomake examples -nomake demos -nomake docs -nomake translations -no-opengl -no-dbus -no-multimedia -openssl -no-declarative -qt-style-windows -qt-style-cleanlooks -no-style-windowsxp -no-style-windowsvista -no-style-plastique -no-style-motif -no-style-cde -nomake tests -platform win32-g++ -I C:\OpenSSL\include -L C:\OpenSSL\lib\MinGW


I've tried compiling branch 4.8.2, 4.8.4 and also branch 4.8.4 from this fork: http://gitorious.org/~trvrnrth/qt/trvrnrths-qt. In all cases, compilation fails after building WebCore and JavaScriptCore. First, the error is that it can't link files it's building to WebCore and JavaScriptCore with -lwebcore and -ljscore. The fix for this is to copy {libwebcore, libjscore}.{a, prl} into .\lib of the build directory.

Then, compilation fails when it tries to link these libraries to something, producing many lines of output along the following lines:

c:/Users/KJ/qtbuild/antializes-qt/lib/libwebcore.a(HTMLScriptElement.o):HTMLScriptElement.cpp:(.text+0xe48): undefined reference to `_imp___ZN18QThreadStorageData3setEPv'

Does anybody have any advice on how to make this damn thing build? Alternatively, if someone has a MinGW statically compiled QT they can give me, I'm happy to just build wkhtmltopdf against that and not bother building QT myself.

Hello, I'm trying to write a patch for wkhtmltopdf on Windows. However, I'm having a lot of trouble compiling the patched QT version found at http://gitorious.org/~antialize/qt/antializes-qt. 

I'm using MinGW (gcc 4.3.2) on Windows 7. I'm using the following configure line:

.\configure -release -static -fast -exceptions -no-accessibility -no-stl -no-sql-ibase -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-qt3support -xmlpatterns -no-phonon -no-phonon-backend -webkit -no-scripttools -no-mmx -no-3dnow -no-sse -no-sse2  -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -graphicssystem raster -opensource -nomake tools -nomake examples -nomake demos -nomake docs -nomake translations -no-opengl -no-dbus -no-multimedia -openssl -no-declarative -qt-style-windows -qt-style-cleanlooks -no-style-windowsxp -no-style-windowsvista -no-style-plastique -no-style-motif -no-style-cde -nomake tests -platform win32-g++ -I C:\OpenSSL\include -L C:\OpenSSL\lib\MinGW


I've tried compiling branch 4.8.2, 4.8.4 and also branch 4.8.4 from this fork: http://gitorious.org/~trvrnrth/qt/trvrnrths-qt. In all cases, compilation fails after building WebCore and JavaScriptCore. First, the error is that it can't link files it's building to WebCore and JavaScriptCore with -lwebcore and -ljscore. The fix for this is to copy {libwebcore, libjscore}.{a, prl} into .\lib of the build directory.

Then, compilation fails when it tries to link these libraries to something, producing many lines of output along the following lines:

c:/Users/KJ/qtbuild/antializes-qt/lib/libwebcore.a(HTMLScriptElement.o):HTMLScriptElement.cpp:(.text+0xe48): undefined reference to `_imp___ZN18QThreadStorageData3setEPv'

Does anybody have any advice on how to make this damn thing build? Alternatively, if someone has a MinGW statically compiled QT they can give me, I'm happy to just build wkhtmltopdf against that and not bother building QT myself.

Kj Tsanaktsidis

unread,
Apr 12, 2013, 12:12:18 AM4/12/13
to wkhtmlt...@googlegroups.com
Alright, I've managed to hack my way through this.

So, I built QT with the -shared instead of -static option. This enabled webkit to actually build. I also set -prefix to ..\wk-qt; I found I had to copy mkspecs from the qt folder into this folder to get the build to start. Upon running make install, I found I also had to copy the contents of the wk-qt folder into a subdirectory called wk-qt (i.e. C:\users\KJ\qtbuild\wk-qt\wk-qt\{lib, include, etc}). Finally, since my linker was doing funny things, I found I had to copy all of the Qtxxx4.dll and libQtxxx4.a files and name them Qtxxx.dll and libQtxxx.a.

This enabled the build of libwkhtmltox0 to succeed as per the instructions on google code, but building wkhtmltopdf.exe failed claiming that it could not find the symbol corresponding to this decleration in pdfconverter.hh: "DLL_PUBLIC void dumpDefaultTOCStyleSheet(QTextStream & stream, settings::TableOfContent & s);".

The solution to this was to edit the makefile for libwkhtmltopdf to include the linker option "-Wl,--export-all-symbols", and perform the build again. When the build failed due to aforementioned missing symbol, I deleted the static libraries from the bin folder and ran make again; this forced wkhtmltopdf.exe to link against the dynamic libwkhtml0.dll.

The result of this is that the build works, and the resulting program works, but my wkhtmltopdf.exe depends on a dynamically loaded wkhtmltox.dll, which depends on several of the dynamic QT libraries. This isn't a huge issue for me since my end game is to use the library in an ASP.NET web application, but it would be nice to be able to build the library properly. This is because I'm using the Pechkin c# bindings to the library, and the features I add to libwkhtml I'll also need to reflect in the c# bindings. The bindings come with a prebuilt copy of wkhtmltox.dll, so if I submit a patch upstream that changes the bindings for my modified library, i'd also need to supply a properly build copy of said modified library.

TL;DR: Can build using dynamic linking (with many hacks) but can't build using static linkage. Any ideas?

leslie Lau

unread,
Aug 1, 2013, 5:16:38 PM8/1/13
to wkhtmlt...@googlegroups.com
Hi Kj,

I'm trying to build this darn thing on Windows platform as well, but I get this error:

Cloning into 'trvrnrths-qt'...
fatal: unable to connect to gitorious.org:
gitorious.org[0: 87.238.52.168]: errno=No such file or directory


Do you know how to fix this error?  Also, have you posted your binaries anywhere?  Seems like lots of people are interested in a patched QT build but can't seem to get any builds on Windows working.

Thanx in advance,
Leslie

leslie Lau

unread,
Aug 1, 2013, 6:35:33 PM8/1/13
to wkhtmlt...@googlegroups.com
I got a bit further now.  To fix the clone error, I had to use this url instead:


Then I was able to execute this:

C:\wkhtmltopdf-qt>configure -nomake tools -nomake examples -nomake demos -nomake docs -nomake translations -opensource -release -static -webkit -xmlpatterns -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -prefix c:/wkhtmltopdf-qt/wkqt


Which resulted in this error now:

WARNING: Using static linking will disable the use of plugins.
         Make sure you compile ALL needed modules into the library.
Running syncqt...
Creating qmake...
execute: File or path is not found (mingw32-make)
execute: File or path is not found (mingw32-make)
Cleaning qmake failed, return code -1

leslie Lau

unread,
Aug 1, 2013, 7:20:07 PM8/1/13
to wkhtmlt...@googlegroups.com
OK...minGW\bin folder was not in my PATH......

So I had to do this:

set PATH=%PATH%;C:\minGW\bin


Now I'm able to compile.....it's progressing....let's see what the next stumbling block will be......this is my configure command:

configure -release -static -fast -exceptions -no-accessibility -no-stl -no-sql-ibase -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-qt3support -xmlpatterns -no-phonon -no-phonon-backend -webkit -no-scripttools -no-mmx -no-3dnow -no-sse -no-sse2 -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -graphicssystem raster -opensource -nomake tools -nomake examples -nomake demos -nomake docs -nomake translations -no-opengl -no-dbus -no-multimedia -openssl -no-declarative -qt-style-windows -qt-style-cleanlooks -no-style-windowsxp -no-style-windowsvista -no-style-plastique -no-style-motif -no-style-cde -platform win32-g++ -I C:/OpenSSL/include -prefix c:/wkhtmltopdf-qt/wkqt


BTW, I had to install OpenSSL as well.

leslie Lau

unread,
Aug 2, 2013, 5:10:42 PM8/2/13
to wkhtmlt...@googlegroups.com
After a long time compiling patched QT, I'm now getting these errors when issuing the command: 

minw32-make install -Bk


c:/wkhtmltopdf-qt/bin/qmake -spec wkqt/mkspecs/win32-g++ -o Makefile projects.pr
o
C:\Utils\mkdir.EXE: cannot make directory `src/tools/bootstrap/': File exists
mingw32-make: *** [src/tools/bootstrap/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/tools/moc/': File exists
mingw32-make: *** [src/tools/moc/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/tools/rcc/': File exists
mingw32-make: *** [src/tools/rcc/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/tools/uic/': File exists
mingw32-make: *** [src/tools/uic/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/winmain/': File exists
mingw32-make: *** [src/winmain/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/corelib/': File exists
mingw32-make: *** [src/corelib/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/xml/': File exists
mingw32-make: *** [src/xml/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/network/': File exists
mingw32-make: *** [src/network/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/sql/': File exists
mingw32-make: *** [src/sql/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/testlib/': File exists
mingw32-make: *** [src/testlib/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/gui/': File exists
mingw32-make: *** [src/gui/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/tools/idc/': File exists
mingw32-make: *** [src/tools/idc/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/activeqt/': File exists
mingw32-make: *** [src/activeqt/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/xmlpatterns/': File exists
mingw32-make: *** [src/xmlpatterns/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/svg/': File exists
mingw32-make: *** [src/svg/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/script/': File exists
mingw32-make: *** [src/script/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/3rdparty/webkit/JavaScriptCore/':
 File exists
mingw32-make: *** [src/3rdparty/webkit/JavaScriptCore/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/3rdparty/webkit/WebCore/': File e
xists
mingw32-make: *** [src/3rdparty/webkit/WebCore/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `src/plugins/': File exists
mingw32-make: *** [src/plugins/Makefile] Error 1
C:\Utils\mkdir.EXE: cannot make directory `c:/wkhtmltopdf-qt/wkqt/bin/': File ex
ists
mingw32-make: *** [install_qmake] Error 1
C:\Utils\mkdir.EXE: cannot make directory `c:/wkhtmltopdf-qt/wkqt/mkspecs/': Fil
e exists
mingw32-make: *** [install_mkspecs] Error 1
mingw32-make: Target `install' not remade because of errors.

leslie Lau

unread,
Aug 4, 2013, 1:51:53 PM8/4/13
to wkhtmlt...@googlegroups.com
So the fix for the "File exists" problem below is to get SH.exe and ZSH.exe out of my PATH.  Once I did that, mingw32-make install -Bk works.


I then go to compile C:\wkhtmltopdf and now get these errors:

C:\wkhtmltopdf>mingw32-make
cd src\lib\ && mingw32-make -f Makefile
mingw32-make[1]: Entering directory `C:/wkhtmltopdf/src/lib'
mingw32-make -f Makefile.Release
mingw32-make[2]: Entering directory `C:/wkhtmltopdf/src/lib'
g++ -c -pipe -O2 -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_LARG
EFILE_SUPPORT -DMAJOR_VERSION=0 -DMINOR_VERSION=12 -DPATCH_VERSION=0 -DBUILD= -D
QT_STATIC -DBUILDING_DLL -D__WKHTMLTOX_UNDEF_QT_DLL__ -DQT_DLL -DQT_NO_DEBUG -DQ
T_WEBKIT_LIB -DQT_SVG_LIB -DQT_XMLPATTERNS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQ
T_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\wkhtmltopdf-qt\wkqt\include\QtCore" -
I"..\..\..\wkhtmltopdf-qt\wkqt\include\QtNetwork" -I"..\..\..\wkhtmltopdf-qt\wkq
t\include\QtGui" -I"..\..\..\wkhtmltopdf-qt\wkqt\include\QtXmlPatterns" -I"..\..
\..\wkhtmltopdf-qt\wkqt\include\QtSvg" -I"c:\wkhtmltopdf-qt\wkqt\include\QtWebKi
t" -I"..\..\..\wkhtmltopdf-qt\wkqt\include" -I"..\..\include" -I"..\..\..\wkhtml
topdf-qt\wkqt\include\ActiveQt" -I"..\..\build" -I"..\..\..\wkhtmltopdf-qt\mkspe
cs\win32-g++" -o ..\..\build\multipageloader.o ..\lib\multipageloader.cc
In file included from ..\lib\/multipageloader_p.hh:29:0,
                 from ..\lib\multipageloader.cc:27:
..\lib\/multipageloader.hh:32:20: fatal error: QWebPage: No such file or directo
ry
compilation terminated.
mingw32-make[2]: *** [../../build/multipageloader.o] Error 1
mingw32-make[2]: Leaving directory `C:/wkhtmltopdf/src/lib'
mingw32-make[1]: *** [RELEASE] Error 2
mingw32-make[1]: Leaving directory `C:/wkhtmltopdf/src/lib'
mingw32-make: *** [sub-src-lib-make_default-ordered] Error 2

C:\wkhtmltopdf>
Now am stuck.
Reply all
Reply to author
Forward
0 new messages