scripts/build.py fails on OpenBSD 5.5 #1991

Open
hostingnuggets opened this Issue Oct 8, 2014 · 76 comments

Projects

None yet

3 participants

@hostingnuggets

I would like to compile wkhtmltox 0.12.1 on my OpenBSD 5.5 machine but unfortunately it already fails while running "./scripts/build.py posix-local" as you can see below:

...
Creating qmake. Please wait...
qbytearray.o(.text+0x2d92): In function `qstrcpy(char*, char const*)':
/home/user/src/wkhtmltox-0.12.1/qt/src/corelib/tools/qbytearray.cpp:143: warning: strcpy() is almost always misused, please use strlcpy()
qglobal.o(.text+0x267): In function `qrand()':
/home/user/src/wkhtmltox-0.12.1/qt/src/corelib/global/qglobal.cpp:2746: warning: rand() isn't random; consider using arc4random()
qglobal.o(.text+0x27d): In function `qsrand(unsigned int)':
/home/user/src/wkhtmltox-0.12.1/qt/src/corelib/global/qglobal.cpp:2705: warning: srand() seed choices are invariably poor
option.o(.text+0xe95): In function `qmake_version()':
/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/qmake/option.cpp:695: warning: sprintf() is often misused, please use snprintf()
Iconv support cannot be enabled due to functionality tests!
 Turn on verbose messaging (-v) to ../../../qt/configure to see the final report.
 If you believe this message is in error you may use the continue
 switch (-continue) to ../../../qt/configure to continue.
../../../qt/configure -opensource -confirm-license -fast -release -static -graphicssystem raster -webkit -exceptions -xmlpatterns -system-zlib -system-libpng -system-libjpeg -no-libmng -no-libtiff -no-accessibility -no-stl -no-qt3support -no-phonon -no-phonon-backend -no-opengl -no-declarative -no-script -no-scripttools -no-sql-ibase -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-mmx -no-3dnow -no-sse -no-sse2 -no-multimedia -nomake demos -nomake docs -nomake examples -nomake tools -nomake tests -nomake translations -silent -xrender -largefile -iconv -openssl -no-rpath -no-dbus -no-nis -no-cups -no-pch -no-gtkstyle -no-nas-sound -no-sm -no-xshape -no-xinerama -no-xcursor -no-xfixes -no-xrandr -no-mitshm -no-xinput -no-xkb -no-glib -no-gstreamer -D ENABLE_VIDEO=0 -no-openvg -no-xsync -no-audio-backend -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 -no-avx -no-neon --prefix=/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt
command failed: exit code 25856

any ideas what I am missing or whats wrong?

@ashkulz
Member
ashkulz commented Oct 17, 2014

