[MDEV-7934] libxml2 not supported by this version Created: 2015-04-08  Updated: 2016-09-29  Resolved: 2016-09-29

Status: Closed
Project: MariaDB Server
Component/s: Compiling, Storage Engine - Connect
Affects Version/s: 10.0.17
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Joao Ferreira Assignee: Vladislav Vaintroub
Resolution: Won't Fix Votes: 0
Labels: verified
Environment:

Windows Server 2008 64-bit, MariaDB 10.0.17 .ZIP (portable)


Sprint: 10.0.26

 Description   

After upgrading (past upgrades all no problem) from 10.0.15 to 10.0.17 several "CREATE table" with ENGINE=CONNECT table_type=XML fail.
This happens with XML files that have ":" in the attributes, like for example: <Test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></Test>
When trying to use option_list='xmlsup=LIBXML2' one gets SQL Error (1105): libxml2 not supported by this version.
If option_list='xmlsup=DOMDOC' then SQL Error (1296): Got error 174 'Loading of /test.xml failed' from CONNECT.
On version 10.0.15 was working OK without xmlsup option definition.
Now even copying over all the .exe, etc files to previous version (but maitaining the data) keeps the same problem.
Strangely all versions now report in the boot log: CONNECT: Version 1.03.0006 Jan 25 2015 07:43:28 while the MariaDB website says the latest version as of today is 1.03.0005 !
This blocked all my projects. Hope a good soul can check this issue.



 Comments   
Comment by Elena Stepanova [ 2015-04-08 ]

I am getting the same error with 10.0.15.
Do you still have it installed? Can you paste the exact CREATE TABLE... statement and the whole output from the client where it succeeds?
Did you also use portable ZIP for 10.0.15?

Comment by Joao Ferreira [ 2015-04-09 ]

To my own surprise (and still no explanation) after testing back and fourth 10.0.15, 16 and 17, now all of them are NOT working, both with .ZIP instalation (in 2 different machines, one Windows 7 Pro, another Server 2008R2) and through .msi instalation. I really have no clue why it was working smoothly on 10.0.15 but now doesn't, even on a clean instalation... Maybe cause the core system was being updated for a long time and earlier versions supported?
Testing on a clean database on "mysqld.exe --console" v10.0.15, after INSTALL SONAME 'ha_connect'; and testing against:

<?xml version="1.0" encoding="utf-8"?>
<xpto-interface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xpto.biz/xsd/response.xsd">
<hello>yes</hello>
<xpto-interface>

one issues the command:

DROP TABLE IF EXISTS `xml_test`;
CREATE TABLE `xml_test` (
`HelloWorld` VARCHAR(36) NOT NULL DEFAULT '' field_format='@'
)
ENGINE=CONNECT table_type=XML tabname='xpto-interface' file_name='test.xml' option_list='xmlsup=LIBXML2';

and gets

SQL Error (1105) : libxml2 not supported by this version

Tried all my tricks to install libxml2 in the machine to no avail. Always same information.
If change xmlsup=LIBXML2 to xmlsup=DOMDOC or nothing (as DOMDOC is default in Windows) I get:

SQL Error (1296): Got error 174 'Loading of test.xml failed' from CONNECT

So for the moment I'm stuck. If I have time I'll test old versions just to try to understand why I had it working OK on 10.0.15 before...

Comment by Elena Stepanova [ 2015-04-15 ]

Assigning to bertrandop who might have an idea what could have caused this magic change in behavior, and also confirm whether the "not supported" error is expected.

Comment by Olivier Bertrand [ 2015-04-16 ]

I am mostly working with locally compiled versions that are enabled for libxml2 because when I compile them libxml2 is already installed on the computer. Firstly the option CONNECT_WITH_LIBXML2 must be specified, then in the CMakelists.txt file it says:

OPTION(CONNECT_WITH_LIBXML2 "Compile CONNECT storage engine with LIBXML2 support" ON)
 
IF(CONNECT_WITH_LIBXML2)
  IF(WIN32)
    #
    # NOTE: when switching to static linking of libxml2
    # make sure to define LIBXML_STATIC.
    #
    # Adding some typical places to search in
    SET(PC_LIBXML_INCLUDE_DIRS
        C:/libxml2/include
        C:/libxml/include
        D:/libxml/include)
    SET(PC_LIBXML_LIBRARY_DIRS
        C:/libxml2/lib
        C:/libxml/lib
        D:/libxml/lib)
  ENDIF(WIN32)
  FIND_PACKAGE(LibXml2)
  IF (LIBXML2_FOUND)
    INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
    SET(XML_LIBRARY  ${LIBXML2_LIBRARIES})
    SET(CONNECT_SOURCES ${CONNECT_SOURCES} libdoc.cpp libdoc.h)
    add_definitions(-DLIBXML2_SUPPORT)
  ENDIF(LIBXML2_FOUND)
ENDIF(CONNECT_WITH_LIBXML2)

