owasp-modsecurity / ModSecurity

ModSecurity is an open source, cross platform web application firewall (WAF) engine for Apache, IIS and Nginx. It has a robust event-based programming language which provides protection from a range of attacks against web applications and allows for HTTP traffic monitoring, logging and real-time analysis.
https://www.modsecurity.org
Apache License 2.0
8.2k stars 1.6k forks source link

parser/seclang-parser.hh: No such file or directory #1116

Closed raiak11 closed 8 years ago

raiak11 commented 8 years ago

Hi

I'm trying to comple ModSecurity, but I get this error. Also before I had to execute manually the following command to get "y.tab.c" and "y.tab.h"

"bison -dy seclang-parser.yy"

But I don't know how to generate or get : "seclang-parser.hh"

thanks in advance

zimmerle commented 8 years ago

Hi @raiak11,

The autotools/buildscripts should generate those files to you. There are any errors during the configure process? Do you mind to share your config.log ?

raiak11 commented 8 years ago

Hi Zimmerle

Thanks. During the execution of "sh build.sh" I get an error:

configure.ac:40: error: possibly undefined macro: AC_PROG_AR

If I comment the line I can continue... I don't know if it is related with the issue

also get the following messagges durnint "./configure":

checking for libcurl config script... /usr/bin/curl-config ./configure: line 5444: test: : integer expression expected ./configure: line 5447: test: : integer expression expected ./configure: line 5450: test: : integer expression expected checking if libcurl is at least v... yes, 7.19.7 checking if libcurl is linked with gnutls... no configure: using curl v7.19.7 checking for libxml2 config script... /usr/local/bin/xml2-config ./configure: line 5590: test: : integer expression expected ./configure: line 5593: test: : integer expression expected ./configure: line 5596: test: : integer expression expected checking if libxml2 is at least v2.6.29... yes, 2.7.2 configure: using libxml2 v2.7.2 checking for libpcre config script... /usr/bin/pcre-config ./configure: line 5708: test: : integer expression expected ./configure: line 5711: test: : integer expression expected ./configure: line 5714: test: : integer expression expected ./configure: line 5717: test: : integer expression expected

thanks!

raiak11 commented 8 years ago

Hi again

I found this in my config.log:

configure:4434: gcc -o conftest -g -O2 conftest.c >&5 /tmp/ccvDfBz1.o: In function input': /home/Operations/mmalet/modsecurity/ModSecurity/lex.yy.c:1168: undefined reference toyywrap' /tmp/ccvDfBz1.o: In function yylex': /home/Operations/mmalet/modsecurity/ModSecurity/lex.yy.c:867: undefined reference toyywrap' /tmp/ccvDfBz1.o: In function main': /home/Operations/mmalet/modsecurity/ModSecurity/conftest.l:17: undefined reference toyywrap' collect2: ld returned 1 exit status configure:4441: $? = 1 configure: failed program was: #line 3 "lex.yy.c"
#define YY_INT_ALIGNED short int
/* A lexical scanner generated by flex */
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2

{.....}

zimmerle commented 8 years ago

Please double check to see if you have the flex utility installed. It is necessary for this configuration step.

raiak11 commented 8 years ago

Hi Yes, I have flex installed, version 2.5.35

flex --version flex 2.5.35

thanks!

zimmerle commented 8 years ago

What is your distribution/version ?

raiak11 commented 8 years ago

cat /etc/SuSE-release SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 3

thanks!

raiak11 commented 8 years ago

Also tried in CentOS 6.7, with the same problem

zimmerle commented 8 years ago

Hi @raiak11,

Did you follow the guide available here: https://github.com/SpiderLabs/ModSecurity/wiki/Compilation-recipes#centos-65-minimal

?

raiak11 commented 8 years ago

Hi zimmerle

yes, I installed all dependencies. I guess is a problem with the "flex" package, is that correct? Maybe other version? newer

raiak11 commented 8 years ago

Hi @zimmerle

I instelled it in a clean machine, a SLES 12, and now it works fine! I don't know what happened.. anyway thanks!!

aminrastgoo commented 8 years ago

