[英]How can I build libpoppler from source?
I just download poppler to Linux system,and I want to incorporate it in my app to parse pdf file.我只是将 poppler 下载到 Linux 系统,我想将它合并到我的应用程序中来解析 pdf 文件。
(My goal is to convert pdf file to plain text.) (我的目标是将 pdf 文件转换为纯文本。)
How can I do this?我怎样才能做到这一点?
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. Poppler的git树包含一个无用的
INSTALL
文档,它只是告诉你运行./configure
,但它们不包含git中的automake / autoconf自动生成的文件(包括configure)。 (Probably they do include them in tarball source releases.) (可能他们确实将它们包含在tarball源代码中。)
I just built poppler from git source (on Ubuntu 15.04) like so: 我刚刚从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
It appears that they maintain an autoconf/automake build setup, so you can use that OR cmake to create a Makefile
. 它们似乎维护了autoconf / automake构建设置,因此您可以使用该OR cmake来创建
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 run utils/pdftotext
or whatever right from the source directory. 如果你只是想看看最新的git poppler是否比distro包更好,你不需要
sudo make install
,你可以只运行utils/pdftotext
或者源目录中的任何东西。 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
. 它显然告诉链接器将构建路径嵌入到二进制文件中,作为库搜索路径,因此运行
/usr/local/src/poppler/utils/pdftotext
工作,并找到/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
with sudo make install
. 如果最新的poppler确实比发行版打包的poppler工作得更好,你应该使用
sudo make install
将它安装到/usr/local/bin
。 When you upgrade to the next version of your distro, check your /usr/local. 当您升级到发行版的下一个版本时,请检查/ 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}
. 通常新的发行版本比你从源代码构建时更新,所以你应该从
/usr/local/{bin,share,lib,man,include}
删除你的版本。 (Or make uninstall
in the source dir, if supported). (或者如果支持,在源目录中
make uninstall
)。
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到 2021 年底,他们的主页上写着
We run continuous integration via the gitlab CI
我们通过 gitlab CI 运行持续集成
I checked out their .gitlab-ci.yml which has many build tasks.我查看了他们的 .gitlab-ci.yml ,其中有许多构建任务。 It would seem these days we build libpoppler like this:
现在看起来我们像这样构建 libpoppler:
git clone git://git.freedesktop.org/git/poppler/test test.repo
mkdir -p build && cd build
cmake -DTESTDATADIR=`pwd`/../test.repo -G Ninja ..
ninja
Their website explains it very clearly : 他们的网站非常清楚地解释了:
Poppler is available from git.
Poppler可以从git获得。 To clone the repository use the following command:
要克隆存储库,请使用以下命令:
git clone git://git.freedesktop.org/git/poppler/poppler
Once you download the source code, read the INSTALL
file where it says : 下载源代码后,请阅读
INSTALL
文件,其中包含:
cd
to the directory containing the package's source code and type./configure
to configure the package for your system.cd
到包含包源代码的目录,然后键入./configure
以配置系统包。Type `make' to compile the package.
输入`make'来编译包。
Type `make install' to install the programs and any data files and documentation.
输入`make install'来安装程序和任何数据文件和文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.