Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-36844

CONNECT plugin fails to compile with libxml2 2.14

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 11.4.0
    • 11.4
    • OS: Arch Linux (Manjaro)
      Compiler: GCC 15.1.1
      Build system: CMake + Ninja
      libxml2 version: 2.14.3
      MariaDB source branch: 11.4

    Description

      While building Mariadb with libxml2 development headers installed, a name conflict occurs between Mariadb's internal ElementType enum and predefined enum values in libxml/tree.h from libxml2.

      This causes a build failure due to redefinition of constants like XML_DOCUMENT_TYPE_NODE, XML_DOCUMENT_FRAG_NODE, etc.

      A possible solution is to Guard the enum definition using a more specific macro check to prevent conflict if libxml2 is included. Happy to submit a patch if needed.

      ninja -j6                                   1 ✘  24m 21s  
      [3/666] Building CXX object storage/connect/CMakeFiles/connect.dir/libdoc.cpp.o
      FAILED: storage/connect/CMakeFiles/connect.dir/libdoc.cpp.o 
       
      /home/anirudh2/Development/mariadb/server/storage/connect/plgxml.h:16:32: error: 'XML_PI_NODE' conflicts with a previous declaration
         16 |      XML_PI_NODE            =  7,
            |                                ^
      /usr/include/libxml2/libxml/tree.h:181:5: note: previous declaration 'xmlElementType XML_PI_NODE'
        181 |     XML_PI_NODE=                7,
            |     ^~~~~~~~~~~
      /home/anirudh2/Development/mariadb/server/storage/connect/plgxml.h:17:32: error: 'XML_COMMENT_NODE' conflicts with a previous declaration
         17 |      XML_COMMENT_NODE       =  8,
            |                                ^
      /usr/include/libxml2/libxml/tree.h:182:5: note: previous declaration 'xmlElementType XML_COMMENT_NODE'
        182 |     XML_COMMENT_NODE=           8,
            |     ^~~~~~~~~~~~~~~~
      /home/anirudh2/Development/mariadb/server/storage/connect/plgxml.h:18:32: error: 'XML_DOCUMENT_NODE' conflicts with a previous declaration
         18 |      XML_DOCUMENT_NODE      =  9,
            |                                ^
      /usr/include/libxml2/libxml/tree.h:183:5: note: previous declaration 'xmlElementType XML_DOCUMENT_NODE'
        183 |     XML_DOCUMENT_NODE=          9,
            |     ^~~~~~~~~~~~~~~~~
      /home/anirudh2/Development/mariadb/server/storage/connect/plgxml.h:19:31: error: 'XML_DOCUMENT_TYPE_NODE' conflicts with a previous declaration
         19 |      XML_DOCUMENT_TYPE_NODE = 10,
            |                               ^~
      /usr/include/libxml2/libxml/tree.h:184:5: note: previous declaration 'xmlElementType XML_DOCUMENT_TYPE_NODE'
        184 |     XML_DOCUMENT_TYPE_NODE=     10, /* unused */
            |     ^~~~~~~~~~~~~~~~~~~~~~
      /home/anirudh2/Development/mariadb/server/storage/connect/plgxml.h:20:31: error: 'XML_DOCUMENT_FRAG_NODE' conflicts with a previous declaration
         20 |      XML_DOCUMENT_FRAG_NODE = 11,
            |                               ^~
      /usr/include/libxml2/libxml/tree.h:185:5: note: previous declaration 'xmlElementType XML_DOCUMENT_FRAG_NODE'
        185 |     XML_DOCUMENT_FRAG_NODE=     11,
            |     ^~~~~~~~~~~~~~~~~~~~~~
      /home/anirudh2/Development/mariadb/server/storage/connect/plgxml.h:21:31: error: 'XML_NOTATION_NODE' conflicts with a previous declaration
         21 |      XML_NOTATION_NODE      = 12,
            |                               ^~
      /usr/include/libxml2/libxml/tree.h:186:5: note: previous declaration 'xmlElementType XML_NOTATION_NODE'
        186 |     XML_NOTATION_NODE=          12, /* unused */
            |     ^~~~~~~~~~~~~~~~~
      /home/anirudh2/Development/mariadb/server/storage/connect/plgxml.h:22:31: error: 'XML_HTML_DOCUMENT_NODE' conflicts with a previous declaration
         22 |      XML_HTML_DOCUMENT_NODE = 13,
            |                               ^~
      /usr/include/libxml2/libxml/tree.h:187:5: note: previous declaration 'xmlElementType XML_HTML_DOCUMENT_NODE'
        187 |     XML_HTML_DOCUMENT_NODE=     13,
            |     ^~~~~~~~~~~~~~~~~~~~~~
      /home/anirudh2/Development/mariadb/server/storage/connect/plgxml.h:23:31: error: 'XML_DTD_NODE' conflicts with a previous declaration
         23 |      XML_DTD_NODE           = 14,
            |                               ^~
      /usr/include/libxml2/libxml/tree.h:188:5: note: previous declaration 'xmlElementType XML_DTD_NODE'
        188 |     XML_DTD_NODE=               14,
            |     ^~~~~~~~~~~~
      /home/anirudh2/Development/mariadb/server/storage/connect/plgxml.h:24:31: error: 'XML_ELEMENT_DECL' conflicts with a previous declaration
         24 |      XML_ELEMENT_DECL       = 15,
            |                               ^~
      [5/666] Building CXX object storage/connect/CMakeFiles/connect.dir/tabxml.cpp.o
      /home/anirudh2/Development/mariadb/server/storage/connect/tabxml.cpp: In member function 'bool XMLCOL::ParseXpath(PGLOBAL, bool)':
      /home/anirudh2/Development/mariadb/server/storage/connect/tabxml.cpp:1614:46: warning: '*this.XMLCOL::Long' may be used uninitialized [-Wmaybe-uninitialized]
       1614 |   Valbuf = (char*)PlugSubAlloc(g, NULL, n * (Long + 1));
            |                                              ^~~~
      [8/666] Building CXX object storage/connect/CMakeFiles/connect.dir/tabjdbc.cpp.o
      ninja: build stopped: subcommand failed.
      

      The error is continued for all the values

      Attachments

        Activity

          People

            cvicentiu Vicențiu Ciorbaru
            anirudh.sql Anirudh Lakhanpal
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.