2013-01-21 58 views
0

我想从最新的源码编译wkhtmltopdf。我在Ubuntu 12.10 x64服​​务器版上。Ubuntu上的wkhtmltopdf编译

我使用了herehere的说明。

对于作者提到的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-qtwkhtmltopdf)放在/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-qtwkhtmltopdf

我将不胜感激。谢谢。

回答

0

好的,我想通了。

显然,源代码并不像我想的那么新鲜。

我正在清理QT源目录的Git工作副本中未跟踪和修改的文件。正在运行git status未显示修改的文件。但我错过的是,有很多git-ignored文件夹和文件,它们仍然有关于以前编译的信息。这些文件和文件夹没有显示在git status中。

因此,我暂时将.gitignore文件移出仓库并运行git clean -fd。这清理了所有不必要的文件。然后我将.gitignore文件移回。为了安全起见,我还运行了git checkout -- .以从HEAD获取所有文件的最新版本。

之后编译工作。