I have same problem trying to build on ubuntu precise with is forced by my Company. I got bison 3.0.2 from git and ./configure && make && make install. now trying to compile libmodsecurity: config.log.txt I tried adding -lfl to gcc params, which change output a little!: configure:4712: gcc -lfl -o conftest -g -O2 conftest.c >&5 /tmp/cccDwJdZ.o: In functionmain': /root/ModSecurity/conftest.l:16: multiple definition of main' /usr/lib/x86_64-linux-gnu/libfl_pic.a(libfl_pic_a-libmain.o):/build/buildd/flex-2.5.35/libmain.c:29: first defined here /tmp/cccDwJdZ.o: In functionyylex': conftest.c:(.text+0xb53): undefined reference to yywrap' conftest.c:(.text+0xfa0): undefined reference toyywrap' /tmp/cccDwJdZ.o: In function main': conftest.c:(.text.startup+0x9): undefined reference toyywrap' collect2: ld returned 1 exit status configure:4712: $? = 1 ` I had many troubles with modsecurity_refactoring and forced to migrate to libmodsecurity but it isn't compiled either.

zimmerle commented 8 years ago

Hi @aminrastgoo,

Make sure you have all the dependencies installed. Most likely you don't flex/bison installed.

aminrastgoo commented 8 years ago

Hi @zimmerle this is my flex/bison version: flex --version flex 2.5.35 bison --version bison (GNU Bison) 3.0.2 Written by Robert Corbett and Richard Stallman.

aminrastgoo commented 8 years ago

I don't know if it is related to this: sh build.sh libtoolize: putting auxiliary files in.'. libtoolize: copying file ./ltmain.sh' libtoolize: putting macros in AC_CONFIG_MACRO_DIR,build'. libtoolize: copying file build/libtool.m4' libtoolize: copying filebuild/ltoptions.m4' libtoolize: copying file build/ltsugar.m4' libtoolize: copying filebuild/ltversion.m4' libtoolize: copying file build/lt~obsolete.m4' libtoolize:./install-sh' is newer: use --force' to overwrite configure:19431: error: possibly undefined macro: AM_DEFAULT_VERBOSITY If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. autoreconf: /usr/bin/autoconf failed with exit status: 1 configure:19431: error: possibly undefined macro: AM_DEFAULT_VERBOSITY If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation.

aminrastgoo commented 8 years ago

Some notification: when i enter autoconf command manually:

configure:19431: error: possibly undefined macro: AM_DEFAULT_VERBOSITY
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.

if I enter aclocal manually then I enter autoconf it has no error! if I use build build.sh I have errors again.

aminrastgoo commented 8 years ago

I tried running this commnad sequence:

aclocal
autoconf
sh build.sh
./configure
make

first autoconf which I run manually make all needed files including stack.hh and y.tab.h but still it doesn't make seclang-parser.hh How can i manually create that file? or is it downloadable?

zimmerle commented 8 years ago

There are several recipes for the compilation here: https://github.com/SpiderLabs/ModSecurity/wiki/Compilation-recipes

It seems like there is something wrong about your environment, the config.log will be good to help you on the debug process (please use gits to share it). Some about my environment:

bison --version

bison (GNU Bison) 3.0.4
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

flex --version

flex 2.6.0

autoconf --version

autoconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.

automake --version

automake (GNU automake) 1.15
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Tom Tromey <tromey@redhat.com>
       and Alexandre Duret-Lutz <adl@gnu.org>.

make --version

GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
aminrastgoo commented 8 years ago

I upgraded every thing in my build machine. When I upgraded autoconf/automake version using this ppa: https://launchpad.net/~ondrej/+archive/ubuntu/autotools sh build.sh error resolved but still seclang-parser.hh is not generated.

my system config: lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:   precise

bison --version

bison (GNU Bison) 3.0.4
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

flex --version flex 2.6.0 autoconf --version

autoconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.

automake --version

automake (GNU automake) 1.15
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Tom Tromey <tromey@redhat.com>
       and Alexandre Duret-Lutz <adl@gnu.org>.

make --version

GNU Make 4.2
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

@zimmerle this is my config.log which contains error : config.log.txt I should update any other package?

aminrastgoo commented 8 years ago

After upgrading gcc and g++ to version 4.8 and upgrading libpcre3-dev from this ppa: ppa:ondrej/mariadb-10.0 I passed those errors. there were some error linking in test directory: /usr/bin/ld: ../src/.libs/libmodsecurity.a(libmodsecurity_la-utils.o): undefined reference to symbol 'clock_gettime@@GLIBC_2.2.5' googling it was said to add -lrt to gcc options which was already present! removing that option fixed issue.