This means that libxml2 must be installed in one of the above directories. Otherwise, LIBXML2_SUPPORT is not defined and the server will not accept libxml2 tables whether or not it is installed after the compilation.

What happens with binary distributions is probably that they are generated on a machine with libxml2 not already installed.

Indeed, I tried a binary distribution I had downloaded in september 1994. It is MariaDB version 10.0.14 with CONNECT version 1.03.0003 and libxml2 is not supported with it.

However, on Windows, DOMDOC is normally always available. About the message 'Loading of test.xml failed' it is a normal message indicating something wrong with the file. Indeed, the last line of this file should be:

</xpto-interface>

And the message indicates a syntax error. For instance, I modified the file to be:

<?xml version="1.0" encoding="utf-8"?>
<xpto-interface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xpto.biz/xsd/response.xsd">
<hello HelloWorld="Hello World!">yes</hello>
</xpto-interface>

And got the expected answer:

MariaDB [test]> select * from xml_test;
+--------------+
| HelloWorld   |
+--------------+
| Hello World! |
+--------------+
1 row in set (0.27 sec)

This as well with the binary version and DOMDOC, or with the MariaDB 10.0.17 version using DOMDOC or libxml2.

Comment by Elena Stepanova [ 2015-04-16 ]

dbart,

Can we have libxml2 installed on the Windows build machine?

Thanks

Comment by Daniel Bartholomew [ 2015-06-16 ]

I've installed libxml2, iconv, and zlib on the win builder at C:\libxml2\

Under that dir are bin\, include\, and lib\ directories with the various files under them.

(iconv and zlib were listed as dependencies of libxml2 on https://www.zlatkovic.com/libxml.en.html so that's why I added them there)

Comment by Elena Stepanova [ 2015-06-17 ]

<�serg�>�� dbart: now connect engine doesn't link, it cannot find many (or all) xml* symbols

....

<serg> he created c:\libxml2 and c:\libxml2_win64
<serg> I've renamed the first one to c:\libxml2_win32
<serg> so neither is used currently

Comment by Elena Stepanova [ 2015-06-17 ]

Lawrin,
After 10.0.20 release, could you maybe give advice on how to handle it properly?

Comment by Lawrin Novitsky [ 2015-06-25 ]

I looked into both connect's CMakeList.txt and FindLibXml2.cmake - it will find libxml2 only in c:|d:/libxml or c:/libxml2
But we can hint cmake like
cmake -DCONNECT_WITH_LIBXML2:BOOL=TRUE -DPC_LIBXML_LIBDIR=c:/libxml2_win32/lib -DPC_LIBXML_INCLUDEDIR=c:/libxml2_win32/include .
the other way would be to add path to specific cmake (env)variables, or to PATH LIB/INCLUDE
btw the dll itself is in bin subdirectory, just in case you will need to test it after build.

Comment by Olivier Bertrand [ 2015-06-26 ]

Did someone succeeded to get a 64bit version of libxml2 on Windows?
Apparently a 32bit lib cannot be used by a 64bit version of MariaDB causing link edit errors.

I have downloaded the libxml2-2.9.2-win32-x86_64.7z from xmlsoft.org/sources/win32/64bits/ and expanded it in c:\libxml2 but unsuccessfully. Firstly because the directory layout is different (it makes a subdirectory libxml2-2.9.2-win32-x86_64 in c:/libxl2) but this can be manually corrected. Secondly because the lib subdirectory does not contain the required libxml2.lib but libxml2.a as if it were containing a Linux version .

Comment by Lawrin Novitsky [ 2015-06-26 ]

I can confirm that. the dll can be find in the bin subdir as well, though it is named libxm2-2.dll for unknown reason. Can be renamed, of course. But where is no import library for dll in the lib. There is libxml2.dll.a - there is such file in 32bit distribution, I guess that is strangely named static library

Comment by Elena Stepanova [ 2015-10-20 ]

ATTN wlad

Comment by Vladislav Vaintroub [ 2016-06-21 ]

Unless there is a better use of libxml2 on Windows than loading invalid documents, I'd rather not to support it on Windows at all. It is pain to compile ourselves, it is a considerable number of dependencies (zlib, iconv), and the functionality to load invalid documents is questionable, it is actually a libxml2 bug.

I think, msxml6 should be good enough.

Joao, any comments?

Comment by Vladislav Vaintroub [ 2016-09-28 ]

So, was there a bug or not? Olivier indicates there was no bug, and he can use msxml6 to load the document in question.

If there is no bug and msxml6 which is used by connect, works fne, then I'll be closing it, unless jgfs loudly protests. getting libxml2 to build and distribute on both Win32 and Win64 is not trivial, and there must be a very good reason for us to do that

Comment by Joao Ferreira [ 2016-09-29 ]

I won't loudly protest. Have updated version and worked around the issue, so by now have no idea if it still persists, so no loud protests.
Thanks for all the effort.

Generated at Thu Feb 08 07:23:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.