ropensci / pdftools

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

updating via install.packages("pdftools") leads to inability to use library #111

Closed dcaud closed 2 years ago

dcaud commented 2 years ago

After updating the library, library(pdftools) now produces:

Error: package or namespace load failed for ‘pdftools’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/pdftools/libs/pdftools.so': dlopen(/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/pdftools/libs/pdftools.so, 0x0006): Library not loaded: /opt/X11/lib/libXrender.1.dylib Referenced from: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/pdftools/libs/pdftools.so Reason: tried: '/opt/X11/lib/libXrender.1.dylib' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/libXrender.1.dylib' (no such file)

Here's my session info:

R version 4.1.2 (2021-11-01) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Monterey 12.2.1

Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] shinybusy_0.3.0 shinyWidgets_0.6.4 magick_2.7.3 colourpicker_1.1.1 [5] shiny_1.7.1

loaded via a namespace (and not attached): [1] Rcpp_1.0.8.3 compiler_4.1.2 bslib_0.3.1 later_1.3.0
[5] jquerylib_0.1.4 shinyjs_2.1.0 tools_4.1.2 digest_0.6.29
[9] jsonlite_1.8.0 lifecycle_1.0.1 rlang_1.0.2 DBI_1.1.2
[13] cli_3.2.0 fastmap_1.1.0 withr_2.5.0 httr_1.4.2
[17] htmlwidgets_1.5.4 sass_0.4.1 askpass_1.1 qpdf_1.1
[21] R6_2.5.1 pool_0.1.6 purrr_0.3.4 magrittr_2.0.3
[25] promises_1.2.0.1 ellipsis_0.3.2 htmltools_0.5.2 mime_0.12
[29] xtable_1.8-4 httpuv_1.6.5 miniUI_0.1.1.1 cachem_1.0.6

dcaud commented 2 years ago

I also can't seem to revert to an older version, so I'm stuck. Any help would be appreciated.

devtools::install_version("pdftools", version = "2.3.1") fails with

Downloading package from url: https://cran.rstudio.com//src/contrib/Archive/pdftools/pdftools_2.1.tar.gz

  • installing source package ‘pdftools’ ... package ‘pdftools’ successfully unpacked and MD5 sums checked using staged installation Package poppler-cpp was not found in the pkg-config search path. Perhaps you should add the directory containing `poppler-cpp.pc' to the PKG_CONFIG_PATH environment variable No package 'poppler-cpp' found Homebrew 3.3.9 Homebrew/homebrew-core (git revision e251e3ffc46; last commit 2022-01-03) Homebrew/homebrew-cask (git revision 64ab035cd4; last commit 2022-01-03) Using PKG_CFLAGS=-I/usr/local/opt/poppler/include/cpp Using PKG_LIBS=-L/usr/local/opt/poppler/lib -lpoppler-cpp 'config' variable 'CXXCPP' is defunct ------------------------- ANTICONF ERROR --------------------------- Configuration failed because poppler-cpp was not found. Try installing:
    • deb: libpoppler-cpp-dev (Debian, Ubuntu, etc)
    • rpm: poppler-cpp-devel (Fedora, CentOS, RHEL)
    • csw: poppler_dev (Solaris)
    • brew: poppler (Mac OSX) 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: configuration failed for package ‘pdftools’

  • removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/pdftools’ Warning message: In i.p(...) : installation of package ‘/var/folders/x5/lxrbhxtw8v55k1006s6kjjfr0000gp/T//RtmpwTaVP6/remotes6be225befa2/pdftools’ had non-zero exit status
dcaud commented 2 years ago

I think the problem with using the new version is gone, after this: brew install xquartz

subhashishhh commented 2 years ago

I think the problem with using the new version is gone, after this: brew install xquartz

Yes, you are absolutely correct for my case also it is solved now for macOS Monterey. Thank you very much.

jeroen commented 2 years ago

@s-u can we please try to avoid the xquartz dependency for your poppler/cairo builds? Many people don't have this; the autobrew builds for cairo/poppler that we were using before did not have this problem.

yogat3ch commented 2 years ago

This issue persists on Arm Macs. My device specs are as follows: Chip: Apple M1 Pro MacOS Monterey 12.3.1

unable to load shared object '/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/pdftools/libs/pdftools.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/pdftools/libs/pdftools.so, 0x0006): Library not loaded: /opt/X11/lib/libXrender.1.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/pdftools/libs/pdftools.so
  Reason: tried: '/opt/X11/lib/libXrender.1.dylib' (no such file), '/usr/lib/libXrender.1.dylib' (no such file)
yogat3ch commented 2 years ago

brew install xquartz does fix the problem. Thank you @dcaud

jeroen commented 2 years ago

This is a bug caused by the CRAN build system. A workaround is to install pdftools from r-universe:

install.packages("pdftools", repos = "https://ropensci.r-universe.dev")
jeroen commented 2 years ago

I have added a workaround now.

yogat3ch commented 2 years ago

Awesome, thank you @jeroen !