0

我正在尝试wkhtmltopdf从最新的源代码编译。我在 Ubuntu 12.10 x64 服务器版上。

我使用了这里这里的说明。

对于wkhtmltopdf-qt编译,正如作者所说,新的 Git 存储库位于gitorious.org/~antialize/qt/antializes-qt.git分支上4.8.2。所以,这也是我使用的。

一切都很顺利。(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文件)。该目录也位于 root 用户的主目录中,因此阻止其他用户运行wkhtmltopdf.

所以,我决定从头开始。这一次,我把所有的源文件(wkhtmltopdf-qtwkhtmltopdf)放在/usr/wkhtmltopdf. 但是在 qt 的编译过程中,编译器尝试访问qmake存在 qt 源的先前(旧)位置时出现错误(/root/wkhtmltopdf-qt)。

以下错误:

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

我会很感激一些帮助。谢谢。

4

1 回答 1

0

Okay, I figured it out.

Apparently, the source code was not as fresh as I thought.

I was cleaning the untracked and modified files in the Git working copy of the QT source directory. Running git status showed no modified files. But what I missed was that there were a lot of git-ignored folders and files, which still had the info about the previous compilation. These files and folders were not showing up in git status.

So, I temporarily moved the .gitignore file outside the repo and ran git clean -fd. That cleaned out all unnecessary files. Then I moved the .gitignore file back. For safety, I also ran git checkout -- . to get the latest versions of all the files from HEAD.

Compilation worked after that.

于 2013-01-21T22:16:46.497 回答