Skip to content

branch v3/dev/3.1-experimental not compile via make command #2530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vncloudsco opened this issue Mar 10, 2021 · 5 comments
Closed

branch v3/dev/3.1-experimental not compile via make command #2530

vncloudsco opened this issue Mar 10, 2021 · 5 comments
Assignees
Labels
3.x Related to ModSecurity version 3.x

Comments

@vncloudsco
Copy link

vncloudsco commented Mar 10, 2021

I'm having trouble building the source code please support me.
history my command

[root@Nax ModSecurity]# history 
   10  cd /opt/
   11  ls -la
   12  git clone -b v3/dev/3.1-experimental
   13  git clone -b v3/dev/3.1-experimental https://github.com/SpiderLabs/ModSecurity/
   14  cd ModSecurity/
   15  git log
   16  git b
   17  git branch
   18  yum groupinstall -y "Development Tools" httpd httpd-devel pcre pcre-devel libxml2 libxml2-devel curl curl-devel openssl openssl-devel
   19  git submodule init
   20  git submodule update
   21  ./build.sh
   22  ./configure
   23  yum install -y pcre pcre-devel
   24  ./configure
   25  make

My OS:

[root@Nax ModSecurity]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

gcc version:

[root@Nax ModSecurity]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 

run make command get error

make[2]: Entering directory `/opt/ModSecurity/src'
make[3]: Entering directory `/opt/ModSecurity/src'
/bin/sh ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.  -std=c++11 -I.. -g -I../others -fPIC -O3 -I../headers        -DPCRE_HAVE_JIT        -g -O2 -MT parser/libmodsecurity_la-seclang-parser.lo -MD -MP -MF parser/.deps/libmodsecurity_la-seclang-parser.Tpo -c -o parser/libmodsecurity_la-seclang-parser.lo `test -f 'parser/seclang-parser.cc' || echo './'`parser/seclang-parser.cc
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -std=c++11 -I.. -g -I../others -fPIC -O3 -I../headers -DPCRE_HAVE_JIT -g -O2 -MT parser/libmodsecurity_la-seclang-parser.lo -MD -MP -MF parser/.deps/libmodsecurity_la-seclang-parser.Tpo -c parser/seclang-parser.cc  -fPIC -DPIC -o parser/.libs/libmodsecurity_la-seclang-parser.o
In file included from ../headers/modsecurity/anchored_set_variable.h:31:0,
                 from ../headers/modsecurity/transaction.h:44,
                 from ../headers/modsecurity/modsecurity.h:188,
                 from ../src/rule_unconditional.h:28,
                 from seclang-parser.yy:28,
                 from parser/seclang-parser.cc:41:
../headers/modsecurity/string_view.hpp:443:38: error: redeclaration 'bpstd::basic_string_view<CharT, Traits>::npos' differs in 'constexpr'
     basic_string_view<CharT,Traits>::npos;
                                      ^
../headers/modsecurity/string_view.hpp:85:32: error: from previous declaration 'bpstd::basic_string_view<CharT, Traits>::npos'
     static constexpr size_type npos = size_type(-1);
                                ^
../headers/modsecurity/string_view.hpp:443:38: error: declaration of 'constexpr const size_type bpstd::basic_string_view<CharT, Traits>::npos' outside of class is not definition [-fpermissive]
     basic_string_view<CharT,Traits>::npos;
                                      ^
In file included from seclang-parser.yy:152:0,
                 from parser/seclang-parser.cc:41:
../src/operators/validate_dtd.h:39:41: error: expected ')' before 'dtd'
     explicit XmlDtdPtrManager(xmlDtdPtr dtd)
                                         ^
../src/operators/validate_dtd.h:49:5: error: 'xmlDtdPtr' does not name a type
     xmlDtdPtr get() const {return m_dtd;}
     ^
../src/operators/validate_dtd.h:51:5: error: 'xmlDtdPtr' does not name a type
     xmlDtdPtr m_dtd; // The resource being managed
     ^
make[3]: *** [parser/libmodsecurity_la-seclang-parser.lo] Error 1
make[3]: Leaving directory `/opt/ModSecurity/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/opt/ModSecurity/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/opt/ModSecurity/src'

make version

[root@Nax ModSecurity]# make --version 
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010  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.
@martinhsv
Copy link
Contributor

martinhsv commented Mar 10, 2021

Hi @vncloudsco ,

As I mentioned in that other posting, there is a known compiler bug that could cause an error like that:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58541

You have included your gcc version above (4.8.5). Although that version is not specifically listed in in that page's "Known to fail" (the listed versions are 4.9.3, 5.3.0, 6.1.0, 7.0), it seems to me reasonable likely that that is the problem that you are experiencing.

I would suggest upgrading to to a recent version of gcc and trying with that. (For example, I do not see this error with gcc v7.5.0)

@vncloudsco
Copy link
Author

@martinhsv thank you. I built it but i user a docker ubuntu 18.04 :( I was unable to use it through the normal way. Is there a way to get around this without I having to choose the make version?

@zimmerle zimmerle self-assigned this Mar 16, 2021
@zimmerle zimmerle added the 3.x Related to ModSecurity version 3.x label Mar 16, 2021
@zimmerle
Copy link
Contributor

@vncloudsco it is possible for you to use 20.04 LTS instead of 18.04?

@vncloudsco
Copy link
Author

@zimmerle
On ubuntu 20.04 I did not get an error, this only happens when I use centos.

@zimmerle
Copy link
Contributor

As @martinhsv mentioned there is this bug on the compiler that I believe cannot be overcoming without an upgrade. Have a look at the issue thread to see if there is a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Related to ModSecurity version 3.x
Projects
None yet
Development

No branches or pull requests

3 participants