Re: [xml] If libxml2 headers refer to libxml/*.h, why is it installed into libxml2/libxml?



On Tue, Feb 11, 2020 at 9:57 PM Jefferson Carpenter <jefferson aoeu2code com> wrote:
This is after running

    ./configure --prefix="$HOME/local" --with-python-install-dir="$HOME/local"
    make
    make install

and compiling my program with

    -I"$HOME/local/include"

No other libraries that I use ask me to add additional include directories to my compiler search paths (including boost, libxslt, postgresql, openssl).


It's far simpler.  You just didn't configured libxml2 properly in your configure.ac
Add something like that there:
PKG_CHECK_MODULES(XML2, [libxml-2.0 >= 2.8.0])
and then in your Makefile.am
AM_CPPFLAGS = $(XML2_CFLAGS)

Some historical context:
Many long running projects behave like that w.r.t. headers.  It allows to have two (or more) major, incompatible versions installed in parallel.  Before libxml2 there was just libxml/gnome-xml.  And there was real need to have they running in parallel.  Similarly behaves GLib (glib-2.0), for example.  And because of just the same reason.


On Wed, Feb 12, 2020 at 7:32 PM Jefferson Carpenter <jefferson aoeu2code com> wrote:
It wouldn't break the majority of software projects to change the libxml2 headers to include each other by the path `libxml2/libxml` instead of just by `libxml`.  Most configurations will have `/include` in the header search directories prior to `include/libxml2` which would have been added to use/switch to libxml2.

Jefferson


---- On Tue, 11 Feb 2020 21:25:58 +0000 Csaba Raduly <rcsaba gmail com> wrote ----

You have to use -I $HOME/local/include/libxml2. On Linux systems and Cygwin, the system's built-in libxml2 places its headers in /usr/include/libxml2/libxml and you have to use -I /usr/include/libxml2

libxml2 is weird like that :) . You just have to live with it.

(Perhaps libxml2 is set up like this to be source-compatible with libxml1, so programs which e.g. #include <libxml/SAX.h> can be compiled without modifying the source, just by adding an extra compiler switch. But I'm just speculating.)

Csaba

On Tue, Feb 11, 2020 at 9:57 PM Jefferson Carpenter <jefferson aoeu2code com> wrote:
This is after running

    ./configure --prefix="$HOME/local" --with-python-install-dir="$HOME/local"
    make
    make install

and compiling my program with

    -I"$HOME/local/include"

No other libraries that I use ask me to add additional include directories to my compiler search paths (including boost, libxslt, postgresql, openssl).

--
You can get very substantial performance improvements
by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformant way
to get the wrong information: this is what you want. - Scott Meyers (C++TDaWYK)


_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
https://mail.gnome.org/mailman/listinfo/xml


--
Andrew W. Nosenko <andrew w nosenko gmail com>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]