Bug 54301 - libxml2 dir structure breaks dependencies in other programs
libxml2 dir structure breaks dependencies in other programs
Status: CLOSED RAWHIDE
Product: Red Hat Raw Hide
Classification: Retired
Component: php (Show other bugs)
1.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Copeland
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-10-03 17:35 EDT by ctolley
Modified: 2008-05-01 11:38 EDT (History)
0 users

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


Attachments (Terms of Use)

  None (edit)
Description ctolley 2001-10-03 17:35:11 EDT
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 ****
[snip]
#include <libxml/tree.h>
#include <libxml/valid.h>
#include <libxml/xmlIO.h>
#include <libxml/entities.h>
[/snip]
*** 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_LIBDIR='-L${libdir}'
-XML_INCLUDEDIR='-I${includedir}/libxml2/libxml -I${includedir}/libxml2'
+XML_INCLUDEDIR='-I${includedir}/libxml -I${includedir}'
 
 XML_CFLAGS=""
 RDL_LIBS=""

**** 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 @@
                catalog.h
 
 install-exec-hook:
-       $(mkinstalldirs) $(DESTDIR)$(xmlincdir)/libxml2 $(DESTDIR)
$(xmlincdir)/libxml2/libxml
+       $(mkinstalldirs) $(DESTDIR)$(xmlincdir) $(DESTDIR)
$(xmlincdir)/libxml
 
 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 @@
 Z_CFLAGS = @Z_CFLAGS@
 Z_LIBS = @Z_LIBS@
 
-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 @@
 
 
 install-exec-hook:
-       $(mkinstalldirs) $(DESTDIR)$(xmlincdir)/libxml2 $(DESTDIR)
$(xmlincdir)/libxml2/libxml
+       $(mkinstalldirs) $(DESTDIR)$(xmlincdir)/libxml2 $(DESTDIR)
$(xmlincdir)/libxml
 
 # 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 03:21:09 EDT
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.

Daniel
Comment 2 ctolley 2001-10-04 10:58:17 EDT
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 13:46:25 EDT
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.

Daniel
Comment 4 ctolley 2001-10-04 15:50:16 EDT
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 12:02:31 EDT
In PHP4.1.0RC1 this problem is correct
Comment 6 Peter Bowen 2002-04-15 21:56:11 EDT
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.