libxml2-dev does not correctly update the Include path

Bug #293130 reported by francescomalandrino
4
Affects Status Importance Assigned to Milestone
libxml2 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: libxml2-dev

After installation of libxml2-dev package (version 2.6.31.dfsg-2ubuntu1.2, Ubuntu 8.04.1), a libxml directory is created inside /usr/include/libxml2. This prevents the code from compiling, as both the code examples and the headers themselves include <libxml/whatever.h> and not <libxml2/libxml/whatever.h>

Expected: one of:
a) libxml headers are placed in /usr/include/libxml instead of /usr/include/libxml2/libxml;
b) /usr/include/libxml2 is added to the default include path.

What happens:
None of the above, resulting in a number of "file included not found" compile-time errors.

Revision history for this message
Vassilis Pandis (pandisv) wrote :

libxml2 isn't, as far as I know, supposed to be accessed like that. What program is this?

If it's your code, you should compile it with
gcc `xml2-config --cflags` -o foo foo.c

xml2-config is a script that creates the correct cflags for you (in a similar way to how
pkg-config creates glib flags). If this is not your code, there's in all probability a ./configure
script of some sort that needs to be run. I would expect that even if you change your #include's
to <libxml2/libxml/foo.h>, it still won't work.

I may be wrong, but at least this is my understanding of the matter. I found some
information here : http://xmlsoft.org/FAQ.html#Compilatio

Revision history for this message
Vassilis Pandis (pandisv) wrote :

Actually, I think it's
gcc `xml2-config --cflags --libs` -o foo foo.c

Revision history for this message
Dimitrios Symeonidis (azimout) wrote :

Here's the output of "cat /usr/lib/pkgconfig/libxml-2.0.pc":
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
modules=1

Name: libXML
Version: 2.7.5
Description: libXML library version2.
Requires:
Libs: -L${libdir} -lxml2
Libs.private: -lz -lm
Cflags: -I${includedir}/libxml2

You're supposed to use it with:
AC_CHECK_LIB([xml2], [xmlParseFile])
PKG_CHECK_MODULES(XML2, "libxml-2.0")
in your configure.ac file...

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Per comment #1, should be using xml2-config.

Changed in libxml2 (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.