Re: [gtk-osx-users] Configuring itstool: python module libxml2... not found - again :-(





On Jan 21, 2020, at 11:50 AM, Pascal <p p14 orange fr> wrote:


Le 21 janv. 2020 à 01:59, John Ralls <jralls ceridwen us> a écrit :



On Jan 20, 2020, at 1:18 PM, Pascal <p p14 orange fr> wrote:

Hello,

I fall into a recurrent issue which keeps me puzzled.
My configuration macOS 10.15 / Xcode 11.3 with a fresh GTK-OSX install :
$ sh gtk-osx-setup.sh # Installing CPython 3.6.10 
$ jhbuild bootstrap-gtk-osx
$ jhbuild build python
$ jhbuild build meta-gtk-osx-bootstrap
...
*** Configuring libxml2 *** [7/11]
/opt/2020a/src-2020/libxml2-2.9.8/configure --prefix /opt/2020a/xnadalib-2020 --libdir="$JHBUILD_LIBDIR" 
--with-python  --with-python-install-dir=/opt/2020a/xnadalib-2020/lib/python3.6/site-packages 
...
*** Configuring itstool *** [9/11]
/opt/2020a/src-2020/itstool-2.0.6/configure --prefix /opt/2020a/xnadalib-2020   
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /opt/2020a/src-2020/itstool-2.0.6/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for a Python interpreter with version >= 2.6... python3
checking for python3... /opt/2020a/src-2020/.new_local/share/venv/etc-teWAGlKT/bin/python3
checking for python3 version... 3.6
checking for python3 platform... darwin
checking for python3 script directory... ${prefix}/lib/python3.6/site-packages
checking for python3 extension module directory... ${exec_prefix}/lib/python3.6/site-packages
checking for python module libxml2... not found
configure: error: Python module libxml2 is needed to run this package
*** Error during phase configure of itstool: ########## Error running 
/opt/2020a/src-2020/itstool-2.0.6/configure --prefix /opt/2020a/xnadalib-2020    *** [9/11]

My previous builds were ok on macOS 10.13:
*** Configuring libxml2 *** [10/13]
/usr/local/src-2019/libxml2-2.9.8/configure --prefix /usr/local/xnadalib-2019 --libdir="$JHBUILD_LIBDIR" 
--with-python  
...
*** Configuring itstool *** [11/13]
/usr/local/src-2019/itstool-2.0.6/configure --prefix /usr/local/xnadalib-2019   
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/src-2019/itstool-2.0.6/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for a Python interpreter with version >= 2.6... python
checking for python... /usr/local/xnadalib-2019/bin/python
checking for python version... 2.7
checking for python platform... darwin
checking for python script directory... ${prefix}/lib/python2.7/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.7/site-packages
checking for python module libxml2... found
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating itstool
config.status: creating itstool.1
config.status: creating its/Makefile
config.status: creating setup.py

It seems it concerns Python versions but how to make itstools to get the good one?

Pascal,

The code at the end of https://gitlab.gnome.org/GNOME/gtk-osx/blob/master/jhbuildrc-gtk-osx is supposed to 
get libxml2 to install to $PREFIX so that itstool's configure can find it, but I've had a lot of trouble 
getting it to work consistently. You can try fiddling with it.

Then there's the big hammer approach: Add python3 to your modules and when itstool complains drop to a 
shell, cd $PREFIX/bin; ln -s python3.6 python; ln -s python3.6-config python-config Then go back to the 
libxml2 build dir and rerun configure, make, and make install by hand. With all of that done you can quit 
the shell and rerun itstool's configure. It's a little tedious but it's known to work.

Hello John,

Here is the command I found to get it working after itstool complaining, I exit jhbuild and rerun just 
itstool with PYTHON set:

% PYTHON=/opt/bin/python jhbuild build itstool
Loading .env environment variables…
in jhbuildrc-custom
*** Checking out libxml2 *** [1/2]
*** Skipping libxml2 (package and dependencies not updated) *** [1/2]
*** Checking out itstool *** [2/2]
bunzip2 -dc "/Users/blady/Documents/Programmation/XNAdaLib/2020a/src-2020/pkgs/itstool-2.0.6.tar.bz2" | tar 
xf -
*** Applying patch https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/itstool-config-python.patch 
*** [2/2]
patch -p1 < 
"/Users/blady/Documents/Programmation/XNAdaLib/2020a/src-2020/cache/jhbuild/itstool-config-python.patch-"
patching file configure
*** Configuring itstool *** [2/2]
/Users/blady/Documents/Programmation/XNAdaLib/2020a/src-2020/itstool-2.0.6/configure --prefix /opt   
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... 
/Users/blady/Documents/Programmation/XNAdaLib/2020a/src-2020/itstool-2.0.6/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether /opt/bin/python version is >= 2.6... yes
checking for /opt/bin/python version... 2.7
checking for /opt/bin/python platform... darwin
checking for /opt/bin/python script directory... ${prefix}/lib/python2.7/site-packages
checking for /opt/bin/python extension module directory... ${exec_prefix}/lib/python2.7/site-packages
checking for python module libxml2... found
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating itstool
config.status: creating itstool.1
config.status: creating its/Makefile
config.status: creating setup.py
...
and then I rerun:
% jhbuild build meta-gtk-osx-bootstrap


By the way during my investigations, I got curiously libxml2 in python3.6 working with python2.7!

% jhbuild shell                       
Loading .env environment variables…
in jhbuildrc-custom
Prefix: /opt
Entered jhbuild shell, type 'exit' to return.
[JH]% which python
/opt/bin/python
[JH]% python --version
Python 2.7.16
[JH]% python
Python 2.7.16 (default, Jan 19 2020, 19:09:39) 
[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import libxml2
print libxml2
<module 'libxml2' from '/opt/lib/python3.6/site-packages/libxml2.py'>

I guess your workaround falls into the "as long as it works for you" category, it's certainly not something 
I'd recommend.

As for libxml2, if you tell everything to use /opt/bin/python and that's python2.7 then there's no python3 
involved. Try explicitly starting python3 and importing libxml2.

Regards,
John Ralls



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