我想从最新的源码编译wkhtmltopdf
。我在Ubuntu 12.10 x64服务器版上。Ubuntu上的wkhtmltopdf编译
对于作者提到的wkhtmltopdf-qt
编译,新的Git回购是在4.8.2
分支上的gitorious.org/~antialize/qt/antializes-qt.git
。所以,这也是我用过的。
一切都很顺利。 (qt和wkhtmltopdf)的编译成功完成。但我只能以root身份使用wkhtmltopdf(使用sudo)。当我像其他用户一样运行它时,出现以下错误。
error while loading shared libraries: libQtWebKit.so.4: cannot open shared object file: No such file or directory.
我已经完成了所有的编译作为root用户,其中root用户的主目录(/ root)内的文件。我猜想wkhtmltopdf程序需要读取wkqt
目录,编译的qt所在的目录(和libQtWebKit.so.4
文件)。该目录也位于根用户的主目录中,因此阻止其他用户运行wkhtmltopdf
。
所以,我决定再次从头开始。这一次,我把所有的源文件(wkhtmltopdf-qt
和wkhtmltopdf
)放在/usr/wkhtmltopdf
。但是在编译qt的过程中,编译器尝试访问存在qt源的前一个(旧)位置(/root/wkhtmltopdf-qt
)处的qmake
时出现错误。下面
错误:
ln -s libQtDeclarative.so.4.8.2 libQtDeclarative.so
ln -s libQtDeclarative.so.4.8.2 libQtDeclarative.so.4
ln -s libQtDeclarative.so.4.8.2 libQtDeclarative.so.4.8
rm -f ../../lib/libQtDeclarative.so.4.8.2
rm -f ../../lib/libQtDeclarative.so
rm -f ../../lib/libQtDeclarative.so.4
rm -f ../../lib/libQtDeclarative.so.4.8
mv -f libQtDeclarative.so.4.8.2 libQtDeclarative.so libQtDeclarative.so.4 libQtDeclarative.so.4.8 ../../lib/
make[1]: Leaving directory `/usr/wkhtmltopdf/wkhtmltopdf-qt/src/declarative'
cd src/3rdparty/webkit/Source/ && make -f Makefile.WebKit
make[1]: Entering directory `/usr/wkhtmltopdf/wkhtmltopdf-qt/src/3rdparty/webkit/Source'
/root/wkhtmltopdf-qt/bin/qmake -spec ../../../../mkspecs/linux-g++-64 -o Makefile.WebKit WebKit.pro
make[1]: /root/wkhtmltopdf-qt/bin/qmake: Command not found
make[1]: *** [Makefile.WebKit] Error 127
make[1]: Leaving directory `/usr/wkhtmltopdf/wkhtmltopdf-qt/src/3rdparty/webkit/Source'
make: *** [sub-webkit-make_default-ordered] Error 2
我不明白这是怎么可能当我开始绝对新鲜的源代码。
有什么方法可以完全删除(卸载)以前安装的wkhtmltopdf-qt
和wkhtmltopdf
?
我将不胜感激。谢谢。