Re: [gtk-osx-users] ITSTool building error with Python built before.





On Aug 31, 2022, at 3:18 AM, Pascal <p p14 orange fr> wrote:


Le 30 août 2022 à 18:18, john <jralls ceridwen us> a écrit :

On Aug 30, 2022, at 8:31 AM, Pascal <p p14 orange fr> wrote:

Le 16 août 2022 à 22:11, John Ralls <jralls ceridwen us> a écrit :

On Aug 16, 2022, at 1:03 PM, Pascal <p p14 orange fr> wrote:

Le 16 août 2022 à 02:09, john <jralls ceridwen us> a écrit :

On Aug 15, 2022, at 9:13 AM, Pascal <p p14 orange fr> wrote:

Hello,

I've made a fresh gtk-osx install with:
jhbuild bootstrap-gtk-osx
jhbuild build pygments
jhbuild build meta-gtk-osx-bootstrap

I've got this error:

*** Configuring libxml2 *** [5/9]
...
/Users/me/2022a/src-2022/libxml2-2.9.12/configure --prefix /Users/me/2022a/xnadalib-2022 --libdir="$JHBUILD_LIBDIR" --with-python  --with-python-install-dir=/Users/me/2022a/xnadalib-2022/lib/python3.10/site-packages
...
*** Configuring itstool *** [7/9]
...
checking whether /Users/me/2022a/src-2022/.new_local/share/virtualenvs/etc-Mg3srn31/bin/python3 version is >= 2.6... yes
...
checking for python module libxml2... /Users/me/2022a/src-2022/itstool-2.0.6/configure: line 2604: 59919 Done                    echo "import $py_module"
59920 Segmentation fault: 11  | $PYTHON - >&/dev/null
not found
configure: error: Python module libxml2 is needed to run this package
*** Error during phase configure of itstool: ########## Error running /Users/me/2022a/src-2022/itstool-2.0.6/configure --prefix /Users/me/2022a/xnadalib-2022 *** [7/9]

itstool configure is unfortunately using $PYTHON:
  if test -n "$PYTHON"; then
# If the user set $PYTHON, use it and don't search something else.

which is set to (in jhbuild env):
PYTHON=/Users/me/2022a/src-2022/.new_local/share/virtualenvs/etc-Mg3srn31/bin/python3

This PYTHON variable wasn't set in January'22 the last time I ran jhbuild.
Thus itstool was built ok.

What could be a workaround?


The most straightforward is to add
module_extra_env['itstool'] = ('PYTHON' : os.env.path(prefix, 'bin', 'python3'))
to your jhbuildrc-custom.

Thanks John for your quick answer,

My thinking was erroneous, sorry, the error is not that python doesn't find libxml2 like:
ModuleNotFoundError: No module named 'libxml2'

Whatever the PYTHON value is, as PYTHONPATH is set with ${prefix}/lib/python3.10/site-packages then libxml2 is successfully found but provoques a Segmentation fault.

It was ok last time with python 3.9:
bld% ./xnadalib-2021/bin/python            
Python 3.9.2 (default, Jan  9 2022, 11:56:26) 
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import libxml2


But not with python 3.10:
bld% ./xnadalib-2022/bin/python3
Python 3.10.2 (main, Aug 15 2022, 12:49:45) [Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import libxml2
zsh: segmentation fault  ./xnadalib-2022/bin/python3

Both built libxml2 have same version.

I don't find any relevant help on Google.
libxml2 is a too long story :-( sorry to bother you with that.

Not quite enough information there, but as a guess you didn't rebuild libxml2 with the new python so it's linked to libpython3.9.dylib instead of libpython3.10.dylib.

Hello John,

I ran again all the installation (2022b) from the beginning but I got the same error.
My configuration:
Prefix is /Users/me/2022b/xnadalib-2022
% uname -v           
Darwin Kernel Version 21.6.0: Wed Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64
% xcodebuild -version 
Xcode 13.4.1
Build version 13F100
% java -version      
java version "14" 2020-03-17
Java(TM) SE Runtime Environment (build 14+36-1461)
Java HotSpot(TM) 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)

The offending file si libxml2mod.so imported by libxml2.py:
% ls ./xnadalib-2022/lib/python3.10/site-packages
Pygments-2.9.0-py3.10.egg-info/ libxml2mod.a
README.txt                      libxml2mod.so*
__pycache__/                    pkg_resources/
_distutils_hack/                pygments/
distutils-precedence.pth        setuptools/
drv_libxml2.py                  setuptools-58.1.0.dist-info/
libxml2.py

% ./xnadalib-2022/bin/python3
Python 3.10.2 (main, Aug 30 2022, 11:48:18) [Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import libxml2mod
zsh: segmentation fault  ./xnadalib-2022/bin/python3

But this file is well bound against Python 3.10:
% otool -L ./xnadalib-2022/lib/python3.10/site-packages/libxml2mod.so
./xnadalib-2022/lib/python3.10/site-packages/libxml2mod.so:
/Users/me/2022b/xnadalib-2022/lib/libxml2.2.dylib (compatibility version 12.0.0, current version 12.12.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
/Users/me/2022b/xnadalib-2022/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.12)
/Users/me/2022b/xnadalib-2022/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.5.0)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/Users/me/2022b/xnadalib-2022/lib/libpython3.10.dylib (compatibility version 3.10.0, current version 3.10.0)
/Users/me/2022b/xnadalib-2022/lib/libintl.8.dylib (compatibility version 11.0.0, current version 11.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1858.112.0)

I provide these details in case that they might help.
Else what could help?

I sure hope that java doesn't have anything to do with anything!

There should be a crash report in Console with what segfaulted and a stack trace. What does that say?

Nothing relevant in the console but some lldb gives:

% lldb ./xnadalib-2022/bin/python3
(lldb) target create "./xnadalib-2022/bin/python3"
Current executable set to '/Users/me/2022b/xnadalib-2022/bin/python3' (x86_64).
(lldb) run
Process 12477 launched: '/Users/me/2022b/xnadalib-2022/bin/python3' (x86_64)
Python 3.10.2 (main, Aug 30 2022, 11:48:18) [Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import libxml2
libpython3.10.dylib was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 12477 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
   frame #0: 0x00000001039359ab libpython3.10.dylib`PyModule_Create2 [inlined] _PyInterpreterState_GET at pycore_pystate.h:117:20 [opt]
  114  #ifdef Py_DEBUG
  115      _Py_EnsureTstateNotNULL(tstate);
  116  #endif
-> 117      return tstate->interp;
  118  }
  119 
  120 
Target 0: (python3) stopped.
(lldb) frame variable 
(PyThreadState *) tstate = NULL
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
 * frame #0: 0x00000001039359ab libpython3.10.dylib`PyModule_Create2 [inlined] _PyInterpreterState_GET at pycore_pystate.h:117:20 [opt]
   frame #1: 0x000000010393599d libpython3.10.dylib`PyModule_Create2(module=0x000000010313c110, module_api_version=1013) at moduleobject.c:176:34 [opt]
   frame #2: 0x00000001031059d9 libxml2mod.so`PyInit_libxml2mod + 25
   frame #3: 0x00000001006d8b72 libpython3.10.dylib`_PyImport_LoadDynamicModuleWithSpec + 530

What would you advice to go further?

Pascal,

Not The Console, /Applications/Utilities/Console.app. Select Crash Reports from the sidebar. You'll find a list of programs that have crashed. Double click one and it will display a nice report with a stack trace.

But you got there with lldb, so that's OK.

You could rebuild python with --with-pydebug. That will enable that _Py_EnsureTstateNotNULL function call and presumably avoid the crash. It might also provide some info about why tstate was NULL and lead to either a solution or at least something that you can feed back to the libxml2 folks.

Regards,
John Ralls



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