[squid-users] squid 6.1 esi compile error, ubuntu 22.04
Alex Rousskov
rousskov at measurement-factory.com
Mon Aug 7 13:27:07 UTC 2023
On 8/7/23 04:00, Dmitry Melekhov wrote:
> Built using --disable-esi without problems.
First of all, if you do not need ESI, I recommend building with
--disable-esi to avoid accidental exposure to dangerous ESI bugs in
deployments that should not be using ESI features.
FWIW, in Project CI environment that also uses GCC on Ubuntu 22.04,
Squid v6.1 ESI build[1] succeeds, including the Libxml2Parser.cc
compilation step that fails in your environment.
[1] https://github.com/squid-cache/squid/actions/runs/5471818575
$ grep -A6 LIBEXPAT configure.log
checking for LIBEXPAT... yes
checking for expat.h... yes
checking for LIBXML2... yes
checking for libxml/parser.h... yes
checking for libxml/HTMLparser.h... yes
checking for libxml/HTMLtree.h... yes
configure: Enabling ESI processor: -lexpat -lm -lxml2
$ grep HAVE_LIBXML include/autoconf.h
#define HAVE_LIBXML2 1
#define HAVE_LIBXML_HTMLPARSER_H 1
#define HAVE_LIBXML_HTMLTREE_H 1
#define HAVE_LIBXML_PARSER_H 1
Can you share the corresponding ./configure output and
include/autoconf.h lines from your build environment?
> Could you tell me what can cause this?
I suspect your system lacks libxml/HTMLparser.h or Squid ./configure was
unable to find that header. I cannot find relevant libxml2
documentation, but if libxml promises to declare xmlParserCtxtPtr in
libxml/HTMLparser.h, then this is a Squid bug: When that bug (if it is a
Squid bug) is fixed, your build will fail at ./configure time instead of
"make" time.
Next steps:
* If your system lacks libxml/HTMLparser.h, then install the missing
libxml2 headers. Check the output sampled above to confirm that the
installation led to header discovery by ./configure.
* If your system has libxml/HTMLparser.h, set/adjust CPPFLAGS given to
./configure. Check the output sampled above to confirm that your
adjustments led to header discovery by ./configure.
HTH,
Alex.
> /bin/bash ../../libtool --tag=CXX --mode=compile g++ -std=c++17
> -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 -isystem /usr/include/mit-krb5
> -isystem /usr/include/mit-krb5 -I../../libltdl -Wall -Wextra
> -Wimplicit-fallthrough=5 -Wpointer-arith -Wwrite-strings -Wcomments
> -Wshadow -Wmissing-declarations -Woverloaded-virtual -Werror -pipe
> -D_REENTRANT -m64 -g -O2 -MT Libxml2Parser.lo -MD -MP -MF
> $depbase.Tpo -c -o Libxml2Parser.lo Libxml2Parser.cc &&\
> mv -f $depbase.Tpo $depbase.Plo
> libtool: compile: g++ -std=c++17 -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 -isystem /usr/include/mit-krb5
> -isystem /usr/include/mit-krb5 -I../../libltdl -Wall -Wextra
> -Wimplicit-fallthrough=5 -Wpointer-arith -Wwrite-strings -Wcomments
> -Wshadow -Wmissing-declarations -Woverloaded-virtual -Werror -pipe
> -D_REENTRANT -m64 -g -O2 -MT Libxml2Parser.lo -MD -MP -MF
> .deps/Libxml2Parser.Tpo -c Libxml2Parser.cc -fPIC -DPIC -o
> .libs/Libxml2Parser.o
> In file included from Libxml2Parser.cc:20:
> ../../src/esi/Libxml2Parser.h:66:13: error: 'xmlParserCtxtPtr' does not
> name a type
> 66 | mutable xmlParserCtxtPtr parser; /* our parser */
> | ^~~~~~~~~~~~~~~~
> Libxml2Parser.cc:45:8: error: 'htmlDocPtr' does not name a type
> 45 | static htmlDocPtr entity_doc = nullptr;
> | ^~~~~~~~~~
> Libxml2Parser.cc:51:43: error: 'xmlChar' does not name a type
> 51 | esi_startElementSAXFunc(void * ctx, const xmlChar * name, const
> xmlChar ** atts)
> | ^~~~~~~
> Libxml2Parser.cc:51:65: error: 'xmlChar' does not name a type
> 51 | esi_startElementSAXFunc(void * ctx, const xmlChar * name, const
> xmlChar ** atts)
> | ^~~~~~~
> Libxml2Parser.cc: In function 'void esi_startElementSAXFunc(void*, const
> int*, const int**)':
> Libxml2Parser.cc:54:5: error: 'xmlChar' was not declared in this scope
> 54 | xmlChar **tmp = (xmlChar **)atts;
> | ^~~~~~~
> Libxml2Parser.cc:54:15: error: 'tmp' was not declared in this scope; did
> you mean 'tm'?
> 54 | xmlChar **tmp = (xmlChar **)atts;
> | ^~~
> | tm
> Libxml2Parser.cc:54:32: error: expected primary-expression before ')' token
> 54 | xmlChar **tmp = (xmlChar **)atts;
> | ^
> Libxml2Parser.cc: At global scope:
> Libxml2Parser.cc:70:40: error: 'xmlChar' does not name a type
> 70 | esi_endElementSAXFunc(void *ctx, const xmlChar *name)
> | ^~~~~~~
> Libxml2Parser.cc:77:37: error: 'xmlChar' does not name a type
> 77 | esi_commentSAXFunc(void *ctx, const xmlChar *value)
> | ^~~~~~~
> Libxml2Parser.cc:84:40: error: 'xmlChar' does not name a type
> 84 | esi_charactersSAXFunc(void *ctx, const xmlChar *ch, int len)
> | ^~~~~~~
> Libxml2Parser.cc:90:8: error: 'xmlEntityPtr' does not name a type
> 90 | static xmlEntityPtr
> | ^~~~~~~~~~~~
> Libxml2Parser.cc: In constructor
> 'ESILibxml2Parser::ESILibxml2Parser(ESIParserClient*)':
> Libxml2Parser.cc:110:5: error: 'xmlSAXHandler' was not declared in this
> scope
> 110 | xmlSAXHandler sax;
> | ^~~~~~~~~~~~~
> Libxml2Parser.cc:111:5: error: 'xmlInitParser' was not declared in this
> scope
> 111 | xmlInitParser();
> | ^~~~~~~~~~~~~
> Libxml2Parser.cc:112:13: error: 'sax' was not declared in this scope;
> did you mean 'max'?
> 112 | memset(&sax, 0, sizeof(sax));
> | ^~~
> | max
> Libxml2Parser.cc:117:21: error: 'esi_getEntitySAXFunc' was not declared
> in this scope
> 117 | sax.getEntity = esi_getEntitySAXFunc;
> | ^~~~~~~~~~~~~~~~~~~~
> Libxml2Parser.cc:120:5: error: 'parser' was not declared in this scope;
> did you mean 'Parser'?
> 120 | parser = xmlCreatePushParserCtxt(&sax, static_cast<void
> *>(this), nullptr, 0, nullptr);
> | ^~~~~~
> | Parser
> Libxml2Parser.cc:120:14: error: 'xmlCreatePushParserCtxt' was not
> declared in this scope
> 120 | parser = xmlCreatePushParserCtxt(&sax, static_cast<void
> *>(this), nullptr, 0, nullptr);
> | ^~~~~~~~~~~~~~~~~~~~~~~
> Libxml2Parser.cc:122:9: error: 'entity_doc' was not declared in this scope
> 122 | if (entity_doc == nullptr)
> | ^~~~~~~~~~
> Libxml2Parser.cc:123:22: error: 'htmlNewDoc' was not declared in this scope
> 123 | entity_doc = htmlNewDoc(nullptr, nullptr);
> | ^~~~~~~~~~
> Libxml2Parser.cc: In destructor 'virtual
> ESILibxml2Parser::~ESILibxml2Parser()':
> Libxml2Parser.cc:128:23: error: 'parser' was not declared in this scope;
> did you mean 'Parser'?
> 128 | xmlFreeParserCtxt(parser);
> | ^~~~~~
> | Parser
> Libxml2Parser.cc:128:5: error: 'xmlFreeParserCtxt' was not declared in
> this scope
> 128 | xmlFreeParserCtxt(parser);
> | ^~~~~~~~~~~~~~~~~
> Libxml2Parser.cc: In member function 'virtual bool
> ESILibxml2Parser::parse(const char*, size_t, bool)':
> Libxml2Parser.cc:135:27: error: 'parser' was not declared in this scope;
> did you mean 'Parser'?
> 135 | return (xmlParseChunk(parser, dataToParse, lengthOfData,
> endOfStream) == 0);
> | ^~~~~~
> | Parser
> Libxml2Parser.cc:135:13: error: 'xmlParseChunk' was not declared in this
> scope
> 135 | return (xmlParseChunk(parser, dataToParse, lengthOfData,
> endOfStream) == 0);
> | ^~~~~~~~~~~~~
> Libxml2Parser.cc: In member function 'virtual long int
> ESILibxml2Parser::lineNumber() const':
> Libxml2Parser.cc:141:43: error: 'parser' was not declared in this scope;
> did you mean 'Parser'?
> 141 | return (long int)xmlSAX2GetLineNumber(parser);
> | ^~~~~~
> | Parser
> Libxml2Parser.cc:141:22: error: 'xmlSAX2GetLineNumber' was not declared
> in this scope
> 141 | return (long int)xmlSAX2GetLineNumber(parser);
> | ^~~~~~~~~~~~~~~~~~~~
> Libxml2Parser.cc: In member function 'virtual const char*
> ESILibxml2Parser::errorString() const':
> Libxml2Parser.cc:147:5: error: 'xmlErrorPtr' was not declared in this scope
> 147 | xmlErrorPtr error = xmlGetLastError();
> | ^~~~~~~~~~~
> Libxml2Parser.cc:149:9: error: 'error' was not declared in this scope;
> did you mean 'perror'?
> 149 | if (error == nullptr)
> | ^~~~~
> | perror
> Libxml2Parser.cc:152:12: error: 'error' was not declared in this scope;
> did you mean 'perror'?
> 152 | return error->message;
> | ^~~~~
> | perror
> make[3]: *** [Makefile:886: Libxml2Parser.lo] Error 1
> make[3]: Leaving directory '/var/local/files/squid-6.1/src/esi'
> make[2]: *** [Makefile:6005: all-recursive] Error 1
> make[2]: Leaving directory '/var/local/files/squid-6.1/src'
> make[1]: *** [Makefile:5005: all] Error 2
> make[1]: Leaving directory '/var/local/files/squid-6.1/src'
> make: *** [Makefile:600: all-recursive] Error 1
>
>
> And how to fix it?
>
> Thank you!
>
> _______________________________________________
> squid-users mailing list
> squid-users at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-users
More information about the squid-users
mailing list