Re: Libxml2 load error on Windows

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Talha Bin Rizwan <talha(dot)rizwan(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Libxml2 load error on Windows
Date: 2012-06-19 03:43:50
Message-ID: CA+Tgmoa6uWJ=Fi=ffeeRX3f6KJ2_xYxcqfdQ-6s96grjq+z6zA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 18, 2012 at 5:08 AM, Talha Bin Rizwan
<talha(dot)rizwan(at)gmail(dot)com> wrote:
> PostgreSQL 9.2 Windows build is having trouble with the XML support:
> http://postgresql.1045698.n5.nabble.com/9-2-beta1-libxml2-can-t-be-loaded-on-Windows-td5710672.html
>
> postgres=# SELECT xml '<foo>bar</foo>';
> ERROR:  could not set up XML error handler
> HINT: This probably indicates that the version of libxml2 being used is not
> compatible with the libxml2 header files that PostgreSQL was built with.
>
> HAVE_XMLSTRUCTUREDERRORCONTEXT should be defined if libxml2
> has xmlStructuredErrorContext (introduced after 2.7.3). It is being set for
> Linux in pg_config.h:
>
> /* Define to 1 if your libxml has xmlStructuredErrorContext. */
> #define HAVE_XMLSTRUCTUREDERRORCONTEXT 1
>
> For Windows build, we need to set it in "src/tools/msvc/Solution.pm".
>
> I guess there are two approaches to get the libxml2 version:
>
> 1) Parse "LIBXML_INST/include/libxml/xmlversion.h" to get the
> libxml2 version number, this header file is included in libxml2.
>
> 2) We may also get the version by running a command line utility
> i.e "LIBXML_INST/bin/xmllint --version". The xmllint program parses one
> or more XML files and it is also included in libxml2.
>
> I believe it is safe to assume that libxml2 include folder would contain
> xmlversion.h file containing the required version number. It might be a
> touch slower to parse the file line by line, but similar functionality has
> been used elsewhere as well. We obviously rely on xml include files (with
> xml enabled), so there is definitely a tighter dependency on include files
> than xmllint executable as it is not mandatory for build process.
>
> Therefore, I used first approach to get libxml2 version number and include
> the "#define HAVE_XMLSTRUCTUREDERRORCONTEXT" in pg_config.h if
> libxml2 version is greater than 20703 (which effectively is 2.7.3). Please
> find attached patch "libxml2_win_v1.patch".

Please add this patch here so that it doesn't get lost in the shuffle:

https://commitfest.postgresql.org/action/commitfest_view/open

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-06-19 04:01:17 Re: pgsql_fdw in contrib
Previous Message Steve Singer 2012-06-19 02:26:00 Re: [PATCH 10/16] Introduce the concept that wal has a 'origin' node