ropensci / pdftools

Text Extraction, Rendering and Converting of PDF Documents
https://docs.ropensci.org/pdftools
Other
513 stars 69 forks source link

`pkg-config` also required for install on macOS #128

Open cjyetman opened 11 months ago

cjyetman commented 11 months ago

While trying to install {pdftools} on macOS (ARM64), I ran into problems, even after manually installing poppler with brew install poppler. I was getting the following error message

--------------------------- [ANTICONF] --------------------------------
Configuration failed to find 'poppler-cpp' system library. Try installing:
 * rpm: poppler-cpp-devel (Fedora, CentOS, RHEL)
 * brew: poppler (MacOS)
 * deb: libpoppler-cpp-dev (Debian, Ubuntu, etc)
 * On Ubuntu 16.04 or 18.04 use this PPA:
    sudo add-apt-repository -y ppa:cran/poppler
    sudo apt-get update
    sudo apt-get install -y libpoppler-cpp-dev
If poppler-cpp is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a poppler-cpp.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
<stdin>:1:10: fatal error: 'poppler-document.h' file not found
#include <poppler-document.h>
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.
--------------------------------------------------------------------

which seems to assume one already has pkg-config installed but not correctly configured, but I did not have pkg-config installed (nor know what it is frankly). Ultimately, this was easily resolved by running brew install pkg-config poppler.

Maybe this is all obvious to some, but it wasn't to me and took quite some time to figure out and I did not find this suggested anywhere on the www, so maybe this could be useful to document somewhere?

jeroen commented 11 months ago

Thanks, yes we sort of assume a full dev environment, including compilers, make, and pkg-config. But on MacOS most uses will be using precompiled binaries anyway. Are you not using the official R distribution?

cjyetman commented 11 months ago

I'm using Posit Package Manager, which currently does not have binaries for macOS/R4.3 https://packagemanager.posit.co/client/#/repos/cran/packages/overview?search=pdftools