Last active
September 11, 2022 12:51
-
-
Save slickplaid/5557321 to your computer and use it in GitHub Desktop.
How to install version 0.12.0 (latest as of 5/10/13) of wkhtmltopdf on Ubuntu 12.04 LTS headless server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to install version 0.12.0 (latest as of 5/10/13) of | |
wkhtmltopdf on Ubuntu 12.04 LTS headless server. | |
You'll need to have the user in the sudoers group or | |
modify the script to properly execute the root commands | |
needed. | |
There might be a little bit of overkill on the font | |
inclusions, but I ran into a lot of issues with specific | |
fonts missing and this seems to fix it. | |
Reply to this gist if you have questions. If you know | |
how to build it as a static binary reliably, let me | |
know. Due to the build time and the number of attempts | |
I've made at it unsuccessfully, I haven't been able to | |
get a reproducible 0.12.0 build working yet. The build | |
time should take about 1/2 to a full hour, so be | |
prepared for it. A static build can take upwards of 3+ | |
hours. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update && sudo apt-get upgrade -y; | |
sudo apt-get build-dep -y libqt4-gui libqt4-network libqt4-webkit; | |
sudo apt-get install -y openssl build-essential xorg git git-core libssl-dev libxrender-dev t1-xfree86-nonfree xfonts-scalable ttf-ubuntu-font-family ttf-mscorefonts-installer poppler-utils libqt4-dev qt4-dev-tools; | |
cd ~; | |
git clone git://gitorious.org/~antialize/qt/antializes-qt.git wkhtmltopdf-qt; | |
git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf; | |
cd wkhtmltopdf; | |
qmake-qt4; | |
cd ../wkhtmltopdf-qt; | |
git checkout 4.8.4; | |
QTDIR=. ./bin/syncqt; | |
./configure -nomake tools,examples,demos,docs,translations -opensource -prefix ../wkqt; | |
make -j3 && make install; | |
cd ../wkhtmltopdf; | |
../wkqt/bin/qmake; | |
make -j3 && sudo make install; |
sudo apt-get update && sudo apt-get upgrade -y; sudo apt-get build-dep -y libqt4-gui libqt4-network libqt4-webkit; sudo apt-get install -y openssl build-essential xorg libssl-dev libxrender-dev t1-xfree86-nonfree xfonts-scalable ttf-ubuntu-font-family ttf-mscorefonts-installer poppler-utils libqt4-dev qt4-dev-tools;
cd ~; git clone git://gitorious.org/~antialize/qt/antializes-qt.git wkhtmltopdf-qt & git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf;
cd wkhtmltopdf; qmake-qt4; cd ../wkhtmltopdf-qt; git checkout 4.8.4; QTDIR=. ./bin/syncqt; ./configure -nomake tools,examples,demos,docs,translations -opensource -prefix ../wkqt;
nice -n 19 make -j1 && make install;
cd ../wkhtmltopdf; ../wkqt/bin/qmake; nice -n 19 make -j1 && sudo make install;
the make fails for me on 12.04. I get:
/usr/bin/ld: ../../build/qrc_wkhtmltopdf.o: relocation R_X86_64_32 against .rodata' can not be used when making a shared object; recompile with -fPIC ../../build/qrc_wkhtmltopdf.o: could not read symbols: Bad value collect2: ld returned 1 exit status make[1]: *** [../../bin/libwkhtmltox.so.0.12.1] Error 1 make[1]: Leaving directory
/home/ubuntu/wkhtmltopdf/src/lib'
make: *** [sub-src-lib-make_default-ordered] Error 2
Any idea what I'm doing wrong? I'm not sure where I'm supposed to put this flag "-fPIC"...
I get the same error.
http://wkhtmltopdf.org/downloads.html
Why don't you simply install the new .deb package?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UPDATE: If this happens, double check you ran the
sudo apt-get build-dep -y libqt4-gui libqt4-network libqt4-webkit;
command. I ran it before and kept getting this error, but after I ran it again, it installed more packages and seemed to fix the issue.When you run the
./configure
command on the custom QT build, if you get a configuration like this:There will be a good chance something is wrong. You want it to look more like this:
The
FontConfig support ..... yes
is probably one of the most important parts. I'm still research why this fails occasionally. Sometimes I can run it a second time and it works beautifully. Be aware of this when configuring.If you need to reconfigure, run
make confclean
in thewkhtmltopdf-qt
directory to clean out the old configuration options and start fresh.