Skip to content

libxml2 2.12.0 issue building from src #12702

Closed

Description

@nono303

Description

Hi,
Testing libxml2 2.12.0 released yesterday, I had issue during PHP compilation (php 8.2.12 on Windows vs17 x64) seems libxml2 headers had been moved / cleaned ….
I had to patch ext/libxml & ext/dom to have it building

diff --git a/ext/dom/document.c b/ext/dom/document.c
index 64da4f051b..3c71f03ba3 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -26,6 +26,7 @@
 #ifdef LIBXML_SCHEMAS_ENABLED
 #include <libxml/relaxng.h>
 #include <libxml/xmlschemas.h>
+#include <libxml/xmlsave.h>
 #endif
 
 typedef struct _idsIterator idsIterator;
diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h
index af1cc7d6ac..b484568bb1 100644
--- a/ext/libxml/php_libxml.h
+++ b/ext/libxml/php_libxml.h
@@ -35,6 +35,7 @@ extern zend_module_entry libxml_module_entry;
 
 #include "zend_smart_str.h"
 #include <libxml/tree.h>
+#include <libxml/parser.h>
 
 #define LIBXML_SAVE_NOEMPTYTAG 1<<2
 

I may let you qualify deeper this point.

PHP Version

PHP 8.2.12

Operating System

Win 10 x64

Activity

  1. ndossche commented on Nov 17, 2023

    @ndossche
    Member

    Yeah you're right, and there are a whole bunch of deprecation warnings too.
    Your patch is almost correct, the #include <libxml/xmlsave.h> line should be outside of the #ifdef LIBXML_SCHEMAS_ENABLED part though.

    If you want you can make a PR.
    If you don't want to do that I can apply the patch manually and add a Co-authored-by tag.
    Whatever your prefer 🙂

  2. nono303 commented on Nov 17, 2023

    @nono303
    ContributorAuthor

    Many Thx @nielsdos!
    U can apply the corrected patch manually ;)

    Fyi on Windows build, we'll also have to deal with the deprecation of the win32 Makefile.msvc in profit of CMake (this is a good thing!) but which didn't offer yet the availability to build the libxml static for dll archive (preferred for PHP as libxml2 shared is not supported cf. this nonworking patch https://gist.github.com/auroraeosrose/3452993)

  3. ndossche commented on Nov 17, 2023

    @ndossche
    Member

    Alright, I'll apply it manually, thanks!

    RE Windows build:
    I'm not sure actually why PHP wants a static build... I haven't looked into why that is yet, as it's been working fine since it was introduced in 2003. It might be possible to add an option to make it dynamically linkable.

  4. added 2 commits that reference this issue on Nov 17, 2023
    2b42b73
    6f215e0
  5. kloczek commented on Nov 21, 2023

    @kloczek

    It would be good to backport this change to 8.2 branch as well.

  6. ndossche commented on Nov 21, 2023

    @ndossche
    Member

    The change is already in the 8.2 branch and will be included in the next 8.2 release.

  7. kloczek commented on Nov 21, 2023

    @kloczek

    Up sorry .. just checked and indeed it is backported however because in each code change is updated NEWS file it is not possible cleanly apply exact commit on top of last release 😞

  8. added a commit that references this issue on Nov 23, 2023
    6a76e5d
  9. added a commit that references this issue on Jan 25, 2024
    8a95e61
  10. added a commit that references this issue on Aug 12, 2026
    8c60f3d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions