Building with -Werror=format-security

Discussions on installation issues go here.

Moderator: Moderators

jamesjer
Posts: 26
Joined: 01 Mar 2012, 16:51

Building with -Werror=format-security

Postby jamesjer » 10 Mar 2015, 21:17

Some Linux distributions have started building their packages with -Werror=format-security. The polymake build almost succeeds in building with that flag, but needs this patch (against the 2.14 release) to succeed all the way:

Code: Select all

--- lib/core/src/perl/RefHash.xs.orig 2015-03-04 05:51:50.000000000 -0700 +++ lib/core/src/perl/RefHash.xs 2015-03-10 14:12:50.828577970 -0600 @@ -88,7 +88,7 @@ } \ } STMT_END -static char err_ref[]="Reference as a key in a normal hash"; +static const char err_ref[]="Reference as a key in a normal hash"; static inline int ref_key_allowed(HV* class)

User avatar
assarf
Developer
Posts: 74
Joined: 12 Oct 2011, 15:52

Re: Building with -Werror=format-security

Postby assarf » 12 Mar 2015, 12:58

Thank you.

We tried to reproduce the error, but we couldn't. Even with the -Werror=format-security flag everything compiled fine.

Which gcc/perl version did you use? And maybe other information (i.e. gcc options) which would help to reproduce the error.
no signature

jamesjer
Posts: 26
Joined: 01 Mar 2012, 16:51

Re: Building with -Werror=format-security

Postby jamesjer » 02 Jul 2015, 03:45

Oh dear, I obviously never came back to look for a reply. I'm terribly sorry.

Back in March, we would have been using gcc 5.0.0 and perl 5.20.2. The build is done with standard Fedora CFLAGS, namely these:

-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic

Plus, I add these flags specifically for the polymake build:

-I/usr/include/eigen3 -Wno-unused-local-typedefs

I cannot check whether I get the same result now with gcc 5.1.1 and perl 5.22.0 because, regrettably, the update to perl 5.22.0 broke the polymake build. I am currently trying to figure out how to fix it.


Return to “Installing polymake”

cron