如何从源代码构建 libpoppler?
我刚刚将 poppler 下载到 Linux 系统,我想将它合并到我的应用程序中来解析 pdf 文件。
(我的目标是将 pdf 文件转换为纯文本。)
我该怎么做?
I just download poppler to Linux system,and I want to incorporate it in my app to parse pdf file.
(My goal is to convert pdf file to plain text.)
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Poppler 的 git 树包含一个无用的
INSTALL
文档,它只是告诉你运行./configure
,但它们不包含 automake/autoconf 自动生成的文件(包括配置) git。 (可能他们确实将它们包含在 tarball 源版本中。)我刚刚从 git 源(在 Ubuntu 15.04 上)构建了 poppler,如下所示:
看来他们维护了 autoconf/automake 构建设置,因此您可以使用该 OR cmake 创建一个 <代码>Makefile。
如果您只是想看看最新的 git poppler 是否比发行版包更好用,则不需要
sudo make install
,只需运行utils/pdftotext
或源目录中的任何内容。它显然告诉链接器将构建路径作为库搜索路径嵌入到二进制文件中,因此运行/usr/local/src/poppler/utils/pdftotext
可以工作,并找到/usr /local/src/poppler/libpoppler.so.52
。如果最新的 poppler 确实比发行版打包的 poppler 工作得更好,您应该使用
sudo make install
将其安装到/usr/local/bin
。当您升级到发行版的下一个版本时,请检查您的 /usr/local.conf 文件。通常,新的发行版版本会比您从源代码构建时更新,因此您应该从/usr/local/{bin,share,lib,man,include}
中删除您的版本。 (或者如果支持的话,在源目录中make uninstall
)。Poppler's git tree includes a useless
INSTALL
doc that just tells you to run./configure
, but they don't include automake/autoconf auto-generated files (including configure) in git. (Probably they do include them in tarball source releases.)I just built poppler from git source (on Ubuntu 15.04) like so:
It appears that they maintain an autoconf/automake build setup, so you can use that OR cmake to create a
Makefile
.If you just want to see if the latest git poppler works better than the distro package, you don't need to
sudo make install
, you can just runutils/pdftotext
or whatever right from the source directory. It apparently tells the linker to embed the build path into the binary, as a library search path, so running/usr/local/src/poppler/utils/pdftotext
works, and finds/usr/local/src/poppler/libpoppler.so.52
.If the latest poppler does work better than the distro-packaged poppler, you should install it to
/usr/local/bin
withsudo make install
. When you upgrade to the next version of your distro, check your /usr/local. Often the new distro version will be newer than when you built it from source, so you should just remove your version from/usr/local/{bin,share,lib,man,include}
. (Ormake uninstall
in the source dir, if supported).他们的网站解释得非常清楚:
下载源代码后,请阅读
INSTALL
文件,其中显示:Their website explains it very clearly :
Once you download the source code, read the
INSTALL
file where it says :由于时间过去了,似乎有些不确定,我也看了看。
2021 年底,他们的主页表示
我查看了 他们的 .gitlab-ci.yml 有许多构建任务。现在我们似乎像这样构建 libpoppler:
Since some time has passed and it seems there was some uncertainty, I also took a look.
At the end of 2021, their homepage says
I checked out their .gitlab-ci.yml which has many build tasks. It would seem these days we build libpoppler like this:
如果您想从源代码安装
poppler
而不影响系统(提供发行版)中的poppler
,我建议JHBuild,就像这样简单:If you want to install
poppler
from source without affecting thepoppler
from your system (distro provided) I recommend JHBuild, as easy as: