I read the post How install poppler and was hopeful regarding my own difficulty, but no dice.
I am running R under Anaconda on a Ubuntu 18.04 Precision laptop. I wanted to install readtext (R package) to support some corpora linguistics study and attempted that from R terminal window. I had already installed quanteda without a problem so was surprised when readtext tripped on a pdftools requirement which in turn tripped
cannot find -lpoppler-cpp
I had already installed and uninstalled libpoppler-cpp-dev several times using
sudo apt-get install -y libpoppler-cpp-dev
That installed ok
libpoppler-cpp-dev is already the newest version (0.74.0-bionic0)
When I attempt the readtext install from R (again, running under Anaconda, which might be problem), it arrives at the pdftools install and finds the local pkg-config info
- installing source package ‘pdftools’ ... ** package ‘pdftools’ successfully unpacked and MD5 sums checked ** using staged installation Found pkg-config cflags and libs! Using PKG_CFLAGS=-I/usr/include/poppler/cpp -I/usr/include/poppler Using PKG_LIBS=-lpoppler-cpp
But then cannot find it:
/home/dalton/anaconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lpoppler-cpp collect2: error: ld returned 1 exit status make: *** [/home/dalton/anaconda3/lib/R/share/make/shlib.mk:6: pdftools.so] Error 1 ERROR: compilation failed for package ‘pdftools’
- removing ‘/home/dalton/anaconda3/lib/R/library/pdftools’
When I check pkg-config myself:
pkg-config --cflags --libs poppler-cpp
-I/usr/include/poppler/cpp -I/usr/include/poppler -lpoppler-cpp
I indeed find the same information the installer in R finds. When I chased down poppler with a system grep:
ls --recursive | grep -E "poppler"
I do not find poppler-cpp, though I find libpoppler-cpp-dev and other libpoppler-cpp files/folders. However, if I interrogate pkg-config:
pkg-config --cflags --libs libpoppler-cpp-dev
It tells me
Package libpoppler-cpp-dev was not found in the pkg-config search path. Perhaps you should add the directory containing `libpoppler-cpp-dev.pc' to the PKG_CONFIG_PATH environment variable. No package 'libpoppler-cpp-dev' found.
I used the PPA with backports of Poppler 0.74.0 for Ubuntu 18.04 (Bionic) recommended by @jeroen in the cited SE post above, but it appears there is some confusion between the Ubuntu proper and Anaconda R, since the R install is looking for poppler-cpp, but libpoppler-cpp-dev seems to be the appropriate target. Because I am running R under Anaconda, my system seems unaware of R:
apt-cache policy r-base-core
r-base-core: Installed: (none) Candidate: 3.4.4-1ubuntu1 Version table: 3.4.4-1ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
I realize this is all somewhat of a mess, but I am hoping someone will recognize an obvious problem and tell me what to hack up, e.g., modify the poppler-cpp.pc to point at the new library or the like.