如何从源代码构建libpoppler?

zxi*_*zxi 3 c++ linux pdf poppler

我只是将poppler下载到Linux系统,我想将它合并到我的应用程序中来解析pdf文件.
(我的目标是将pdf文件转换为纯文本.)
我该怎么做?

Pet*_*des 8

Poppler的git树包含一个无用的INSTALL文档,只是告诉你运行./configure,但它们不包括git中的automake/autoconf自动生成的文件(包括configure).(可能他们确实将它们包含在tarball源代码中.)

我刚刚从git source(在Ubuntu 15.04上)构建了poppler,如下所示:

git clone --depth 50 --no-single-branch git://git.freedesktop.org/git/poppler/poppler
cmake -G 'Unix Makefiles'  # other -G options are to generate project files for various IDEs
# look at the output.  If it didn't find some libraries,
# install them with your package manager and re-run cmake
make -j4
# optionally:
sudo make install
Run Code Online (Sandbox Code Playgroud)

它们似乎维护了autoconf/automake构建设置,因此您可以使用该OR cmake来创建Makefile.

如果你只是想看看最新的git poppler是否比distro包更好,你不需要sudo make install,你可以直接utils/pdftotext从源目录运行或者其他任何东西.它显然告诉链接器将构建路径嵌入到二进制文件中,作为库搜索路径,因此运行/usr/local/src/poppler/utils/pdftotext工作,并找到/usr/local/src/poppler/libpoppler.so.52.

如果最新的poppler的工作确实较发行版包装poppler的更好,你应该把它安装到/usr/local/bin使用sudo make install.当您升级到发行版的下一个版本时,请检查/ usr/local.通常新的发行版版本比你从源代码构建它时更新,所以你应该从中删除你的版本/usr/local/{bin,share,lib,man,include}.(或者make uninstall在源目录中,如果支持的话).


BЈо*_*вић 1

他们的网站解释得很清楚:

Poppler 可从 git 获取。要克隆存储库,请使用以下命令:

git clone git://git.freedesktop.org/git/poppler/poppler
Run Code Online (Sandbox Code Playgroud)

下载源代码后,请阅读INSTALL文件中的内容:

  1. cd到包含程序包源代码的目录,然后键入 ./configure为您的系统配置程序包。

  2. 输入“make”来编译包。

  3. 输入“make install”来安装程序以及任何数据文件和文档。