Bug 54301 - libxml2 dir structure breaks dependencies in other programs
Summary: libxml2 dir structure breaks dependencies in other programs
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: php   
(Show other bugs)
Version: 1.0
Hardware: i386 Linux
Target Milestone: ---
Assignee: Phil Copeland
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2001-10-03 21:35 UTC by ctolley
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-12-07 23:57:57 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description ctolley 2001-10-03 21:35:11 UTC
I already submitted this to the Gnome project, but was curious how you 
worked around this problem, as your RawHide SRPMS as they are don't work 
in this circumstance.

When trying to compile the latest version 4.0.6 of PHP using libxml2-
2.4.5, PHP fails to find the necessary .h files for inclusion because it 
is looking in /usr/include/libxml instead of /usr/include/libxml2/libxml.  
This can't be corrected easily on the PHP code side, as there are other 
dependencies that require leaving the include dir set to /usr/include 
(or /usr/local/include, depending on your pref).

I started to patch the PHP files to look in libxml2/libxml, but discovered 
that the XML parser that is installed by libxml2-2.4.5 also made the 
assumption of {includedir}/libxml:

**** Inside /usr/include/libxml2/libxml/parser.h ****
#include <libxml/tree.h>
#include <libxml/valid.h>
#include <libxml/xmlIO.h>
#include <libxml/entities.h>
*** End /usr/include/libxml2/libxml/parser.h ****

This broke the compile of PHP after I added the libxml2/libxml entries, 
because parser.h couldn't 
find /usr/include/libxml/tree.h, /usr/include/libxml/valid.h, etc.

My other alternative was to symlink /usr/include/lib2xml/libxml 
to /usr/include/libxml, which worked, but I ultimately dismissed due to 
the sloppy nature of the workaround.

