问题
When running the checks for my R-package (via devtools::check()
) I face the warning ''qpdf' is needed for checks on size reduction of PDFs
. I found this question were it was suggested (if I understood the answer correctly) to run Sys.which(Sys.getenv("R_QPDF", "qpdf"))
and see whether qpdf is found or not. In my case this just returns
qpdf
""
so, I think I didn't install qpdf correctly. Unfortunately it seems to be quite complicated to install qpdf on Windows. My first side question is: does it really is so painful and complicated to install qpdf for Windows or is there an easy solution?
I've followed the instructions until it is said to add C:\MinGW-w64\bin and C:\MinGW-w64\lib\mingw to the PATH variable. But then I don't find further specific instructions to install qpdf, only about how to build qpdf with different other programs. The second side question is: is my assumption correct that after I've build qpdf it is installed? But the real question is: What is the best way to build qpdf? I tried the ./config-mingw32
and ./config-mingw64
commands from the section "Building with MinGW" in my C:\MinGW\msys\1.0\bin\bash.exe but got the error messages ./config-mingw32: No such file or directory
and have no idea how to fix this issue.
I'm using Windows 10, R version 3.3.2 Patched (2017-01-07 r71934) -- "Sincere Pumpkin Patch" and RStudio 1.0.136.
回答1:
You basically do not need to build the file on windows. Please follow three steps below:
- Download qpdf for windows from https://sourceforge.net/projects/qpdf/?source=typ_redirect
- Extract files in a temp folder
- Copy the contents of the bin folder to %SystemRoot%\System32
job done!
Sys.which(Sys.getenv("R_QPDF", "qpdf"))
qpdf
"C:\\WINDOWS\\SYSTEM32\\qpdf.exe"
回答2:
To flesh out an answer provided elsewhere:
If you are running the 32-bit version of R, it is important that you download the 32-bit version of qpdf, which is the version linked from the SourceForge homepage. If you are running a 64-bit installation of R, you will need to do a bit of digging to locate the 64-bit version of qpdf, which is buried a little more deeply (version 7.0 is listed here).
Rather than copying files to C:/Windows/System32
, a potentially safer option is to extracted the zipped qpdf directory to C:\Program Files
. If you do this, you'll need to add C:\Program Files\qpdf-version_number\bin
to your system PATH
under the environment variables, and re-start R so it picks up the modified PATH
.
One further step may be required to convince Windows that pqdf is safe to run.
Navigate to C:\Program Files\qpdf-version_numer\bin
and execute qpdf.exe
(by double-clicking). Windows 10 throws up a security warning, as it's an unrecognized executable file. You'll need to use the more options link to find the button to run the program. This done, Windows will recognize the file as safe to run and allow other software, including R, to use it.
回答3:
Setup MSVC environment, then configure and build as follows:
./config-msvc
make
Here is a more detailed steps: https://github.com/qpdf/qpdf/blob/master/README-windows.md
Hope it helps.
来源:https://stackoverflow.com/questions/41570633/how-to-build-qpdf-on-windows