Trouble setting up a development environment and running tests on NixOS

On NixOS, we are having issues running matplotlib’s tests, both during our packaging and distribution process, and also locally.

NixOS is a hard distribution to grasp - we have an idea of a purely functional package manager. All packages are installed at paths in the format /nix/store/<hash>-<pkgname>, and it is not recommended to install packages with dependencies, especially if they are compiled in static locations such as /usr/lib/ etc - these kind of FHS directories don’t even exist on NixOS.

This restriction makes packaging and installing software very safe, but it costs a bit of effort. An important thing to know is that binaries downloaded from the internet that are linked against shared libraries from standard FHS paths such as /usr/lib, cannot run natively on NixOS. This affects also shared objects download with pip install.

In general, with mesonpy based Python libraries, we are have an issue with our pytest infrastructure that affects matplotlib most severly. It causes us trouble to run python -m pytest and sometimes even pytest due to a circular import error.

Furthermore, I’m trying to contribute a patch to matplotlib, and I’m having trouble running pytest also locally. I have used Nix to get myself into an (essentiall equivalent to virtualenv) python wrapper that can import anything you need to for matplotlib, and the build succeeds with this command:

$ python -m pip install \
  --config-settings=setup-args="-Dsystem-freetype=true" \
  --config-settings=setup-args="-Dsystem-qhull=true" \
  --config-settings=builddir=build \
  --prefix out \
  --no-build-isolation \
  ".[dev]"

