[英]How to build qpdf on Windows?
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
.在运行对我的 R 包的检查时(通过
devtools::check()
),我面临警告''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.我发现这个问题是建议(如果我正确理解答案)运行
Sys.which(Sys.getenv("R_QPDF", "qpdf"))
并查看是否找到 qpdf 。 In my case this just returns在我的情况下,这只是返回
qpdf ""
so, I think I didn't install qpdf correctly.所以,我想我没有正确安装 qpdf。 Unfortunately it seems to be quite complicated to install qpdf on Windows.
不幸的是,在 Windows 上安装 qpdf 似乎相当复杂。 My first side question is: does it really is so painful and complicated to install qpdf for Windows or is there an easy solution?
我的第一个问题是:为 Windows 安装 qpdf 真的那么痛苦和复杂,还是有一个简单的解决方案?
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.我一直按照说明进行操作,直到据说将 C:\\MinGW-w64\\bin 和 C:\\MinGW-w64\\lib\\mingw 添加到 PATH 变量中。 But then I don't find further specific instructions to install qpdf, only about how to build qpdf with different other programs.
但是后来我没有找到安装qpdf 的进一步具体说明,只是关于如何使用不同的其他程序构建qpdf。 The second side question is: is my assumption correct that after I've build qpdf it is installed ?
第二个问题是:我的假设是否正确,在我构建了qpdf 之后它被安装了? But the real question is: What is the best way to build qpdf?
但真正的问题是:构建 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.我在 C:\\MinGW\\msys\\1.0\\bin\\bash.exe 的“Building with MinGW”部分尝试了
./config-mingw32
和./config-mingw64
命令,但收到了错误消息./config-mingw32: No such file or directory
,也不知道如何解决这个问题。
I'm using Windows 10, R version 3.3.2 Patched (2017-01-07 r71934) -- "Sincere Pumpkin Patch" and RStudio 1.0.136.我使用的是 Windows 10,R 版本 3.3.2 已修补(2017-01-07 r71934)——“Sincere Pumpkin Patch”和 RStudio 1.0.136。
You basically do not need to build the file on windows.您基本上不需要在 Windows 上构建文件。 Please follow three steps below:
请按照以下三个步骤操作:
job done!任务完成!
Sys.which(Sys.getenv("R_QPDF", "qpdf"))
qpdf
"C:\\WINDOWS\\SYSTEM32\\qpdf.exe"
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.如果您运行的是 32 位版本的 R,那么下载qpdf 的 32 位版本很重要,这是从 SourceForge 主页链接的版本。 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 10.0.1 is listed here ).
如果您正在运行 R 的 64 位安装,则需要进行一些挖掘才能找到埋藏更深的 64 位版本的 qpdf(此处列出了10.0.1 版)。
Rather than copying files to C:/Windows/System32
, a potentially safer option is to extracted the zipped qpdf directory to C:\\Program Files
.不是将文件复制到
C:/Windows/System32
,一个可能更安全的选择是将压缩的 qpdf 目录解压缩到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.如果这样做,您需要将
C:\\Program Files\\qpdf-version_number\\bin
到环境变量下的系统PATH
。
Sys.setenv('PATH' = paste0('C:\\Program Files\\qpdf-version_numer\\bin;', Sys.getenv('PATH')))
Sys.setenv('PATH' = paste0('C:\\Program Files\\qpdf-version_numer\\bin;', Sys.getenv('PATH')))
PATH
.PATH
。 One further step may be required to convince Windows that pqdf is safe to run.可能需要进一步的步骤来让 Windows 相信 pqdf 可以安全运行。 Navigate to
C:\\Program Files\\qpdf-version_numer\\bin
and execute qpdf.exe
(by double-clicking).导航到
C:\\Program Files\\qpdf-version_numer\\bin
并执行qpdf.exe
(双击)。 Windows 10 throws up a security warning, as it's an unrecognized executable file. Windows 10 发出安全警告,因为它是一个无法识别的可执行文件。 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.
完成后,Windows 会将该文件识别为可以安全运行并允许其他软件(包括 R)使用它。
Setup MSVC environment, then configure and build as follows:设置MSVC环境,然后配置和构建如下:
./config-msvc
make
Here is a more detailed steps: https://github.com/qpdf/qpdf/blob/master/README-windows.md这是更详细的步骤: https : //github.com/qpdf/qpdf/blob/master/README-windows.md
Hope it helps.希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.