I found 5 files that specified the libxml2/libxml directory structure, and 
created a patch for each them (cutting and pasting...wrapping may become 
damaged, send me an email and I'll attach them).  I created patches for 
the win32 files as well, though I'm not developing on that OS, so I didn't 
use them when I did my final compile:

**** Start configure patch ****

--- libxml2-2.4.5/configure.orig        Wed Oct  3 15:17:35 2001
+++ libxml2-2.4.5/configure     Wed Oct  3 15:18:09 2001
@@ -7087,7 +7087,7 @@
-XML_INCLUDEDIR='-I${includedir}/libxml2/libxml -I${includedir}/libxml2'
+XML_INCLUDEDIR='-I${includedir}/libxml -I${includedir}'

**** End configure patch ****

**** Start dsp/libxml2.def.src patch ****

--- libxml2-2.4.5/win32/dsp/libxml2.def.src.orig        Wed Oct  3 
15:17:35 2001
+++ libxml2-2.4.5/win32/dsp/libxml2.def.src     Wed Oct  3 15:21:52 2001
@@ -1,4 +1,4 @@
-/* win32/libxml2/libxml2.def.src
+/* win32/libxml2.def.src
    Pseudo-source used to create a .DEF file for proper dynamic 
    linkage under MSCC. 

**** End dsp/libxml2.def.src patch ****

**** Start libxml2/libxml2.def.src ****

--- libxml2-2.4.5/win32/libxml2/libxml2.def.src.orig    Wed Oct  3 
15:17:35 2001
+++ libxml2-2.4.5/win32/libxml2/libxml2.def.src Wed Oct  3 15:21:22 2001
@@ -1,4 +1,4 @@
-/* win32/libxml2/libxml2.def.src
+/* win32/libxml2.def.src
    Pseudo-source used to create a .DEF file for proper dynamic 
    linkage under MSCC. 

**** End libxml2/libxml2.def.src patch ****    

**** Start include/libxml/Makefile.am patch ****

--- libxml2-2.4.5/include/libxml/Makefile.am.orig       Wed Oct  3 
15:17:35 2001
+++ libxml2-2.4.5/include/libxml/Makefile.am    Wed Oct  3 15:20:51 2001
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
-xmlincdir = $(includedir)/libxml2/libxml
+xmlincdir = $(includedir)/libxml
 xmlinc_HEADERS = \
                SAX.h \
@@ -32,6 +32,6 @@
-       $(mkinstalldirs) $(DESTDIR)$(xmlincdir)/libxml2 $(DESTDIR)
+       $(mkinstalldirs) $(DESTDIR)$(xmlincdir) $(DESTDIR)
 EXTRA_DIST = xmlversion.h.in xmlwin32version.h.in

**** End include/libxml/Makefile.am patch ****

**** Start include/libxml/Makefile.in patch ****

--- libxml2-2.4.5/include/libxml/Makefile.in.orig       Wed Oct  3 
15:17:35 2001
+++ libxml2-2.4.5/include/libxml/Makefile.in    Wed Oct  3 15:19:53 2001
@@ -120,7 +120,7 @@
-xmlincdir = $(includedir)/libxml2/libxml
+xmlincdir = $(includedir)/libxml
 xmlinc_HEADERS =               SAX.h           entities.h              
encoding.h              parser.h                parserInternals.h          
xmlerror.h              HTMLparser.h            HTMLtree.h              
debugXML.h              tree.h          list.h             hash.h          
xpath.h                 xpathInternals.h                
xpointer.h              xinclude.h xmlIO.h                 
xmlmemory.h             nanohttp.h              nanoftp.h               
uri.h           valid.h xlink.h                 xmlversion.h            
xmlwin32version.h               DOCBparser.h            catalog.h
@@ -279,7 +279,7 @@
-       $(mkinstalldirs) $(DESTDIR)$(xmlincdir)/libxml2 $(DESTDIR)
+       $(mkinstalldirs) $(DESTDIR)$(xmlincdir)/libxml2 $(DESTDIR)
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

**** End include/libxml/Makefile.in patch ****

Comment 1 Daniel Veillard 2001-10-04 07:21:09 UTC
Unless I misunderstood the report, this is not a bug, this is a feature.
The PHP script MUST use xml2-config --cflags to get the preprocessor
flags for libxml2. The code MUST use #include <libxml/xxx.h> .
The includes are *on purpose* expected to be stored in
/usr/include/libxml2/libxml .
There should be NO /usr/include/libxml directory or symlink. The libxml
version 1 headers are expected to be stored in /usr/include/gnome-xml .
If the PHP configuration doesn't use xml2-config to get the include flags
it is broken. If it doesn't include libxml2 files using 
#include <libxml/xxx.h> 
it is broken too. Get them to fix it.


Comment 2 ctolley 2001-10-04 14:58:17 UTC
Ok, fine, but I'm using SRPMS directly from the RawHide distro off of RedHat's 
FTP site.  When I first started this, I was trying to use everthing as it was, 
but the PHP SRPM that is there won't rebuild as-is with libxml2 installed where 
it was, and I installed the libxml2-2.4.5 SRPM from RedHat's FTP site as well.

As you closed both the GNOME and RedHat's bug reports, please provide me with 
some advice on how RedHat got this to compile properly using the libxml2-2.4.5 
RPM.  As RedHat has RPMS available on their FTP site for PHP, RedHat obviously 
managed to get it to compile against the libxml2 libraries...I just don't know 
how it worked.  Am I missing something else?  It wasn't until I modified the 
libxml2 install paths that it would work.  I'm trying to stick as close to the 
original RedHat configuration as possible, but I'm either missing some 
dependency that isn't clearly indicated, or possibly the SRPM of PHP I have has 
a typo/bug in the spec file.

Any assistance would be greatly appreciated.

Comment 3 Daniel Veillard 2001-10-04 17:46:25 UTC
Okay, this then becomes a PHP bug. The PHP package should be updated to
use xml2-config to grab its libxml2 CFLAGS and LIBS.
I tried to look at php-4.0.6/configure.in but was unable to find out
where XML compile and link informations were set.


Comment 4 ctolley 2001-10-04 19:50:16 UTC
While I was awaiting your reply, I opened a bug against the PHP SRPM.  It is 
54351.  I don't know how you want to handle this current bug report.  I'm 
guessing you'll close it or link it to the other, but I'll let you decide on 
the best course.

I'm curious as to how the pre-made RPMs for PHP, that are available in the 
RawHide download directories, were created.  Was a work-around done to make the 
compile work?

Comment 5 Need Real Name 2001-10-24 16:02:31 UTC
In PHP4.1.0RC1 this problem is correct

Comment 6 Peter Bowen 2002-04-16 01:56:11 UTC
This should be fixed in php 4.1.2-5.  For the record you want ext/*/config.m4 --
configure is built from configure.in + the config.m4s

Note You need to log in before you can comment on or make changes to this bug.