gcc编译器无法安装R包lpSolve
gcc compiler fails for R package installation lpSolve
当gcc在R.中编译lpSolve时,我收到一个"-Werror=format security"错误
我使用的是Ubuntu 12.04(lubuntu内核)和R 3.1.0版本。
这是确切的错误:
* installing *source* package ‘lpSolve’ ...
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I . -DINTEGERTIME -DPARSER_LP -DBUILDING_FOR_R -DYY_NEVER_INTERACTIVE -DUSRDLL -DCLOCKTIME -DRoleIsExternalInvEngine -DINVERSE_ACTIVE=INVERSE_LUSOL -DINLINE=static -DParanoia -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c colamd.c -o colamd.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I . -DINTEGERTIME -DPARSER_LP -DBUILDING_FOR_R -DYY_NEVER_INTERACTIVE -DUSRDLL -DCLOCKTIME -DRoleIsExternalInvEngine -DINVERSE_ACTIVE=INVERSE_LUSOL -DINLINE=static -DParanoia -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c commonlib.c -o commonlib.o
commonlib.c: In function ‘blockWriteINT’:
commonlib.c:691:3: error: format not a string literal and no format arguments [-Werror=format-security]
commonlib.c: In function ‘blockWriteBOOL’:
commonlib.c:710:3: error: format not a string literal and no format arguments [-Werror=format-security]
commonlib.c: In function ‘blockWriteREAL’:
commonlib.c:732:3: error: format not a string literal and no format arguments [-Werror=format-security]
cc1: some warnings being treated as errors
make: *** [commonlib.o] Error 1
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I . -DINTEGERTIME -DPARSER_LP -DBUILDING_FOR_R -DYY_NEVER_INTERACTIVE -DUSRDLL -DCLOCKTIME -DRoleIsExternalInvEngine -DINVERSE_ACTIVE=INVERSE_LUSOL -DINLINE=static -DParanoia -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c commonlib.c -o commonlib.o
commonlib.c: In function ‘blockWriteINT’:
commonlib.c:691:3: error: format not a string literal and no format arguments [-Werror=format-security]
commonlib.c: In function ‘blockWriteBOOL’:
commonlib.c:710:3: error: format not a string literal and no format arguments [-Werror=format-security]
commonlib.c: In function ‘blockWriteREAL’:
commonlib.c:732:3: error: format not a string literal and no format arguments [-Werror=format-security]
cc1: some warnings being treated as errors
make: *** [commonlib.o] Error 1
ERROR: compilation failed for package ‘lpSolve’
* removing ‘/home/ben/lpSolve.Rcheck/lpSolve’
我已尝试使用R CMD INSTALL手动安装它。我也遵循了这里的指示,但没有用。
谢谢你的光临。
函数中的fprintf发生错误,因此,如果您下载源代码,重新制作包,它就会得到解决。但是lpSolve包装目前是孤立的。该错误可能是由于编译器检查而发生的。这里有一个绕行的方法。
- 转到R etc路径(例如/usr/lib/R/etc或/etc/R)
- 编辑Makeconf文件:remove-Weror=CFLAGS中的格式安全性。(它是只读文件,因此需要su权限。)
- 重新安装程序包:install.package('lpSolve')
- 如有必要,请还原Makeconf文件
我希望这对你有帮助。
相关文章:
- 在Ubuntu 16.04上安装Cilk时出现问题
- 在CMakeLists.txt的安装功能中使用.cmake文件有什么用
- C++:如何在CLion IDE中安装Boost
- 安装opencv失败-粘贴CMakeError.log的内容
- 在cygwin中测试新的boost安装时出现cpp错误
- 有人安装"IITB Simplecpp in mac"吗?
- 我可以在 Arduino 的库文件夹之外安装库吗?
- Mingw-64 在构建和安装后不会编译 openCV 代码
- 为什么构建目录中新构建的共享库与安装目录中的副本具有不同的依赖项集?
- 安装 libc++ 时出现问题
- 安装MinGW后C++编译器不起作用?
- 介子复制/安装头文件到输出目录并保持文件夹结构
- 无法安装 R 包 "nloptr"(Ubuntu 16.04 上的 R3.6.2) - C++编译器问题
- 如何在 Ubuntu 上安装 OpenCV for C/C++
- 检查是否安装了 windows10 C++
- 安装 psutil 和为 pypy 配置期间出错
- 如何在 Debian 10 上安装 CPP 手册页?
- 如何更改使用 CPack 安装的可执行文件的名称?
- 使用 MinGW 在 Windows 上安装 GMP 时出错
- gcc编译器无法安装R包lpSolve