[Oisf-users] Build error

Cooper F. Nelson cnelson at ucsd.edu
Tue Nov 25 19:03:22 UTC 2014

Hash: SHA1

I've had that problem for over a year on my hardened gentoo sensor, I
think its due to gentoo setting the _FORTIFY_SOURCE flag by default and
it gets set again during the suri build process.

I've fixed it by adding this bit to my build script:

> find libhtp/ -name Makefile -exec sed -i -e 's/-D_FORTIFY_SOURCE=2//' {} \;
> sed -i -e 's/\, _FORTIFY_SOURCE/\, 2/' src/suricata.c

There actually seem to be a couple problems like this with libhtp/suri,
in that the build process doesn't check/honor local environmental
variables.  For example, despite setting my CFLAGS to include '-O3' I
still see the '-O2' flag (twice!) during the build process.  In this
case it doesn't matter as the '-O3' directive makes it redundant.

Anyways I always felt this was kinda a hacky fix for this problem so I
looked up a better one; this seems to work on my system (when added to
the top of my build script):


This tells the C pre-processor to unset that variable before setting the
one defined in the oisf makefiles.

- -Coop

On 11/24/2014 4:34 PM, Data King wrote:
> Hello, 
> I'm trying to build suricata from source on a gentoo linux system.  I've
> tried stable (2.0.4) and development (2.1beta) sources, and sources from
> git.  All versions fail with the same error:
>   CC       suricata.o
> suricata.c: In function 'SCPrintBuildInfo':
> suricata.c:795:50: error: 'defined' undeclared (first use in this function)
>      printf("compiled with _FORTIFY_SOURCE=%d\n", _FORTIFY_SOURCE);
>                                                   ^
> suricata.c:795:50: note: each undeclared identifier is reported only
> once for each function it appears in
> suricata.c:795:50: error: expected ')' before numeric constant
>      printf("compiled with _FORTIFY_SOURCE=%d\n", _FORTIFY_SOURCE);
>                                                   ^
> Makefile:1421: recipe for target 'suricata.o' failed
> make[3]: *** [suricata.o] Error 1
> make[3]: Leaving directory '/root/suricata-git/oisf/src'
> Makefile:951: recipe for target 'all' failed
> make[2]: *** [all] Error 2
> make[2]: Leaving directory '/root/suricata-git/oisf/src'
> Makefile:446: recipe for target 'all-recursive' failed
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory '/root/suricata-git/oisf'
> Makefile:375: recipe for target 'all' failed
> make: *** [all] Error 2
> TIA for your assistance.
> D
> _______________________________________________
> Suricata IDS Users mailing list: oisf-users at openinfosecfoundation.org
> Site: http://suricata-ids.org | Support: http://suricata-ids.org/support/
> List: https://lists.openinfosecfoundation.org/mailman/listinfo/oisf-users
> Training now available: http://suricata-ids.org/training/

- -- 
Cooper Nelson
Network Security Analyst
UCSD ACT Security Team
cnelson at ucsd.edu x41042
Version: GnuPG v2.0.17 (MingW32)


More information about the Oisf-users mailing list