【问题标题】:wkhtmltopdf compilation on Ubuntu在 Ubuntu 上编译 wkhtmltopdf
【发布时间】:2013-01-22 06:16:46
【问题描述】:

我正在尝试从最新源编译wkhtmltopdf。我使用的是 Ubuntu 12.10 x64 服务器版。

我使用了来自here 和here 的说明。

对于wkhtmltopdf-qt 编译,正如作者所说,新的Git repo 位于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 文件)。该目录也位于 root 用户的主目录中,从而阻止其他用户运行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?

我将不胜感激。谢谢。

【问题讨论】:

    标签: compilation wkhtmltopdf


    【解决方案1】:

    好的,我想通了。

    显然,源代码并没有我想象的那么新鲜。

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

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

    在那之后编译工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-12
      • 1970-01-01
      • 2016-02-01
      • 2016-10-13
      • 2020-12-11
      • 2015-11-16
      相关资源
      最近更新 更多