Reputation: 350
I am getting an "-Werror=format-security" error when gcc compiles lpSolve in R.
I am using Ubuntu 12.04 (lubuntu kernel) and R version 3.1.0.
Here is the exact error:
* 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’
I have tried manually installing it using R CMD INSTALL. I've also followed the instructions here to no avail.
Thanks for looking.
Upvotes: 2
Views: 1261
Reputation: 9
The error occurs at fprintf
in the functions, thus if you download the source code, re-make the package, and it'll be solved. But the lpSolve packing is currently orphaned. The error might occur due to the compiler check. Here's a way to make a detour.
/usr/lib/R/etc
, or /etc/R
).-Werror=format-security
in CFLAGS
. (It is read-only file, thus su
authority is required.)install.package('lpSolve')
I hope this helps you.
Upvotes: 0