How can I create libpoppler from source?

I just download poppler on a Linux system and I want to include it in my pdf file analysis application.
(My goal is to convert a PDF file to plain text.)
How can i do this?

+4
source share
2 answers

Their site explains this very clearly:

Poppler is available from git. To clone a 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:

  • cd to a directory containing the package source code and type ./configure to configure the package for your system.

  • Type `make 'to compile the package.

  • Type `make install 'to install programs and any data files and documentation.

+1
source

The Poppler git tree contains a useless INSTALL doc that just tells you to run ./configure , but they do not include automake / autoconf auto-generated files (including configure) in git. (Perhaps they include them in the original versions of tarball.)

I just built poppler from git source (on Ubuntu 15.04) like this:

 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 looks like they support autoconf / automake build customization, so you can use this OR cmake to create a Makefile .

If you just need to see if the new poppler git works better than the distribution, you do not need sudo make install , you can just run utils/pdftotext or whatever directly from the source directory. Apparently, he tells the linker to embed the build path in the binary as a library search path, so /usr/local/src/poppler/utils/pdftotext works and finds /usr/local/src/poppler/libpoppler.so.52 .

If the latter poppler works better than the distribution, then you should install it on /usr/local/bin using sudo make install . When you upgrade to the next version of your distribution, check / usr / local. Often a new distribution version will be newer than when you built it from the source code, so you just need to remove your version from /usr/local/{bin,share,lib,man,include} . (Or make uninstall in the source directory, if supported).

+6
source

Source: https://habr.com/ru/post/1391380/


All Articles