You might want to run WKHTMLTOX_QT_CONFIG=-no-iconv ./scripts/build.py posix-local to disable iconv support (which doesn't seem to be working on OpenBSD).

Let me know if the build works for you.

@ashkulz ashkulz added this to the future milestone Oct 17, 2014
@hostingnuggets

Thanks that worked and I passed the build.py stage but at the end I get the following error:

...
Qt is now configured for building. Just run 'gmake'.
Once everything is built, you must run 'gmake install'.
Qt will be installed into /home/mbadm/src/wkhtmltox-0.12.1/static-build/posix-local/qt

To reconfigure, run 'gmake confclean' and 'configure'.

cd src/tools/bootstrap/ && make -f Makefile
Using $< in a non-suffix rule context is a GNUmake idiom (Makefile:1094)
*** Error 2 in /home/mbadm/src/wkhtmltox-0.12.1/static-build/posix-local/qt (Makefile:52 'sub-tools-bootstrap-make_default-ordered')
cd src/tools/bootstrap/ && make -f Makefile
Using $< in a non-suffix rule context is a GNUmake idiom (Makefile:1094)
*** Error 2 in /home/mbadm/src/wkhtmltox-0.12.1/static-build/posix-local/qt (Makefile:52 'sub-tools-bootstrap-make_default-ordered')
make -j2
command failed: exit code 512

static-build/posix-local/qt/src/tools/bootstrap

This has to do that OpenBSD comes with its own non-GNU make command. I have installed the GNU make package of OpenBSD but the command is called gmake so maybe the scripts need to be adapted so that on OpenBSD gmake is called and not make.

@hostingnuggets

I've found a workaround to the problem in my previous comment: I simply renamed /usr/bin/make to /usr/bin/make.bsd and linked /usr/bin/make to /usr/local/bin/gmake

Now that it can compile I got so far to the next problem:

make[2]: Entering directory '/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/src/3rdparty/webkit/Source/WebKit/qt'
Makefile.WebKit.QtWebKit:740315: warning: overriding recipe for target 'install_target'
Makefile.WebKit.QtWebKit:740296: warning: ignoring old recipe for target 'install_target'
Makefile.WebKit.QtWebKit:740326: warning: overriding recipe for target 'uninstall_target'
Makefile.WebKit.QtWebKit:740307: warning: ignoring old recipe for target 'uninstall_target'
compiling /home/user/src/wkhtmltox-0.12.1/qt/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp
compiling /home/user/src/wkhtmltox-0.12.1/qt/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkStackWin.cpp
compiling /home/user/src/wkhtmltox-0.12.1/qt/src/3rdparty/webkit/Source/JavaScriptCore/heap/MarkedBlock.cpp
/home/user/src/wkhtmltox-0.12.1/qt/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp:120: warning: unused parameter 'signo'
/home/user/src/wkhtmltox-0.12.1/qt/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp: In function 'size_t JSC::getPlatformThreadRegisters(pthread* const&, pthread_attr*&)':
/home/user/src/wkhtmltox-0.12.1/qt/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp:384: error: 'pthread_attr_get_np' was not declared in this scope
Makefile.WebKit.QtWebKit:20219: recipe for target '.obj/release-static/MachineStackMarker.o' failed
make[2]: *** [.obj/release-static/MachineStackMarker.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/src/3rdparty/webkit/Source/WebKit/qt'
Makefile.WebKit:39: recipe for target 'sub-WebKit-qt-QtWebKit-pro-make_default-ordered' failed
make[1]: *** [sub-WebKit-qt-QtWebKit-pro-make_default-ordered] Error 2
make[1]: Leaving directory '/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/src/3rdparty/webkit/Source'
Makefile:484: recipe for target 'sub-webkit-make_default-ordered' failed
make: *** [sub-webkit-make_default-ordered] Error 2
make -j2
command failed: exit code 512

Looks like some issue with the pthread header?

@ashkulz
Member
ashkulz commented Oct 18, 2014

Looks like there are lots of patches required to get Qt 4.8 working on OpenBSD. You might want to consult the patches in the phantomjs port and applying them locally and see what is required to get it working. I'd appreciate if you would submit a port upstream; it should be very similar to the phantomjs port. Alternatively, please let me know the minimal set of patches required to get it working on OpenBSD.

As an example, the error you are getting has been fixed by this patch in the phantomjs port.

@hostingnuggets

So using the patch you mentioned fixed the pthread_attr_get_np issue. Now it fails further at the following stage:

g++ -pthread -shared -Wl,-soname,libwkhtmltox.so.0 -fPIC -o libwkhtmltox.so.0.12.1 loadsettings.o multipageloader.o tempfile.o converter.o websettings.o reflect.o utilities.o pdfsettings.o pdfconverter.o outline.o tocstylesheet.o imagesettings.o imageconverter.o pdf_c_bindings.o image_c_bindings.o moc_multipageloader_p.o moc_converter_p.o moc_pdfconverter_p.o moc_imageconverter_p.o moc_pdf_c_bindings_p.o moc_image_c_bindings_p.o moc_converter.o moc_multipageloader.o moc_utilities.o moc_pdfconverter.o moc_imageconverter.o qrc_wkhtmltopdf.o    -L/usr/local/lib -L/home/mbadm/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib -L/home/mbadm/src/wkhtmltox-0.12.1/static-build/posix-local/qt/plugins/codecs -lqcncodecs -lqjpcodecs -lqkrcodecs -lqtwcodecs -lQtWebKit -L/home/mbadm/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib -L/usr/local/lib -L/usr/X11R6/lib -lQtSvg -lQtXmlPatterns -lQtGui -ljpeg -lpng -lXrender -lfontconfig -lfreetype -lXext -lX11 -lQtNetwork -lQtCore -lz -lm 
/usr/bin/ld: cannot find -lqcncodecs
collect2: ld returned 1 exit status
Makefile:158: recipe for target '../../bin/libwkhtmltox.so.0.12.1' failed
make[1]: *** [../../bin/libwkhtmltox.so.0.12.1] Error 1
make[1]: Leaving directory '/home/mbadm/src/wkhtmltox-0.12.1/static-build/posix-local/app/src/lib'
Makefile:41: recipe for target 'sub-src-lib-make_default-ordered' failed
make: *** [sub-src-lib-make_default-ordered] Error 2
make -j2
command failed: exit code 512

It looks like OpenBSD is missing the qcncodecs library, do you know which package/software includes this lib? Never heard about it before...

@ashkulz
Member
ashkulz commented Oct 20, 2014

qcncodecs is part of Qt itself, it adds support for the Chinese text codecs. You can try removing line 34 from common.pri and see if the build is successful. Also let me know if the codecs are getting built in qt/src/plugins/codecs/cn.

@hostingnuggets

I commented out line 34 of common.pri which includes the missing library and the compilation could continue but until to the next issue:

g++ -pthread -o ../../bin/wkhtmltopdf outputter.o manoutputter.o htmloutputter.o textoutputter.o arghandler.o commondocparts.o commandlineparserbase.o commonarguments.o progressfeedback.o loadsettings.o multipageloader.o tempfile.o converter.o websettings.o reflect.o utilities.o pdfsettings.o pdfconverter.o outline.o tocstylesheet.o imagesettings.o imageconverter.o pdf_c_bindings.o image_c_bindings.o wkhtmltopdf.o pdfarguments.o pdfcommandlineparser.o pdfdocparts.o moc_progressfeedback.o moc_multipageloader_p.o moc_converter_p.o moc_pdfconverter_p.o moc_imageconverter_p.o moc_pdf_c_bindings_p.o moc_image_c_bindings_p.o moc_converter.o moc_multipageloader.o moc_utilities.o moc_pdfconverter.o moc_imageconverter.o qrc_wkhtmltopdf.o    -L/usr/local/lib -L/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib -lQtWebKit -L/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib -L/usr/local/lib -L/usr/X11R6/lib -lQtSvg -lQtXmlPatterns -lQtGui -ljpeg -lpng -lXrender -lfontconfig -lfreetype -lXext -lX11 -lQtNetwork -lQtCore -lz -lm
pdf_c_bindings.o(.text+0xed0): In function `wkhtmltopdf_init':
: warning: strcpy() is almost always misused, please use strlcpy()
/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib/libQtCore.a(qglobal.o)(.text+0x562): In function `qrand()':
: warning: rand_r() isn't random; consider using arc4random()
/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib/libQtCore.a(qglobal.o)(.text+0x575): In function `qrand()':
: warning: rand() isn't random; consider using arc4random()
/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib/libQtCore.a(qglobal.o)(.text+0x336): In function `qsrand(unsigned int)':
: warning: srand() seed choices are invariably poor
/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib/libQtWebKit.a(ThreadingQt.o)(.text._ZN3WTF19initializeThreadingEv+0x65): In function `WTF::initializeThreading()':
: warning: srandom() seed choices are invariably poor
/usr/X11R6/lib/libfontconfig.so.9.0: warning: strcat() is almost always misused, please use strlcat()
/usr/X11R6/lib/libfontconfig.so.9.0: warning: sprintf() is often misused, please use snprintf()
converter.o(.text+0xab): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `qt_plugin_instance_qcncodecs()'
converter.o(.text+0xb7): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `qt_plugin_instance_qjpcodecs()'
converter.o(.text+0xc3): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `qt_plugin_instance_qkrcodecs()'
converter.o(.text+0xcf): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `qt_plugin_instance_qtwcodecs()'
collect2: ld returned 1 exit status
Makefile:181: recipe for target '../../bin/wkhtmltopdf' failed
make[1]: *** [../../bin/wkhtmltopdf] Error 1
make[1]: Leaving directory '/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/app/src/pdf'
Makefile:77: recipe for target 'sub-src-pdf-make_default-ordered' failed
make: *** [sub-src-pdf-make_default-ordered] Error 2
make -j2
command failed: exit code 512user

Also the qt/src/plugins/codecs/cn directory contains the following files:

cn.pro
main.cpp
qgb18030codec.cpp
qgb18030codec.h

so it does not look like the cn codec gets compiled (yet).

@ashkulz
Member
ashkulz commented Oct 20, 2014

You'll need to comment out lines 27-33 in src/lib/converter.cc. You'll have to check in /home/mbadm/src/wkhtmltox-0.12.1/static-build/posix-local/qt/src/plugins/codecs/cn (assuming that's the path you are using, taken from above) to see if there any compiled objects there ... the build script performs an out-of-source build.

@hostingnuggets

Commenting out the lines in src/lib/converter.cc worked and I could finally finish the compilation of wkhtmltopdf. At the end there seems to be only a small issue with the tar process:

g++ -pthread user-o ../../bin/wkhtmltoimage outputter.o manoutputter.o htmloutputter.o textoutputter.o arghandler.o commondocparts.o commandlineparserbase.o commonarguments.o progressfeedback.o loadsettings.o multipageloader.o tempfile.o converter.o websettings.o reflect.o utilities.o pdfsettings.o pdfconverter.o outline.o tocstylesheet.o imagesettings.o imageconverter.o pdf_c_bindings.o image_c_bindings.o wkhtmltoimage.o imagearguments.o imagecommandlineparser.o imagedocparts.o moc_progressfeedback.o moc_multipageloader_p.o moc_converter_p.o moc_pdfconverter_p.o moc_imageconverter_p.o moc_pdf_c_bindings_p.o moc_image_c_bindings_p.o moc_converter.o moc_multipageloader.o moc_utilities.o moc_pdfconverter.o moc_imageconverter.o qrc_wkhtmltopdf.o    -L/usr/local/lib -L/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib -lQtWebKit -L/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib -L/usr/local/lib -L/usr/X11R6/lib -lQtSvg -lQtXmlPatterns -lQtGui -ljpeg -lpng -lXrender -lfontconfig -lfreetype -lXext -lX11 -lQtNetwork -lQtCore -lz -lm
pdf_c_bindings.o(.text+0xed0): In function `wkhtmltopdf_init':
: warning: strcpy() is almost always misused, please use strlcpy()
/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib/libQtCore.a(qglobal.o)(.text+0x562): In function `qrand()':
: warning: rand_r() isn't random; consider using arc4random()
/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib/libQtCore.a(qglobal.o)(.text+0x575): In function `qrand()':
: warning: rand() isn't random; consider using arc4random()
/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib/libQtCore.a(qglobal.o)(.text+0x336): In function `qsrand(unsigned int)':
: warning: srand() seed choices are invariably poor
/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib/libQtWebKit.a(ThreadingQt.o)(.text._ZN3WTF19initializeThreadingEv+0x65): In function `WTF::initializeThreading()':
: warning: srandom() seed choices are invariably poor
/usr/X11R6/lib/libfontconfig.so.9.0: warning: strcat() is almost always misused, please use strlcat()
/usr/X11R6/lib/libfontconfig.so.9.0: warning: sprintf() is often misused, please use snprintf()
make[1]: Leaving directory '/home/user/src/wkhtmltox-0.12.1/static-build/posix-local/app/src/image'
tar: Unable to access wkhtmltox-0.12.1: No such file or directory
tar: WARNING! These file names were not selected:
wkhtmltox-0.12.1
tar -c -v -f ../wkhtmltox-0.12.1_local-hostname.domain.tld.tar wkhtmltox-0.12.1/
command failed: exit code 256

So I tried out quickly to convert some HTML to PDF and it works for the graphics but there is definitely an issue with the fonts as I only get black squares for each character...

also the content of the static-build/posix-local/qt/src/plugins/codecs/cn directory is empty, well only one single file: Makefile

@ashkulz
Member
ashkulz commented Oct 20, 2014

For the fonts, can you install font related packages (print/ghostscript/gnu-fonts, fonts/msttcorefonts) and see if it fixes the black squares issue? Also ensure that your fontconfig configuration uses the fonts that you have installed.

For the single file, the make command should have run there. If you run make there, do you get libqcncodecs.a generated?

@hostingnuggets

I checked and I have the ghostscript gnu-fonts package installed (ghostscript-fonts-8.11p2) but I didn't have the msttcorefonts. I installed the msttcorefonts from the ports as suggested and the extra fonts are now located in /usr/local/lib/X11/fonts/mscorefonts. While installing this port I got at the very end the error "Fontconfig error: Cannot load default config file". I don't really know if this is of any importance as the files are installed but there was also a mention "You may wish to update your font path for /usr/local/lib/X11/fonts/mscorefonts" but I don't know if this applies to wkhtmltopdf.

Unfortunately running wkhtmltopdf after the installation of this port still does not work. Do I maybe need to recompile wkhtmltopdf?

Now regarding the qcncodecs library I ran make in static-build/posix-local/qt/src/plugins/codecs/cn and it created me the the following files in static-build/posix-local/qt/plugins/codecs:

libqcncodecs.a
libqcncodecs.prl
@ashkulz
Member
ashkulz commented Oct 20, 2014

Looks like you need to configure fontconfig properly, see Fixing Font Configuration Warning Messages and Anti-aliasing and TrueType Fonts on OpenBSD.

With regards to the compilation issue, it looks like make isn't going into the codecs directory (or some parent of it) -- this needs to be investigated.

@hostingnuggets

I found out that I was actually missing the xfont55.tgz and xetc55.tgz file sets. So after installing these two sets I got all the X fonts and wkhtmlpdf finally works.

Now that I have a working binary (without special Chinese codec libraries) would you like me to create an OpenBSD installable package out of it?

@ashkulz
Member
ashkulz commented Oct 21, 2014

I'd prefer if you can track down the reason for the Chinese codecs not being compiled, should be a minor difference in the build process. Submitting the port to OpenBSD would be ideal, else you can let me know what patches/changes are required and I will try to incorporate them.

@hostingnuggets

It's quite a pain for me to track down why the cn/jp/kr/tw Qt codecs are not being built as I am no developer all I know is that the qt/src/plugins/codecs directory somehow does not get processed the the build. Do you maybe know how I can manually compile these? There is no Makefile there in that directory neither in the language sub-directories (cn/jp/etc...).

@ashkulz
Member
ashkulz commented Oct 22, 2014

I think that the -no-iconv flag disables the building of text codecs. Can you investigate whether you have converters/libiconv installed? If not, can you install it and then rebuild with the JavaScriptCore patch?

Also, please confirm that if gmake is installed (and make points to BSD make) then the process fails -- as there is logic in the build script to use gmake if installed.

@hostingnuggets

I will try again to compile without the -no-iconv flag and yes I have the libiconv OpenBSD package installed (libiconv-1.14p1). Where is this JavaScriptCore patch you are speaking about?

That's correct I confirm that with having gmake installed as well as OpenBSD make the build process fails as it calls make instead of gmake. I had to rename make to make.bsd and gmake to make to get it to work.

@ashkulz
Member
ashkulz commented Oct 22, 2014

You'll need to investigate a few things:

  • If you have libiconv installed, does that mean you need to give additional paths for it to be detected by the Qt configure script? Maybe you need to do "WKHTMLTOX_QT_CONFIG=-I /usr/local/include -L /usr/local/lib" scripts/build.py posix-local
  • The JavaScriptCore patch is the one that you applied earlier that I had linked to above
  • The configure script shows that gmake is correctly detected (it says Qt is now configured for building. Just run 'gmake'.) but somehow it is running cd src/tools/bootstrap/ && make -f Makefile -- it should be running gmake. Can you confirm that the gmake is coming via the python script or via something in Qt?
@hostingnuggets
  • So I tried adding the include and library paths to WKHTMLTOX_QT_CONFIG variable but that did not help although the paths are correct (iconv.h is in /usr/local/include and libiconv is in /usr/local/lib).
  • I have applied the javascriptcore patch correctly
  • gmake does not come from the python script or via Qt as I have installed it from the OpenBSD packages (package name: gmake-4.0p0)
@frenkel
Contributor
frenkel commented Jul 29, 2015

The Python build script still had a hardcoded make call. I fixed that in #2495. However, it seems the make variable does not correctly contain gmake. The output when run manually:

subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/usr/local/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/local/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

How can we correctly determine whether gmake is available?

@ashkulz
Member
ashkulz commented Jul 31, 2015

Hmm, it does a which gmake -- does that not work on OpenBSD?

@frenkel
Contributor
frenkel commented Jul 31, 2015

which gmake works fine, but the Python function does not.

@ashkulz
Member
ashkulz commented Jul 31, 2015

I'm not having access right now, does get_output('which', 'gmake') work?

@frenkel
Contributor
frenkel commented Jul 31, 2015

That works great. I've created a pull request for it: #2499

@ashkulz
Member
ashkulz commented Jul 31, 2015

So does it build with the patch? I'd prefer to merge all at once...

@frenkel
Contributor
frenkel commented Jul 31, 2015

Well, with all the work-arounds and manual patches I got so far:

pdf_c_bindings.o(.text+0x600): In function `wkhtmltopdf_init':
: warning: strcpy() is almost always misused, please use strlcpy()
/usr/local/lib/libQtCore.so.9.0: warning: rand_r() is not random, it is deterministic.
/usr/local/lib/libQtCore.so.9.0: warning: rand() may return deterministic values, is that what you want?
/usr/X11R6/lib/libfontconfig.so.9.1: warning: strcat() is almost always misused, please use strlcat()
/usr/X11R6/lib/libfontconfig.so.9.1: warning: sprintf() is often misused, please use snprintf()
/usr/local/lib/libglib-2.0.so.4200.0: warning: stpcpy() is dangerous; do not use it
/usr/local/lib/libglib-2.0.so.4200.0: warning: vsprintf() is often misused, please use vsnprintf()
converter.o(.text+0x3a3): In function `wkhtmltopdf::ConverterPrivate::updateWebSettings(QWebSettings*, wkhtmltopdf::settings::Web const&) const':
: undefined reference to `QWebSettings::setPrintingMediaType(QString const&)'
converter.o(.text+0x49c): In function `wkhtmltopdf::ConverterPrivate::updateWebSettings(QWebSettings*, wkhtmltopdf::settings::Web const&) const':
: undefined reference to `QWebSettings::setPrintingMaximumShrinkFactor(double)'
converter.o(.text+0x4ac): In function `wkhtmltopdf::ConverterPrivate::updateWebSettings(QWebSettings*, wkhtmltopdf::settings::Web const&) const':
: undefined reference to `QWebSettings::setPrintingMinimumShrinkFactor(double)'
pdfconverter.o(.text+0x239): In function `wkhtmltopdf::PdfConverterPrivate::handleTocPage(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::QWebPrinter(QWebFrame const*, QPaintDevice*, QPainter&)'
pdfconverter.o(.text+0x2d9): In function `wkhtmltopdf::PdfConverterPrivate::handleTocPage(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::~QWebPrinter()'
pdfconverter.o(.text+0x314): In function `wkhtmltopdf::PdfConverterPrivate::handleTocPage(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::pageCount() const'
pdfconverter.o(.text+0x330): In function `wkhtmltopdf::PdfConverterPrivate::handleTocPage(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::~QWebPrinter()'
pdfconverter.o(.text+0x9aa): In function `wkhtmltopdf::PdfConverterPrivate::calculateHeaderHeight(wkhtmltopdf::PageObject&, QWebPage&)':
: undefined reference to `QWebPrinter::QWebPrinter(QWebFrame const*, QPaintDevice*, QPainter&)'
pdfconverter.o(.text+0x9ed): In function `wkhtmltopdf::PdfConverterPrivate::calculateHeaderHeight(wkhtmltopdf::PageObject&, QWebPage&)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0xa4f): In function `wkhtmltopdf::PdfConverterPrivate::calculateHeaderHeight(wkhtmltopdf::PageObject&, QWebPage&)':
: undefined reference to `QWebPrinter::~QWebPrinter()'
pdfconverter.o(.text+0xab3): In function `wkhtmltopdf::PdfConverterPrivate::calculateHeaderHeight(wkhtmltopdf::PageObject&, QWebPage&)':
: undefined reference to `QWebPrinter::~QWebPrinter()'
pdfconverter.o(.text+0xde6): In function `wkhtmltopdf::PdfConverterPrivate::preprocessPage(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::QWebPrinter(QWebFrame const*, QPaintDevice*, QPainter&)'
pdfconverter.o(.text+0xed0): In function `wkhtmltopdf::PdfConverterPrivate::preprocessPage(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::~QWebPrinter()'
pdfconverter.o(.text+0xedf): In function `wkhtmltopdf::PdfConverterPrivate::preprocessPage(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::pageCount() const'
pdfconverter.o(.text+0xf6a): In function `wkhtmltopdf::PdfConverterPrivate::preprocessPage(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::~QWebPrinter()'
pdfconverter.o(.text+0x64d3): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QWebPrinter::QWebPrinter(QWebFrame const*, QPaintDevice*, QPainter&)'
pdfconverter.o(.text+0x6523): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0x6689): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0x66dc): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QPainter::addLink(QRectF const&, QString const&)'
pdfconverter.o(.text+0x67b9): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0x681a): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QPainter::addHyperlink(QRectF const&, QUrl const&)'
pdfconverter.o(.text+0x686e): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QWebPrinter::spoolPage(int) const'
pdfconverter.o(.text+0x690d): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QWebPrinter::~QWebPrinter()'
pdfconverter.o(.text+0x6a55): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QWebPrinter::QWebPrinter(QWebFrame const*, QPaintDevice*, QPainter&)'
pdfconverter.o(.text+0x6b68): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0x6bbb): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QPainter::addLink(QRectF const&, QString const&)'
pdfconverter.o(.text+0x6c98): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0x6cf9): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QPainter::addHyperlink(QRectF const&, QUrl const&)'
pdfconverter.o(.text+0x6d4c): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QWebPrinter::spoolPage(int) const'
pdfconverter.o(.text+0x6dea): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QWebPrinter::~QWebPrinter()'
pdfconverter.o(.text+0x7a27): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QWebPrinter::~QWebPrinter()'
pdfconverter.o(.text+0x7c84): In function `wkhtmltopdf::PdfConverterPrivate::endPage(wkhtmltopdf::PageObject&, bool, int, int)':
: undefined reference to `QWebPrinter::~QWebPrinter()'
pdfconverter.o(.text+0x80e7): In function `wkhtmltopdf::PdfConverterPrivate::spoolPage(int)':
: undefined reference to `QWebPrinter::spoolPage(int) const'
pdfconverter.o(.text+0x875e): In function `wkhtmltopdf::PdfConverterPrivate::spoolPage(int)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0x879d): In function `wkhtmltopdf::PdfConverterPrivate::spoolPage(int)':
: undefined reference to `QPainter::addTextField(QRectF const&, QString const&, QString const&, bool, bool, bool, int)'
pdfconverter.o(.text+0x8bf1): In function `wkhtmltopdf::PdfConverterPrivate::spoolPage(int)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0x8c0c): In function `wkhtmltopdf::PdfConverterPrivate::spoolPage(int)':
: undefined reference to `QPainter::addCheckBox(QRectF const&, bool, QString const&, bool)'
pdfconverter.o(.text+0x8df5): In function `wkhtmltopdf::PdfConverterPrivate::spoolPage(int)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0x8e4a): In function `wkhtmltopdf::PdfConverterPrivate::spoolPage(int)':
: undefined reference to `QPainter::addAnchor(QRectF const&, QString const&)'
pdfconverter.o(.text+0x8fd6): In function `wkhtmltopdf::PdfConverterPrivate::spoolPage(int)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0x9033): In function `wkhtmltopdf::PdfConverterPrivate::spoolPage(int)':
: undefined reference to `QPainter::addLink(QRectF const&, QString const&)'
pdfconverter.o(.text+0x9404): In function `wkhtmltopdf::PdfConverterPrivate::spoolPage(int)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0x9468): In function `wkhtmltopdf::PdfConverterPrivate::spoolPage(int)':
: undefined reference to `QPainter::addHyperlink(QRectF const&, QUrl const&)'
pdfconverter.o(.text+0xa4f8): In function `wkhtmltopdf::PdfConverterPrivate::endPrintObject(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::pageCount() const'
pdfconverter.o(.text+0xa6d0): In function `wkhtmltopdf::PdfConverterPrivate::endPrintObject(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::~QWebPrinter()'
pdfconverter.o(.text+0xac67): In function `wkhtmltopdf::PdfConverterPrivate::beginPrintObject(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::QWebPrinter(QWebFrame const*, QPaintDevice*, QPainter&)'
pdfconverter.o(.text+0xaf7e): In function `wkhtmltopdf::PdfConverterPrivate::beginPrintObject(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0xb30e): In function `wkhtmltopdf::PdfConverterPrivate::beginPrintObject(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0xb57d): In function `wkhtmltopdf::PdfConverterPrivate::beginPrintObject(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0xb8a9): In function `wkhtmltopdf::PdfConverterPrivate::beginPrintObject(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0xbc6f): In function `wkhtmltopdf::PdfConverterPrivate::beginPrintObject(wkhtmltopdf::PageObject&)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
pdfconverter.o(.text+0xc88e): In function `wkhtmltopdf::PdfConverterPrivate::printDocument()':
: undefined reference to `QWebPrinter::pageCount() const'
outline.o(.text+0x45b): In function `wkhtmltopdf::OutlinePrivate::outlineChildren(wkhtmltopdf::OutlineItem*, QPrinter*, int)':
: undefined reference to `QPrinter::beginSectionOutline(QString const&, QString const&)'
outline.o(.text+0x474): In function `wkhtmltopdf::OutlinePrivate::outlineChildren(wkhtmltopdf::OutlineItem*, QPrinter*, int)':
: undefined reference to `QPrinter::endSectionOutline()'
outline.o(.text+0x2486): In function `wkhtmltopdf::Outline::replaceWebPage(int, QString const&, QWebPrinter&, QWebFrame*, wkhtmltopdf::settings::PdfObject const&, QVector<QPair<QWebElement, QString> >&, QHash<QString, QWebElement>&)':
: undefined reference to `QWebPrinter::elementLocation(QWebElement const&)'
outline.o(.text+0x2aa7): In function `wkhtmltopdf::Outline::replaceWebPage(int, QString const&, QWebPrinter&, QWebFrame*, wkhtmltopdf::settings::PdfObject const&, QVector<QPair<QWebElement, QString> >&, QHash<QString, QWebElement>&)':
: undefined reference to `QWebPrinter::pageCount() const'
outline.o(.text+0x2b17): In function `wkhtmltopdf::Outline::replaceWebPage(int, QString const&, QWebPrinter&, QWebFrame*, wkhtmltopdf::settings::PdfObject const&, QVector<QPair<QWebElement, QString> >&, QHash<QString, QWebElement>&)':
: undefined reference to `QWebPrinter::pageCount() const'
imageconverter.o(.text+0x1cd1): In function `wkhtmltopdf::ImageConverterPrivate::pagesLoaded(bool)':
: undefined reference to `QSvgGenerator::setViewBoxClip(bool)'
collect2: ld returned 1 exit status
Makefile:180: recipe for target '../../bin/wkhtmltopdf' failed
gmake[1]: *** [../../bin/wkhtmltopdf] Error 1
gmake[1]: Leaving directory '/home/frank/Downloads/wkhtmltopdf/static-build/posix-local/app/src/pdf'
Makefile:77: recipe for target 'sub-src-pdf-make_default-ordered' failed
gmake: *** [sub-src-pdf-make_default-ordered] Error 2
gmake -j4
command failed: exit code 512
@ashkulz
Member
ashkulz commented Aug 1, 2015

Looks like it is trying to link to the system Qt and not the custom Qt. What's the final linker command?

@frenkel
Contributor
frenkel commented Aug 3, 2015

Sorry, didn't realise I left out the most useful output. Here are the lines before it:

gmake[1]: Entering directory '/home/frank/Downloads/wkhtmltopdf/static-build/posix-local/app/src/lib'
rm -f libwkhtmltox.so.0.12.3 libwkhtmltox.so libwkhtmltox.so.0 libwkhtmltox.so.0.12
g++ -pthread -shared -Wl,-soname,libwkhtmltox.so.0 -fPIC -o libwkhtmltox.so.0.12.3 loadsettings.o multipageloader.o tempfile.o converter.o websettings.o reflect.o utilities.o pdfsettings.o pdfconverter.o outline.o tocstylesheet.o imagesettings.o imageconverter.o pdf_c_bindings.o image_c_bindings.o moc_multipageloader_p.o moc_converter_p.o moc_pdfconverter_p.o moc_imageconverter_p.o moc_pdf_c_bindings_p.o moc_image_c_bindings_p.o moc_converter.o moc_multipageloader.o moc_utilities.o moc_pdfconverter.o moc_imageconverter.o qrc_wkhtmltopdf.o    -L/usr/local/lib -L/home/frank/Downloads/wkhtmltopdf/static-build/posix-local/qt/lib -lQtWebKit -L/home/frank/Downloads/wkhtmltopdf/static-build/posix-local/qt/lib -L/usr/local/lib -L/usr/X11R6/lib -lQtSvg -lQtXmlPatterns -lQtGui -ljpeg -lpng -lXrender -lfontconfig -lfreetype -lXext -lX11 -lQtNetwork -lQtCore -lz -lm 
ln -s libwkhtmltox.so.0.12.3 libwkhtmltox.so
ln -s libwkhtmltox.so.0.12.3 libwkhtmltox.so.0
ln -s libwkhtmltox.so.0.12.3 libwkhtmltox.so.0.12
rm -f ../../bin/libwkhtmltox.so.0.12.3
rm -f ../../bin/libwkhtmltox.so
rm -f ../../bin/libwkhtmltox.so.0
rm -f ../../bin/libwkhtmltox.so.0.12
mv -f libwkhtmltox.so.0.12.3 libwkhtmltox.so libwkhtmltox.so.0 libwkhtmltox.so.0.12 ../../bin/
gmake[1]: Leaving directory '/home/frank/Downloads/wkhtmltopdf/static-build/posix-local/app/src/lib'
cd src/pdf/ && gmake -f Makefile 
gmake[1]: Entering directory '/home/frank/Downloads/wkhtmltopdf/static-build/posix-local/app/src/pdf'
g++ -pthread -o ../../bin/wkhtmltopdf outputter.o manoutputter.o htmloutputter.o textoutputter.o arghandler.o commondocparts.o commandlineparserbase.o commonarguments.o progressfeedback.o loadsettings.o multipageloader.o tempfile.o converter.o websettings.o reflect.o utilities.o pdfsettings.o pdfconverter.o outline.o tocstylesheet.o imagesettings.o imageconverter.o pdf_c_bindings.o image_c_bindings.o wkhtmltopdf.o pdfarguments.o pdfcommandlineparser.o pdfdocparts.o moc_progressfeedback.o moc_multipageloader_p.o moc_converter_p.o moc_pdfconverter_p.o moc_imageconverter_p.o moc_pdf_c_bindings_p.o moc_image_c_bindings_p.o moc_converter.o moc_multipageloader.o moc_utilities.o moc_pdfconverter.o moc_imageconverter.o qrc_wkhtmltopdf.o    -L/usr/local/lib -L/home/frank/Downloads/wkhtmltopdf/static-build/posix-local/qt/lib -lQtWebKit -L/home/frank/Downloads/wkhtmltopdf/static-build/posix-local/qt/lib -L/usr/local/lib -L/usr/X11R6/lib -lQtSvg -lQtXmlPatterns -lQtGui -ljpeg -lpng -lXrender -lfontconfig -lfreetype -lXext -lX11 -lQtNetwork -lQtCore -lz -lm 

@ashkulz
Member
ashkulz commented Aug 4, 2015

So, what happens is that /usr/local/lib/libQtCore.so is the unpatched Qt and we are attempting to link to patched Qt. Unfortunatelty, due to specifying -L /usr/local/lib when configuring Qt, it gets picked up as it appears first in the linker's command-line. Not really sure what the solution is, as including it is required for libiconv but doing so causes problems in linking. Can you create a new directory (e.g. ~/wk-system-libs and symlink the required headers/libs for libiconv and use that instead of /usr/local?

@frenkel
Contributor
frenkel commented Aug 4, 2015

Temporarily renaming /usr/local/lib/qt indeed fixes the linking problem. BTW I'm using WKHTMLTOX_QT_CONFIG=-no-iconv, so I have no need for iconv in the library path.

From my preliminary testing it seems the final binary works quite well. Even web-fonts over https work fine.

What would be the best way to work around this linking problem? Wouldn't it be possible to add /usr/local/lib later than the other library include paths?

@ashkulz
Member
ashkulz commented Aug 5, 2015

Can you try to document what you did with a clean repository? If you didn't explictly add /usr/local/lib to WKHTMLTOX_QT_CONFIG, I'm not sure how it ended up in the linker command line. Also, can you let me know if you needed to apply any Qt patches to get it working? I'd prefer to merge them so that you can do a build easily for the 0.12.3 release.

@frenkel
Contributor
frenkel commented Aug 5, 2015

Sure. I just recloned the repository and had do take the following steps to make a build:

  • Apply this patch to QT.
  • Apply the following changes to the wkhtmltopdf repo:
diff --git a/common.pri b/common.pri
index 41b62df..9e6b8a1 100644
--- a/common.pri
+++ b/common.pri
@@ -17,7 +17,6 @@

 CONFIG(static, shared|static):lessThan(QT_MAJOR_VERSION, 5) {
     DEFINES  += QT4_STATICPLUGIN_TEXTCODECS
-    QTPLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs
 }

 INCLUDEPATH += ../../include
diff --git a/src/lib/converter.cc b/src/lib/converter.cc
index d710a8f..8c27c82 100644
--- a/src/lib/converter.cc
+++ b/src/lib/converter.cc
@@ -24,14 +24,6 @@
 #include <QWebFrame>
 #include <qapplication.h>

-#ifdef QT4_STATICPLUGIN_TEXTCODECS
-#include <QtPlugin>
-Q_IMPORT_PLUGIN(qcncodecs)
-Q_IMPORT_PLUGIN(qjpcodecs)
-Q_IMPORT_PLUGIN(qkrcodecs)
-Q_IMPORT_PLUGIN(qtwcodecs)
-#endif
-
 namespace wkhtmltopdf {
  • Rename /usr/local/lib/qt4 to /usr/local/lib/qt4.orig to fix the linking issue.
  • Then run WKHTMLTOX_QT_CONFIG=-no-iconv ./scripts/build.py posix-local
@ashkulz
Member
ashkulz commented Aug 5, 2015

Can you check if applying this patch fixes the check of iconv? Then the only issue which will remain is the auto-inclusion of /usr/local/lib in the linker command-line which happens because of mkspecs/openbsd-g++/qmake.conf. Not really sure how you can avoid that, though -- did you install qt4 via the ports system earlier? Ideally, you may need to pick up other qt4 patches as well.

@frenkel
Contributor
frenkel commented Aug 5, 2015

I've installed gmake and qt4 through ports indeed.

I can check whether the patch fixes iconv tomorrow and will also have a stab at working around the inclustion problem. I'll keep you posted.

@frenkel
Contributor
frenkel commented Aug 6, 2015

I started with a clean repository again and followed these steps:

I believe that there are now two problems:

  • The qt4 linking problem. The generated Makefiles in static-build/posix-local/app/src/*/ contain the wrong -L order (actually /usr/local/lib is there twice, once near the beginning and once near the end). I think the generation of these Makefiles should be modified. Where would I find that?
  • The same error as reported by @hostingnuggets:
g++ -pthread -shared -Wl,-soname,libwkhtmltox.so.0 -fPIC -o libwkhtmltox.so.0.12.1 loadsettings.o multipageloader.o tempfile.o converter.o websettings.o reflect.o utilities.o pdfsettings.o pdfconverter.o outline.o tocstylesheet.o imagesettings.o imageconverter.o pdf_c_bindings.o image_c_bindings.o moc_multipageloader_p.o moc_converter_p.o moc_pdfconverter_p.o moc_imageconverter_p.o moc_pdf_c_bindings_p.o moc_image_c_bindings_p.o moc_converter.o moc_multipageloader.o moc_utilities.o moc_pdfconverter.o moc_imageconverter.o qrc_wkhtmltopdf.o    -L/usr/local/lib -L/home/mbadm/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib -L/home/mbadm/src/wkhtmltox-0.12.1/static-build/posix-local/qt/plugins/codecs -lqcncodecs -lqjpcodecs -lqkrcodecs -lqtwcodecs -lQtWebKit -L/home/mbadm/src/wkhtmltox-0.12.1/static-build/posix-local/qt/lib -L/usr/local/lib -L/usr/X11R6/lib -lQtSvg -lQtXmlPatterns -lQtGui -ljpeg -lpng -lXrender -lfontconfig -lfreetype -lXext -lX11 -lQtNetwork -lQtCore -lz -lm 
/usr/bin/ld: cannot find -lqcncodecs
@ashkulz
Member
ashkulz commented Aug 7, 2015

Can you post the contents of wkhtmltopdf/static-build/posix-local/qt/mkspecs/qconfig.pri? The codecs are only built if QT_CONFIG contains iconv or gnu-iconv. Is there a Makefile in wkhtmltopdf/static-build/posix-local/qt/src/plugins/codecs in that case?

@ashkulz
Member
ashkulz commented Aug 7, 2015

I don't think there is a easy solution for the Qt4 linking problem -- you should not have Qt4 installed on the build machine, for now (or work it around like you did).

@frenkel
Contributor
frenkel commented Aug 9, 2015
cat static-build/posix-local/qt/mkspecs/qconfig.pri
#configuration
CONFIG +=  static def_files_disabled exceptions no_mocdepend release qt_no_framework
QT_ARCH = x86_64
QT_EDITION = OpenSource
QT_CONFIG +=  minimal-config small-config medium-config large-config full-config static reduce_exports ipv6 getaddrinfo ipv6ifname getifaddrs system-jpeg jpeg no-mng system-png png gif no-tiff system-freetype system-zlib gnu-libiconv openssl xvideo xrender fontconfig concurrent xmlpatterns svg release

#versioning
QT_VERSION = 4.8.7
QT_MAJOR_VERSION = 4
QT_MINOR_VERSION = 8
QT_PATCH_VERSION = 7

#namespaces
QT_LIBINFIX = 
QT_NAMESPACE = 
QT_NAMESPACE_MAC_CRC = 

QT_GCC_MAJOR_VERSION = 4
QT_GCC_MINOR_VERSION = 2
QT_GCC_PATCH_VERSION = 1

and

$ ls static-build/posix-local/qt/src/plugins/codecs/                                                   
Makefile cn       jp       kr       tw
@ashkulz
Member
ashkulz commented Aug 10, 2015

so does doing gmake in the codecs directory and then running the build again succeed?

@frenkel
Contributor
frenkel commented Nov 18, 2015

@ashkulz for you info: I've contributed a port for non-patched-qt build of wkhtmltopdf to OpenBSD. It is already available in the snapshots and will be available in the next 5.9 release in may 2016. I'm now in the process of making a patched-qt build as well.
Keep up the good work :)

@hostingnuggets

Over one year later when I posted my initial issue, I am still trying to compile wkhtmltox 0.12.2.1 but now on OpenBSD 5.8 (amd64). I followed @frenkel's instructions in this #issuecomment-127952769 (5th of August) but unfortunately I get the following error:

...
g++ -pthread -shared -Wl,-soname,libwkhtmltox.so.0 -fPIC -o libwkhtmltox.so.0.12.2 loadsettings.o multipageloader.o tempfile.o converter.o websettings.o reflect.o utilities.o pdfsettings.o pdfconverter.o outline.o tocstylesheet.o imagesettings.o imageconverter.o pdf_c_bindings.o image_c_bindings.o moc_multipageloader_p.o moc_converter_p.o moc_pdfconverter_p.o moc_imageconverter_p.o moc_pdf_c_bindings_p.o moc_image_c_bindings_p.o moc_converter.o moc_multipageloader.o moc_utilities.o moc_pdfconverter.o moc_imageconverter.o qrc_wkhtmltopdf.o    -L/usr/local/lib -L/usr/local/src/wkhtmltox-0.12.2.1/static-build/posix-local/qt/lib -lQtWebKit -L/usr/local/src/wkhtmltox-0.12.2.1/static-build/posix-local/qt/lib -L/usr/local/lib -L/usr/X11R6/lib -lQtSvg -lQtXmlPatterns -lQtGui -ljpeg -lpng -lXrender -lfontconfig -lfreetype -lXext -lX11 -lQtNetwork -lQtCore -lz -lm 
/usr/bin/ld: /usr/local/src/wkhtmltox-0.12.2.1/static-build/posix-local/qt/lib/libQtWebKit.a(JITStubs.o): relocation R_X86_64_PC32 against `cti_vm_throw' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
Makefile:157: recipe for target '../../bin/libwkhtmltox.so.0.12.2' failed
make[1]: *** [../../bin/libwkhtmltox.so.0.12.2] Error 1
make[1]: Leaving directory '/usr/local/src/wkhtmltox-0.12.2.1/static-build/posix-local/app/src/lib'
Makefile:41: recipe for target 'sub-src-lib-make_default-ordered' failed
make: *** [sub-src-lib-make_default-ordered] Error 2
make -j8

any ideas what I am missing here?

@hostingnuggets hostingnuggets reopened this Jan 1, 2016
@frenkel
Contributor
frenkel commented Jan 2, 2016

@hostingnuggets You should Be able to compile on 5.8 or -current with the patch at http://marc.info/?l=openbsd-ports&m=145150965127632&w=2 This will hopefully be accepted for 5.9

@hostingnuggets

@frenkel cheers! Does your patch also work on the source (wkhtmltox-0.12.2.1.tar.bz2) ? or is it only usable with the OpenBSD ports?

@frenkel
Contributor
frenkel commented Jan 2, 2016

It downloads the source of 0.12.2.4 and compiles it.

@hostingnuggets

@frenkel I just downloaded the OpenBSD 5.8 ports from http://ftp.openbsd.org/pub/OpenBSD/5.8/ports.tar.gz but there are no textproc/wkhtmltopdf port in that file...

@frenkel
Contributor
frenkel commented Jan 3, 2016

@hostingnuggets Yes, you need to get it from -current and apply my diff. The result will work in -current but also in 5.8 (copy it to /usr/ports/textproc/wkhtmltopdf)

@hostingnuggets

@frenkel thanks for the info, now I am wondering your patch files includes patches for files which does not exist such as patches/patch-qt_config_tests_unix_gnu-libiconv_gnu-libiconv_cpp is this normal? or are there any special instructions to apply this patch?

@frenkel
Contributor
frenkel commented Jan 4, 2016

You should apply the patches to ports of current and then run make build, it will do everything for you, no need to patch things manually

@hostingnuggets

@frenkel somehow it doesn't work look here when I try to run patch with your patch it asks me for a file to patch:

user@/tmp/ports$ patch  < ~/wk.patch 
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: Makefile
|===================================================================
|RCS file: /cvs/ports/textproc/wkhtmltopdf/Makefile,v
|retrieving revision 1.1.1.1
|diff -u -p -r1.1.1.1 Makefile
|--- Makefile   4 Nov 2015 21:11:16 -0000       1.1.1.1
|+++ Makefile   27 Dec 2015 19:59:30 -0000
--------------------------
File to patch: 
@frenkel
Contributor
frenkel commented Jan 5, 2016

Yes, you should cd in to /usr/ports/textproc/wkhtmltopdf/ before running patch

@hostingnuggets

@frenkel, I ran the GNU patch command from that directory now but there are other issues as you can see below from the output:

user@/tmp/ports/textproc/wkhtmltopdf$ gpatch  < ~/wk.patch 
patching file Makefile
Hunk #1 FAILED at 5.
Hunk #2 succeeded at 19 (offset -1 lines).
1 out of 2 hunks FAILED -- saving rejects to file Makefile.rej
patching file distinfo
patching file patch-qt_config_tests_unix_gnu-libiconv_gnu-libiconv_cpp
patching file patch-qt_qmake_generators_unix_unixmake2_cpp
patching file patch-qt_qmake_generators_unix_unixmake_cpp
patching file patch-qt_src_3rdparty_webkit_Source_JavaScriptCore_heap_MachineStackMarker_cpp
patching file patch-qt_src_3rdparty_webkit_Source_JavaScriptCore_jit_JITStubs_cpp
patching file patch-qt_src_corelib_codecs_qiconvcodec_cpp
can't find file to patch at input line 418
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: patches/patch-src_image_image_pro
|===================================================================
|RCS file: /cvs/ports/textproc/wkhtmltopdf/patches/patch-src_image_image_pro,v
|retrieving revision 1.1.1.1
|diff -u -p -r1.1.1.1 patch-src_image_image_pro
|--- patches/patch-src_image_image_pro  4 Nov 2015 21:11:16 -0000       1.1.1.1
|+++ patches/patch-src_image_image_pro  27 Dec 2015 19:59:30 -0000
--------------------------
File to patch:
@frenkel
Contributor
frenkel commented Jan 6, 2016

I've created at complete zip for you of my port, just remove textproc/wkhtmltopdf and replace it with the contents of this zip.
wkhtmltopdf.zip

@hostingnuggets

Thanks for your zip file but when I run make build I get the following error:

Makefile:128: *** missing separator. Stop.

@frenkel
Contributor
frenkel commented Jan 6, 2016

Is that the only output? Did you replace tabs with spaces by copy-pasting?

@hostingnuggets

That's the only output and the only command I ran was unzip on your ZIP file in the textproc directory.

@frenkel
Contributor
frenkel commented Jan 6, 2016

That's really weird. Is your ports checkout complete? Is make the BSD make? Are you running this on 5.8?

@hostingnuggets

I tried with OpenBSD make as well as GNU make and I ran this in the ports from the snapshot as well as the ports from 5.8 on my OpenBSD 5.8 installation.

@frenkel
Contributor
frenkel commented Jan 6, 2016

Are you able to build other ports? E.g. run make build in /usr/ports/x11/qt4?

@hostingnuggets

My bad, I had make linked to gmake. I corrected that but now I get another error:

===>  Checking files for p0
`/usr/ports/distfiles/.tar.gz' is up to date.
`/usr/ports/distfiles/wkhtmltopdf-qt-7e48a1fac7e0f9aefccd01e9871f987da3a62fda.tar.gz' is up to date.
!!! Extra file 'wkhtmltopdf-0.12.2.4.tar.gz' in /usr/ports/textproc/wkhtmltopdf/distinfo
!!! Read up on SUPDISTFILES in bsd.port.mk(5)
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2344 '_internal-checksum': @fgrep 2>/dev/null SIZE /usr/ports/textproc/wkhtmltopd...)
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2575 '/usr/ports/pobj//.extract_done')
*** Error 1 in /usr/ports/textproc/wkhtmltopdf (/usr/ports/infrastructure/mk/bsd.port.mk:2488 'build')
@frenkel
Contributor
frenkel commented Jan 6, 2016

