Squid 5.0.5 - compilation errors

Lubos Uhliarik <[email protected]>
Newsgroups gmane.comp.web.squid.devel
Message-ID <[email protected]>
Hi all,

I'm trying to build the latest squid 5.0.5 on the latest Fedora, but still without success. Initially, I had
compilation errors like this:

/bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE=\"/etc/squid/squid.conf\" -DDEFAULT_SQUID_DATA_DIR=\"/usr/share/squid\" -DDEFAULT_SQUID_CONFIG_DIR=\"/etc/squid\"   -I../.. -I../../include -I../../lib -I../../src -I../../include    -I/usr/include/libxml2  -Wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual -pipe -D_REENTRANT -I/usr/include/libxml2  -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c -o Parser.lo Parser.cc
libtool: compile:  g++ -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE=\"/etc/squid/squid.conf\" -DDEFAULT_SQUID_DATA_DIR=\"/usr/share/squid\" -DDEFAULT_SQUID_CONFIG_DIR=\"/etc/squid\" -I../.. -I../../include -I../../lib -I../../src -I../../include -I/usr/include/libxml2 -Wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual -pipe -D_REENTRANT -I/usr/include/libxml2 -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c Parser.cc  -fPIC -DPIC -o .libs/Parser.o
Parser.cc: In function 'void ProxyProtocol::One::ExtractPort(Parser::Tokenizer&, Ip::Address&, bool)':
Parser.cc:81:21: error: 'numeric_limits' is not a member of 'std'
   81 |     if (port > std::numeric_limits<uint16_t>::max())
      |                     ^~~~~~~~~~~~~~
Parser.cc:81:44: error: expected primary-expression before '>' token
   81 |     if (port > std::numeric_limits<uint16_t>::max())
      |                                            ^
Parser.cc:81:51: error: no matching function for call to 'max()'
   81 |     if (port > std::numeric_limits<uint16_t>::max())
      |                                                   ^
In file included from ../../compat/compat.h:87,
                 from ../../include/squid.h:37,
                 from Parser.cc:9:
../../compat/compat_shared.h:142:1: note: candidate: 'template<class A> const A& max(const A&, const A&)'
  142 | max(A const & lhs, A const & rhs)
      | ^~~
../../compat/compat_shared.h:142:1: note:   template argument deduction/substitution failed:
Parser.cc:81:51: note:   candidate expects 2 arguments, 0 provided
   81 |     if (port > std::numeric_limits<uint16_t>::max())
      |                                                   ^
make[3]: *** [Makefile:836: Parser.lo] Error 1
make[3]: Leaving directory '/builddir/build/BUILD/squid-5.0.5/src/proxyp'
make[2]: *** [Makefile:6851: all-recursive] Error 1
make[2]: Leaving directory '/builddir/build/BUILD/squid-5.0.5/src'
make[1]: *** [Makefile:5840: all] Error 2
make[1]: Leaving directory '/builddir/build/BUILD/squid-5.0.5/src'
make: *** [Makefile:593: all-recursive] Error 1


So I created patch which includes needed header files. 
Patch (I can fill PR, if needed):

diff --git a/src/proxyp/Parser.cc b/src/proxyp/Parser.cc
index c9ef588..3a25d44 100644
--- a/src/proxyp/Parser.cc
+++ b/src/proxyp/Parser.cc
@@ -15,6 +15,7 @@
 #include "sbuf/Stream.h"
.
 #include <algorithm>
+#include <limits>
.
 #if HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
diff --git a/src/security/ServerOptions.cc b/src/security/ServerOptions.cc
index d655665..7072874 100644
--- a/src/security/ServerOptions.cc
+++ b/src/security/ServerOptions.cc
@@ -18,6 +18,7 @@
 #if USE_OPENSSL
 #include "compat/openssl.h"
 #include "ssl/support.h"
+#include <limits>
.
 #if HAVE_OPENSSL_ERR_H
 #include <openssl/err.h>


After applying patch, errors with unknown Squid fails with the following compilation error (build log snippet):

g++ -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE=\"/etc/squid/squid.conf\" -DDEFAULT_SQUID_DATA_DIR=\"/usr/share/squid\" -DDEFAULT_SQUID_CONFIG_DIR=\"/etc/squid\"   -I../.. -I../../include -I../../lib -I../../src -I../../include    -I/usr/include/libxml2  -Wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual -pipe -D_REENTRANT -I/usr/include/libxml2  -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c -o time.o time.cc
g++ -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE=\"/etc/squid/squid.conf\" -DDEFAULT_SQUID_DATA_DIR=\"/usr/share/squid\" -DDEFAULT_SQUID_CONFIG_DIR=\"/etc/squid\"   -I../.. -I../../include -I../../lib -I../../src -I../../include    -I/usr/include/libxml2  -Wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual -pipe -D_REENTRANT -I/usr/include/libxml2  -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c -o Transport.o Transport.cc
cp ../../src/tests/stub_debug.cc tests/stub_debug.cc
cp: cannot create regular file 'tests/stub_debug.cc': No such file or directory
make[3]: *** [Makefile:1519: tests/stub_debug.cc] Error 1
make[3]: Leaving directory '/builddir/build/BUILD/squid-5.0.5/tools/squidclient'
make[2]: *** [Makefile:1050: all-recursive] Error 1
make[2]: Leaving directory '/builddir/build/BUILD/squid-5.0.5/tools/squidclient'
make[1]: *** [Makefile:1192: all-recursive] Error 1
make[1]: Leaving directory '/builddir/build/BUILD/squid-5.0.5/tools'
make: *** [Makefile:593: all-recursive] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.p7mzKk (%build)

Do you have any idea, what can cause this issue? File src/tests/stub_debug.cc is present in src tarball. 

Best,

Lubos 

_______________________________________________
squid-dev mailing list
[email protected]
http://lists.squid-cache.org/listinfo/squid-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.