[xml-bindings] Problem with building python-extensions when libxml is located in a non-standard location




Hi,

  I just run into a similar problem as reported by Matt Patterson in
August 2004
(http://mail.gnome.org/archives/xml-bindings/2004-August/msg00000.html)

  In my case the issue has been with the includes located in a
nonstandard location, and the C Compiler not finding them,
and I guess there is simple fix for it.

  In my setup the includes are located in "/homes/clemens/opt/include"
and the libs are in "/homes/clemens/opt/lib". It seems the linker does
not have any problems finding the libs after editing "setup.py" and
fixing the "ROOT" variable (after fixing the next issue). However the
compiler does not find the include files:

clemens localhost$ /homes/clemens/opt/apps/python/2.3.5/bin/python
setup.py build
[...]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes -fPIC -D_REENTRANT=1 -DMERGED_MODULES=1
-I/homes/clemens/opt/include/libxml2 -I/usr/include
-I/homes/clemens/opt/include/libxslt
-I/homes/clemens/opt/apps/python/2.3.5/include/python2.3 -c libxslt.c -o
build/temp.linux-i686-2.3/libxslt.o
libxslt.c:19:28: libexslt/exslt.h: No such file or directory
In file included from libxslt.c:20:
libxslt_wrap.h:2:26: libxslt/xslt.h: No such file or directory
libxslt_wrap.h:3:35: libxslt/xsltInternals.h: No such file or directory
[...]

  I guess this happens because the includes already contain the
subdirectory  "libxslt", etc in the #include directory, while the
"-I/homes/clemens/opt/include/libxslt " appends the "libxslt" to the
include path, too.

  Thus the compiler expects them in
/homes/clemens/opt/include/libxslt/libxslt/xslt.h

  On the other hand the files for the libxml-bindings do expect the
"libxml2" to be passed in by a -I directive, and have no problem with
the nonstandard location.  Because I did not have the libxml2 installed
in the standard location, it did not get confused by the
"-I/usr/include" in the first place; however swaping the include
directive to get the non-standard place checked first seems to be a good
idea in case another version of libxml2 is installed in the standard
place.

  I have attached a patch against libxml2-python-2.6.15 - this one does
not append the "libxslt" to the "-I" switch.
Does it make any sense to have such a patch? Or would it be better to
fix the #includes in the C-files for the libxslt bindings to make them
behave the same as the C-files for the libxml2 bindings? (Well, I am
afraid this will break the "standard" way to build it.)


  I have read from the mailinglist archive that building the bindings
this way is deprecated anyway; however I am not sure how to build the
python-bindings from the libxml2-ball (especially if I want to add the
bindings to several local installed pythons; it seems I have to rerun
the full libxml-build for every local python? )

  Oh, and if this is the case and I should use the main "libxml2", maybe
a short note in the INSTALL would be nice that one has to rerun the
installation after having installed libxslt, because otherwise the
libxslt bindings will not be installed. (That is why I have tried the
libxml2-python tar.gz in the first place: I did not realize that the
xslt-bindings are also defined in the xml-package, and will not be build
in the first run).
  I can set up a patch to the INSTALL, if there is any interest in it ;-)

Cheers,
Clemens


--------------------------------------

Index: setup.py
===================================================================
RCS file: /homes/clemens/tmp/CVSROOT/libxml2-python-2.6.15/setup.py,v
retrieving revision 1.1.1.1
diff -C3 -r1.1.1.1 setup.py
*** setup.py    14 Feb 2005 00:27:47 -0000      1.1.1.1
--- setup.py    20 Feb 2005 15:04:14 -0000
***************
*** 56,65 ****
  # - iconv.h
  # - libxslt/xsltconfig.h
  includes_dir = [
  "/usr/include",
  "/usr/local/include",
  "/opt/include",
- os.path.join(ROOT,'include'),
  HOME
  ];

--- 56,65 ----
  # - iconv.h
  # - libxslt/xsltconfig.h
  includes_dir = [
+ os.path.join(ROOT,'include'),
  "/usr/include",
  "/usr/local/include",
  "/opt/include",
  HOME
  ];

***************
*** 153,159 ****
      xslt_includes=""
      for dir in includes_dir:
        if not missing(dir + "/libxslt/xsltconfig.h"):
!           xslt_includes=dir + "/libxslt"
            break;

      if xslt_includes == "":
--- 153,159 ----
      xslt_includes=""
      for dir in includes_dir:
        if not missing(dir + "/libxslt/xsltconfig.h"):
!           xslt_includes=dir
            break;

      if xslt_includes == "":





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