But, running python -c import matplotlib fails with:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/doron/repos/matplotlib/out/lib/python3.11/site-packages/matplotlib/__init__.py", line 159, in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
  File "/home/doron/repos/matplotlib/out/lib/python3.11/site-packages/matplotlib/rcsetup.py", line 28, in <module>
    from matplotlib.colors import Colormap, is_color_like
  File "/home/doron/repos/matplotlib/out/lib/python3.11/site-packages/matplotlib/colors.py", line 57, in <module>
    from matplotlib import _api, _cm, cbook, scale
  File "/home/doron/repos/matplotlib/out/lib/python3.11/site-packages/matplotlib/scale.py", line 22, in <module>
    from matplotlib.ticker import (
  File "/home/doron/repos/matplotlib/out/lib/python3.11/site-packages/matplotlib/ticker.py", line 144, in <module>
    from matplotlib import transforms as mtransforms
  File "/home/doron/repos/matplotlib/out/lib/python3.11/site-packages/matplotlib/transforms.py", line 49, in <module>
    from matplotlib._path import (
ImportError: /home/doron/repos/matplotlib/out/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so: undefined symbol: _ZN3agg10curve3_div4initEdddddd

And indeed that file has many more missing undefined symbols, according to ldd -r.

A very similar issue was discussed at #27266, but there the system was Mingw.

Any idea how to debug this?

Here is the compiling lines from the build log (with –verbose and –config-settings=compile-args=–verbose)

BTW, if I wish to use the --editable flag that is recommended by the docs, matplotlib is not importable at all, and I get the directory structure in $PWD/out as below (click to expand).
out
└── lib
    └── python3.11
        └── site-packages
            ├── matplotlib-3.10.0.dev226+g7f6af99e7e.d19800101.dist-info
            │   ├── direct_url.json
            │   ├── INSTALLER
            │   ├── LICENSE
            │   ├── METADATA
            │   ├── RECORD
            │   ├── REQUESTED
            │   └── WHEEL
            ├── _matplotlib_editable_loader.py
            ├── matplotlib-editable.pth
            └── __pycache__
                └── _matplotlib_editable_loader.cpython-311.pyc

6 directories, 10 files

In comparison, at Git tag v3.8.4 (the one currently distributed by NixOS), I don’t experience the undefined symbol error. I still experience a circular import issue with _c_internal_utils - similarly to what I experience when I’m using Nix to build the package.

Also, I just checked, and this undefined symbol also appears in the very isolated and sandboxed build environment when matplotlib is built by Nix. See also:

One last diagnostic information that may help debug this, is the output of ldd -r of thist _path shared object, on v3.8.4 (where matplotlib is functional on NixOS), and on v3.9.0:

v3.8.4 (34 in total)
	linux-vdso.so.1 (0x00007ffc92df9000)
	libstdc++.so.6 => /nix/store/xvzz97yk73hw03v5dhhz3j47ggwf1yq1-gcc-13.2.0-lib/lib/libstdc++.so.6 (0x00007f4432a00000)
	libm.so.6 => /nix/store/k7zgvzp2r31zkg9xqgjim7mbknryv6bs-glibc-2.39-52/lib/libm.so.6 (0x00007f443291d000)
	libgcc_s.so.1 => /nix/store/xvzz97yk73hw03v5dhhz3j47ggwf1yq1-gcc-13.2.0-lib/lib/libgcc_s.so.1 (0x00007f4432cda000)
	libc.so.6 => /nix/store/k7zgvzp2r31zkg9xqgjim7mbknryv6bs-glibc-2.39-52/lib/libc.so.6 (0x00007f4432730000)
	/nix/store/k7zgvzp2r31zkg9xqgjim7mbknryv6bs-glibc-2.39-52/lib64/ld-linux-x86-64.so.2 (0x00007f4432d27000)
undefined symbol: PyExc_ValueError	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _Py_TrueStruct	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyCapsule_Type	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _Py_NoneStruct	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyExc_MemoryError	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyExc_OverflowError	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyExc_RuntimeError	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyExc_TypeError	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _Py_FalseStruct	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyExc_ImportError	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_GetAttrString	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyMem_Free	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _PyArg_ParseTupleAndKeywords_SizeT	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyBytes_FromStringAndSize	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyErr_Format	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyFloat_AsDouble	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _Py_Dealloc	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _Py_BuildValue_SizeT	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyList_New	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyImport_ImportModule	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PySequence_Check	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyOS_snprintf	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyErr_SetString	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyCapsule_GetPointer	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PySequence_GetItem	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PySequence_Size	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyLong_FromLong	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_IsTrue	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _PyArg_ParseTuple_SizeT	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyModule_Create2	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyErr_Occurred	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyList_SetItem	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyOS_double_to_string	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyErr_Print	(/nix/store/02p23bjzm7h67b08b32gbk4206j7jxw6-python3.11-matplotlib-3.8.4/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
v3.9.0 (140 in total)
	linux-vdso.so.1 (0x00007ffcb338e000)
	libstdc++.so.6 => /nix/store/xvzz97yk73hw03v5dhhz3j47ggwf1yq1-gcc-13.2.0-lib/lib/libstdc++.so.6 (0x00007f44c5400000)
	libm.so.6 => /nix/store/k7zgvzp2r31zkg9xqgjim7mbknryv6bs-glibc-2.39-52/lib/libm.so.6 (0x00007f44c531d000)
	libgcc_s.so.1 => /nix/store/xvzz97yk73hw03v5dhhz3j47ggwf1yq1-gcc-13.2.0-lib/lib/libgcc_s.so.1 (0x00007f44c56bf000)
	libc.so.6 => /nix/store/k7zgvzp2r31zkg9xqgjim7mbknryv6bs-glibc-2.39-52/lib/libc.so.6 (0x00007f44c5130000)
	/nix/store/k7zgvzp2r31zkg9xqgjim7mbknryv6bs-glibc-2.39-52/lib64/ld-linux-x86-64.so.2 (0x00007f44c572d000)
undefined symbol: PyInstanceMethod_Type	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyExc_ValueError	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _Py_TrueStruct	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyExc_IndexError	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyCapsule_Type	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _Py_NoneStruct	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyExc_MemoryError	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyType_Type	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyByteArray_Type	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyCFunction_Type	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyExc_OverflowError	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyProperty_Type	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyExc_RuntimeError	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _Py_NotImplementedStruct	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyBaseObject_Type	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyExc_TypeError	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _Py_FalseStruct	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyDict_Type	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyFloat_Type	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyExc_SystemError	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyExc_ImportError	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyTuple_SetItem	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_Repr	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyLong_AsLong	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyLong_FromSsize_t	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyByteArray_Size	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg10curve3_div4initEdddddd	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg12vcgen_stroke10remove_allEv	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyErr_NormalizeException	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg12vcgen_strokeC1Ev	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyInstanceMethod_New	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyEval_AcquireThread	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_Str	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyThreadState_DeleteCurrent	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyGILState_GetThisThreadState	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_GetAttrString	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyMem_Free	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyErr_Restore	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyType_IsSubtype	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyModule_AddObject	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyCapsule_SetPointer	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyTuple_New	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_IsInstance	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg13vcgen_contour10remove_allEv	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyEval_RestoreThread	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyException_SetTraceback	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyNumber_Float	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyBytes_FromStringAndSize	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg12vcgen_stroke6vertexEPdS1_	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyDict_Next	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyList_Size	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyTuple_Size	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyNumber_Long	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyErr_Format	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_CallObject	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyFloat_FromDouble	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg10curve3_inc4initEdddddd	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyFloat_AsDouble	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _Py_Dealloc	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg13vcgen_contour6rewindEj	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyByteArray_AsString	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg12vcgen_stroke6rewindEj	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg17vpgen_segmentator7line_toEdd	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyList_New	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyImport_ImportModule	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyNumber_Check	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _PyObject_GetDictPtr	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyUnicode_FromString	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyIndex_Check	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: Py_GetVersion	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyCapsule_SetContext	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyFrame_GetLineNumber	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyThread_tss_get	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyBytes_Size	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PySequence_Check	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyException_SetContext	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyErr_Clear	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_HasAttrString	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg13vcgen_contourC1Ev	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyWeakref_NewRef	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyOS_snprintf	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyDict_New	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg17vpgen_segmentator6vertexEPdS1_	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyErr_SetString	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyCapsule_GetContext	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg13vcgen_contour6vertexEPdS1_	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg10curve4_inc4initEdddddddd	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyThreadState_Get	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_SetItem	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyCapsule_New	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyMem_Calloc	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg10curve3_inc6vertexEPdS1_	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_SetAttrString	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyGILState_Release	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyCapsule_GetPointer	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyThread_tss_alloc	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg12vcgen_stroke10add_vertexEddj	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyBytes_AsString	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyDict_GetItemWithError	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyThread_tss_set	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyType_Ready	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyEval_SaveThread	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PySequence_GetItem	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_ClearWeakRefs	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_GC_UnTrack	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PySequence_Size	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyEval_GetBuiltins	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyErr_WriteUnraisable	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_IsTrue	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyModule_Create2	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyThread_tss_create	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyFrame_GetBack	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg10curve4_inc6vertexEPdS1_	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyUnicode_AsEncodedString	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyErr_Occurred	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyDict_Copy	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyErr_Fetch	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyThreadState_New	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyList_SetItem	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg12trans_affine8multiplyERKS0_	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _PyThreadState_UncheckedGet	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _PyType_Lookup	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg13vcgen_contour10add_vertexEddj	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyObject_CallFunctionObjArgs	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyDict_Size	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyOS_double_to_string	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg17vpgen_segmentator7move_toEdd	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyThreadState_Clear	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyDict_DelItemString	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyUnicode_AsUTF8AndSize	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyGILState_Ensure	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyCMethod_New	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: _ZN3agg10curve4_div4initEdddddddd	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyErr_Print	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyCapsule_GetName	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyTuple_GetItem	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyFrame_GetCode	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyException_SetCause	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyUnicode_AsUTF8String	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)
undefined symbol: PyBytes_AsStringAndSize	(result/lib/python3.11/site-packages/matplotlib/_path.cpython-311-x86_64-linux-gnu.so)

So there are undefined symbols in both cases, but on v3.9.0 it is more severe.

The missing Py* symbols are all (I suspect) from libpython so at runtime they are always available. I suspect they appear missing here because ldd is not aware of that so.

We build libagg statically (see the output in build/extern/agg24-svn/libagg.a ) so I think the question we need to answer is why under nix are we trying to dynamically link it? My guess as that there is a complier / linker flag that nix changes the default of that we needs to be explicitly set to the default value.


That is the expected structure under an editable install. The contents of the .pth file are enough to point back to the source (and auto-compile extensions if needed on import). It is very possible that the code that drives the editable install makes some assumptions about the system that nix breaks. That should probably be reported upstream to meson-python.


I agree “missing symbol” is the same symptom, but it is very far from obvious to me that the underlying cause is related between two different systems.

1 Like

Thanks @tacaswell for the pointers. Indeed convinced now that the mentioned issue #27266 is not related. I managed to find the commands in the build log I linked earlier that use libagg.a, formatted one of them here for a bit:

g++ \
  -o src/_path.cpython-311-x86_64-linux-gnu.so \
  src/_path.cpython-311-x86_64-linux-gnu.so.p/py_converters.cpp.o \
  src/_path.cpython-311-x86_64-linux-gnu.so.p/py_converters_11.cpp.o \
  src/_path.cpython-311-x86_64-linux-gnu.so.p/_path_wrapper.cpp.o \
  -flto \
  -Wl,--as-needed \
  -Wl,--allow-shlib-undefined \
  -Wl,-O1 \
  -shared \
  -fPIC \
  extern/agg24-svn/libagg.a 

Do you find anything suspicious in it? I suspect -Wl,--allow-shlib-undefined.

As mentioned as elsewhere, I suspect the problem in the -flto