/usr/ports/distfiles/.tar.gz' is up to date. doesn't seem right, the filename is missing somehow. Are you also using a different shell maybe?

@hostingnuggets

I am using BASH but I also tried with ksh and it is the same.

@frenkel
Contributor
frenkel commented Jan 6, 2016

It's because -current has some changes I guess. Could you replace ${DISTNAME}.tar.gz with wkhtmltopdf-0.12.2.4.tar.gz in the Makefile and try again?

@hostingnuggets

cheers it's compiling now!

@frenkel
Contributor
frenkel commented Jan 6, 2016

Great! My patch has been accepted, so there will be a 5.9 binary 😃

@frenkel
Contributor
frenkel commented Jan 6, 2016

@ashkulz You can close this one.

@hostingnuggets

@frenkel do not close yet, it compiled wkhtmltopdf but when I run it I get the following error:

Unable to load library icui18n "Cannot load library icui18n: (File not found)"

@hostingnuggets

congrats for the patch btw ;)

@frenkel
Contributor
frenkel commented Jan 8, 2016

That error was just fixed by another developer 😊

@hostingnuggets

Good, where can I get the patch to correct this error?

@hostingnuggets

I am now testing wkhtmltopdf with its official package (http://mirror.switch.ch/ftp/pub/OpenBSD/snapshots/packages/amd64/wkhtmltopdf-0.12.2.4p2.tgz) from the ports on OpenBSD 5.9 (snapshots) but I still have the same error when trying to run it:

Unable to load library icui18n "Cannot load library icui18n: (File not found)"

any ideas what could be wrong?

@frenkel
Contributor
frenkel commented Mar 21, 2016

Thanks for you report. However, this is not really the place to report such bugs. Could you report it to ports@openbsd.org next time?

It seems icu4c is a dependency that is not listed in the package. On my machines it was already installed. Does the error go away when you install http://mirror.switch.ch/pub/os/OpenBSD/snapshots/packages/amd64/icu4c-56.1p1.tgz

Btw, could you close this bug report as you were the original reporter?

@hostingnuggets

I installed the icu4u package as recommended and now the error message is gone but no matter what I want to convert to PDF it core dumps as you can see below:

$ wkhtmltopdf http://www.google.com /tmp/g.pdf
Segmentation fault (core dumped) 

I will report this to the ports@openbsd.org directly.

@frenkel
Contributor
frenkel commented Mar 21, 2016

That is probably because you have datasize limits in login.conf that are too low. For most websites I need more than 1GB in there, otherwise the kernel will kill it.

@hostingnuggets

Thank you so much that was it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment