Using nuitka compiler in my snap

I am packaging snap for an app, which use the nuitka compiler. So, I setup my snapcraft.yaml file for that app. But the nuitka compiler isn’t working as expected. Everytime I’m getting an error mentioned below.

snapcraft.yaml
name: monophony # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '1.2.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
  This is my-snap's description. You have a paragraph or two to tell the
  most important story about your snap. Keep it under 100 words though,
  we live in tweetspace and your description wants to look good in the snap
  store.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
compression: lzo

environment:
  # WORKAROUND: Add python modules in Snap to search path
  PYTHONPATH: ${SNAP}/lib/python3.10/site-packages:${SNAP}/usr/lib/python3/dist-packages

parts:
  nuitka:
    plugin: python
    source: https://github.com/Nuitka/Nuitka.git
    source-tag: 1.4.8
    source-type: git
    build-environment:
      # WORKAROUND: The python plugin is broken with gnome extension
      - PATH: ${CRAFT_PART_INSTALL}/bin:${PATH}
      - PYTHONPATH: ""
    stage:
      # WORKAROUND: Skip venv from python plugin
      - -bin/activate
      - -bin/activate.csh
      - -bin/activate.fish
      - -bin/Activate.ps1
      - -bin/python
      - -bin/python3
      - -bin/python3.10
      - -bin/pip
      - -bin/pip3
      - -bin/pip3.10
      - -pyvenv.cfg
    python-packages:
      - requests
      - PyGObject
      - ytmusicapi

  ffmpeg:
    after: [nuitka]
    # WORKAROUND:
    # Build from source because the ffmpeg package installs libraries as dependencies
    # that conflict with the Gnome extension
    plugin: autotools
    source: https://ffmpeg.org/releases/ffmpeg-5.1.2.tar.xz
    source-checksum: sha256/619e706d662c8420859832ddc259cd4d4096a48a2ce1eefd052db9e440eef3dc
    autotools-configure-parameters:
      # WORKAROUND: Install to /usr instead of /usr/local because it's not in search paths
      - --prefix=/usr
      - --disable-debug
      - --disable-doc
      - --disable-static
      - --enable-gpl
      - --enable-shared
      - --disable-ffplay
      - --disable-devices
      - --enable-gnutls
      - --enable-libmp3lame
      - --enable-libvorbis
    build-packages:
      - nasm
      - libgnutls28-dev
      - libmp3lame-dev
      - libvorbis-dev
    stage-packages:
      - libmp3lame0
    stage:
      - -usr/include

  monophony:
    # See 'snapcraft plugins'
    after:
      - ffmpeg
      - nuitka
    plugin: make
    source: https://gitlab.com/zehkira/monophony.git
    source-tag: v$SNAPCRAFT_PROJECT_VERSION
    source-subdir: source
    source-type: git
    build-packages:
      - libgstreamer1.0-dev
      - gstreamer1.0-libav
      - gstreamer1.0-plugins-good
    stage-packages:
      - gstreamer1.0-libav
      - gstreamer1.0-plugins-good
      - yt-dlp
    override-pull: |
      craftctl default
      sed 's|python3 -m nuitka bin/monophony.py --remove-output --clean-cache=all --follow-import-to=monophony -o /usr/bin/monophony|nuitka bin/monophony.py --remove-output --clean-cache=all --follow-import-to=monophony -o /usr/bin/monophony|' -i source/Makefile

apps:
  monophony:
    command: usr/bin/monophony
    desktop: usr/share/applications/io.gitlab.zehkira.Monophony.desktop
    extensions: [gnome]
    plugs:
      - home
    slots:
      - mpris

And the error I’m getting is


2023-02-23 13:11:21.877 :: 2023-02-23 07:40:58.466 :: + make -j16              
2023-02-23 13:11:21.877 :: 2023-02-23 07:40:58.473 :: mkdir -p /usr/bin/       
2023-02-23 13:11:21.877 :: 2023-02-23 07:40:58.476 :: python3 -m nuitka bin/monophony.py --remove-output --clean-cache=all --follow-import-to=monophony -o /usr/bin/monophony                                                                  
2023-02-23 13:11:21.877 :: 2023-02-23 07:40:58.645 :: /snap/gnome-42-2204-sdk/current/usr/bin/python3: No module named nuitka                                  
2023-02-23 13:11:21.877 :: 2023-02-23 07:40:58.652 :: make: *** [Makefile:11: install] Error 

Can anyone please help me?

I see you already tried the python plugin workaround…

@tigarmo @cmatsuoka Do you have any suggestions here?

Which step is that? build of the monophony part? Is it possible that the sed in override-pull is not doing what it should?

Yes

Actually by the override-pull I was trying to use the nuitka binary instead of the python3 -m, but both the cases I got ModuleNotFoundError

I see. I was able to get further on the build by doing two things:

  1. Remove the stage exclusions on the nuitka part, to keep the venv staged;
  2. Add this to the monophony part:
    build-environment:
      - PATH: ${CRAFT_STAGE}/bin:${PATH}

… so that the venv created by the nuitka part is found before the gnome-sdk python. After these changes, the build fails with linking errors like:

:: Nuitka-Scons:INFO: Scons: Inherited LDFLAGS='-L/root/parts/monophony/install/lib -L/root/parts/monophony/install/usr/lib -L/root/parts/monophony/install/usr/lib/x86_64-linux-gnu -L/root/stage/lib -L/root/stage/usr/lib -L/root/stage/usr/lib/x86_64-linux-gnu' variable.                                                                                                           
:: Nuitka-Scons:INFO: Backend linking program with 30 files (no progress information available).                                                                                            
:: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `xmlparse_ErrorColumnNumber_getter':            
:: (.text+0x1ad): undefined reference to `XML_GetCurrentColumnNumber' 

… does this help? Are these errors expected?

I also came up to this step, by manually installing nuitka in the override-pull step of monophony parts. These are errors aren’t expected, and the thing is I didn’t make this app, so, I don’t I don’t what ld environment or any other build envvironment is necessary for this.

These linking errors seem related to the whole nuitka + monophony setup, I’m not sure I can help much more. I did some experimenting with using --static-libpython=no on the python3 -m nuitka command line (inside the Makefile) and adding the libffi7 stage-package but the resulting binary segfaults, heh.

This is the problem I mentioned in my recent post about snaps are getting cornered.

The dev of Monophony is saying to make a issue in the nuitka github page. When the upstream dev himself not creating the package, creating a package for it is a big headache. Cause only he will understand what he needs.

Okay, I read the documentation of Nuitka. It says Nuitka uses Scons. Scons is a make alternative.

I would start by trying to build Monophony outside of a snap, to see if it works and which changes need to happen to have it build. Otherwise trying to reason about snapcraft’s build system with the problematic Python plugin + a custom Python compiler might be too frustrating.

When I installed the dependencies manually in a live usb, using the pip. It just compiled, and ran as expected. This package is also available as a flatpak and works just as expected. So, there must be something that’s preinstalled in the Ubuntu desktop, comes along with the org.gnome.sdk runtime in flatpak but is not in the gnome-sdk or gnome-42-2204. What can be it? Any guesses? The flatpak link of the app for any help(may be):

@tigarmo Finally, I got something. In the ~/parts/monophony/build directory I ran the

python3 -m nuitka bin/monophony.py --remove-output --clean-cache=all --follow-import-to=monophony -o parts/monophony/install/bin/monophony

command manually, and it worked. It just worked as expected. What is the problem then? Doing everything manually in the override-build part, also didn’t help.

Hey anyone please help about this

The reason for the original error is because the python3 call is finding the wrong python3 executable (the one from the gnome sdk, and not the one from the virtualenv that contains the nuitka package). What happens if you add this:

    build-environment:
      - PATH: ${CRAFT_STAGE}/bin:${PATH}

to the monophony part?

It is there. This is my updated snapcraft.yaml

snapcraft.yaml
name: monophony # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '1.2.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
  This is my-snap's description. You have a paragraph or two to tell the
  most important story about your snap. Keep it under 100 words though,
  we live in tweetspace and your description wants to look good in the snap
  store.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
compression: lzo

environment:
  # WORKAROUND: Add python modules in Snap to search path
  PYTHONPATH: ${SNAP}/lib/python3.10/site-packages:${SNAP}/usr/lib/python3/dist-packages

parts:
  nuitka:
    plugin: python
    source: https://github.com/Nuitka/Nuitka.git
    source-tag: 1.4.8
    source-type: git
    build-environment:
      # WORKAROUND: The python plugin is broken with gnome extension
      - PATH: ${CRAFT_PART_INSTALL}/bin:${PATH}
      - PYTHONPATH: ""
    python-packages:
      - requests
      - PyGObject
      - ordered-set
      - ytmusicapi
      - yt-dlp
      - lxml
      - MarkupSafe
      - appdirs
      - Jinja2

  ffmpeg:
    after: [nuitka]
    # WORKAROUND:
    # Build from source because the ffmpeg package installs libraries as dependencies
    # that conflict with the Gnome extension
    plugin: autotools
    source: https://ffmpeg.org/releases/ffmpeg-5.1.2.tar.xz
    source-checksum: sha256/619e706d662c8420859832ddc259cd4d4096a48a2ce1eefd052db9e440eef3dc
    autotools-configure-parameters:
      # WORKAROUND: Install to /usr instead of /usr/local because it's not in search paths
      - --prefix=/usr
      - --disable-debug
      - --disable-doc
      - --disable-static
      - --enable-gpl
      - --enable-shared
      - --disable-ffplay
      - --disable-devices
      - --enable-gnutls
      - --enable-libmp3lame
      - --enable-libvorbis
    build-packages:
      - nasm
      - libgnutls28-dev
      - libmp3lame-dev
      - libvorbis-dev
    stage-packages:
      - libmp3lame0
    stage:
      - -usr/include

  monophony:
    # See 'snapcraft plugins'
    after:
      - ffmpeg
      - nuitka
    plugin: make
    source: https://gitlab.com/zehkira/monophony.git
    source-tag: v$SNAPCRAFT_PROJECT_VERSION
    source-subdir: source
    source-type: git
    build-packages:
      - libgstreamer1.0-dev
      - gstreamer1.0-libav
      - gstreamer1.0-plugins-good
      - xml-core
      - libexpat1-dev
      - libexpat1
      - execstack
      - intltool
      - gettext
      - base-files
      - ccache
      - chrpath
      - clang
      - patchelf
      - scons
      - zlib1g-dev
      - binutils
      - binutils-common
      - binutils-x86-64-linux-gnu
      - build-essential
      - javascript-common
      - libalgorithm-diff-perl
      - libalgorithm-diff-xs-perl
      - libalgorithm-merge-perl
      - libasan8
      - libbinutils
      - libc-dev-bin
      - libc-devtools
      - libc6-dev
      - libcc1-0
      - libcrypt-dev
      - libctf-nobfd0
      - libctf0
      - liberror-perl
      - libgcc-12-dev
      - libitm1
      - libjs-jquery
      - libjs-sphinxdoc
      - libjs-underscore
      - liblsan0
      - libnsl-dev
      - libquadmath0
      - libstdc++-12-dev
      - libtirpc-dev
      - libtsan2
      - libubsan1
      - linux-libc-dev
      - lto-disabled-list
      - python3-distutils
      - rpcsvc-proto
    stage-packages:
      - gstreamer1.0-libav
      - gstreamer1.0-plugins-good
      - xml-core
      - libexpat1-dev
      - libexpat1
    build-environment:
      - PATH: ${CRAFT_STAGE}/bin:${PATH}
      - LDFLAGS: "-lexpat"

apps:
  monophony:
    command: usr/bin/monophony
    desktop: usr/share/applications/io.gitlab.zehkira.Monophony.desktop
    extensions: [gnome]
    plugs:
      - home
    slots:
      - mpris

Yet it’s not compiling.

What’s the new error?

The error is same. I have already used that, before making my last comment.

2023-03-02T15:02:10.5202805Z :: Nuitka-Options:INFO: Used command line options: bin/monophony.py --remove-output --clean-cache=all --follow-import-to=monophony -o /usr/bin/monophony
2023-03-02T15:02:10.5203457Z :: Nuitka:INFO: Starting Python compilation with Nuitka '1.4.8' on Python '3.10' commercial grade 'not installed'.
2023-03-02T15:02:10.5203855Z :: Nuitka:INFO: Completed Python level compilation and optimization.
2023-03-02T15:02:10.5204195Z :: Nuitka:INFO: Generating source code for C backend compiler.
2023-03-02T15:02:10.5204541Z :: Nuitka:INFO: Running data composer tool for optimal constant value handling.
2023-03-02T15:02:10.5204853Z :: Nuitka:INFO: Running C compilation via Scons.
2023-03-02T15:02:10.5205225Z :: Nuitka-Scons:INFO: Backend C compiler: gcc (gcc).
2023-03-02T15:02:10.5205945Z :: Nuitka-Scons:INFO: Scons: Inherited CPPFLAGS='-isystem /root/parts/monophony/install/usr/include -isystem /root/parts/monophony/install/usr/include/x86_64-linux-gnu -isystem /root/stage/include' variable.
2023-03-02T15:02:10.5206999Z :: Nuitka-Scons:INFO: Scons: Inherited CXXFLAGS='-isystem /root/parts/monophony/install/usr/include -isystem /root/parts/monophony/install/usr/include/x86_64-linux-gnu -isystem /root/stage/include' variable.
2023-03-02T15:02:10.5207586Z :: Nuitka-Scons:INFO: Scons: Inherited LDFLAGS='-lexpat' variable.
2023-03-02T15:02:10.5208088Z :: Nuitka-Scons:INFO: Backend linking program with 30 files (no progress information available).
2023-03-02T15:02:10.5208831Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `xmlparse_ErrorColumnNumber_getter':
2023-03-02T15:02:10.5209393Z :: (.text+0x1ad): undefined reference to `XML_GetCurrentColumnNumber'
2023-03-02T15:02:10.5210065Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `xmlparse_ErrorLineNumber_getter':
2023-03-02T15:02:10.5210522Z :: (.text+0x1cd): undefined reference to `XML_GetCurrentLineNumber'
2023-03-02T15:02:10.5211177Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `xmlparse_ErrorCode_getter':
2023-03-02T15:02:10.5211604Z :: (.text+0x1ed): undefined reference to `XML_GetErrorCode'
2023-03-02T15:02:10.5212235Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `pyexpat_ErrorString':
2023-03-02T15:02:10.5212659Z :: (.text+0x219): undefined reference to `XML_ErrorString'
2023-03-02T15:02:10.5213305Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `xmlparse_ErrorByteIndex_getter':
2023-03-02T15:02:10.5213750Z :: (.text+0x24d): undefined reference to `XML_GetCurrentByteIndex'
2023-03-02T15:02:10.5214431Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `pyexpat_xmlparser_SetParamEntityParsing':
2023-03-02T15:02:10.5214906Z :: (.text+0x283): undefined reference to `XML_SetParamEntityParsing'
2023-03-02T15:02:10.5215611Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `pyexpat_xmlparser_ExternalEntityParserCreate':
2023-03-02T15:02:10.5216101Z :: (.text+0x3e0): undefined reference to `XML_ExternalEntityParserCreate'
2023-03-02T15:02:10.5216613Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x438): undefined reference to `XML_SetUserData'
2023-03-02T15:02:10.5217254Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `add_error':
2023-03-02T15:02:10.5217658Z :: (.text+0x731): undefined reference to `XML_ErrorString'
2023-03-02T15:02:10.5218405Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `pyexpat_exec':
2023-03-02T15:02:10.5218824Z :: (.text+0x82a): undefined reference to `XML_ErrorString'
2023-03-02T15:02:10.5219341Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x832): undefined reference to `XML_GetCurrentColumnNumber'
2023-03-02T15:02:10.5219934Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x83a): undefined reference to `XML_ParserFree'
2023-03-02T15:02:10.5220452Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x842): undefined reference to `XML_Parse'
2023-03-02T15:02:10.5220987Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x84a): undefined reference to `XML_SetCommentHandler'
2023-03-02T15:02:10.5221533Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x851): undefined reference to `XML_GetErrorCode'
2023-03-02T15:02:10.5222084Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x858): undefined reference to `XML_GetCurrentLineNumber'
2023-03-02T15:02:10.5222640Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x860): undefined reference to `XML_SetElementHandler'
2023-03-02T15:02:10.5223277Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x867): undefined reference to `XML_SetCharacterDataHandler'
2023-03-02T15:02:10.5223848Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x86e): undefined reference to `XML_ParserCreate_MM'
2023-03-02T15:02:10.5224431Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x87b): undefined reference to `XML_SetProcessingInstructionHandler'
2023-03-02T15:02:10.5225024Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x882): undefined reference to `XML_SetDefaultHandlerExpand'
2023-03-02T15:02:10.5225627Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x88f): undefined reference to `XML_SetUserData'
2023-03-02T15:02:10.5238790Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x897): undefined reference to `XML_SetEncoding'
2023-03-02T15:02:10.5239702Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x8af): undefined reference to `XML_SetNamespaceDeclHandler'
2023-03-02T15:02:10.5240333Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x8c4): undefined reference to `XML_SetUnknownEncodingHandler'
2023-03-02T15:02:10.5240961Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x8d5): undefined reference to `XML_SetStartDoctypeDeclHandler'
2023-03-02T15:02:10.5241535Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0xa2a): undefined reference to `XML_ExpatVersion'
2023-03-02T15:02:10.5242083Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0xa49): undefined reference to `XML_ExpatVersionInfo'
2023-03-02T15:02:10.5242648Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x11e4): undefined reference to `XML_GetFeatureList'
2023-03-02T15:02:10.5243193Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x13b8): undefined reference to `XML_SetHashSalt'
2023-03-02T15:02:10.5243882Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `pyexpat_ParserCreate':
2023-03-02T15:02:10.5244331Z :: (.text+0x1f51): undefined reference to `XML_ParserCreate_MM'
2023-03-02T15:02:10.5244889Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x1f72): undefined reference to `XML_SetHashSalt'
2023-03-02T15:02:10.5245412Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x1f7f): undefined reference to `XML_SetUserData'
2023-03-02T15:02:10.5245971Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x1f92): undefined reference to `XML_SetUnknownEncodingHandler'
2023-03-02T15:02:10.5246713Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `pyexpat_xmlparser_GetInputContext':
2023-03-02T15:02:10.5247175Z :: (.text+0x2332): undefined reference to `XML_GetInputContext'
2023-03-02T15:02:10.5247804Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `pyexpat_xmlparser_GetBase':
2023-03-02T15:02:10.5248225Z :: (.text+0x237d): undefined reference to `XML_GetBase'
2023-03-02T15:02:10.5248847Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `pyexpat_xmlparser_SetBase':
2023-03-02T15:02:10.5249264Z :: (.text+0x23eb): undefined reference to `XML_SetBase'
2023-03-02T15:02:10.5285049Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `xmlparse_CurrentLineNumber_getter':
2023-03-02T15:02:10.5286988Z :: (.text+0x248d): undefined reference to `XML_GetCurrentLineNumber'
2023-03-02T15:02:10.5288075Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `xmlparse_CurrentColumnNumber_getter':
2023-03-02T15:02:10.5289676Z :: (.text+0x24ad): undefined reference to `XML_GetCurrentColumnNumber'
2023-03-02T15:02:10.5290477Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `xmlparse_CurrentByteIndex_getter':
2023-03-02T15:02:10.5291125Z :: (.text+0x24cd): undefined reference to `XML_GetCurrentByteIndex'
2023-03-02T15:02:10.5291804Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `xmlparse_namespace_prefixes_setter':
2023-03-02T15:02:10.5292260Z :: (.text+0x25a3): undefined reference to `XML_SetReturnNSTriplet'
2023-03-02T15:02:10.5292895Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `xmlparse_dealloc':
2023-03-02T15:02:10.5293397Z :: (.text+0x2671): undefined reference to `XML_ParserFree'
2023-03-02T15:02:10.5294007Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `set_error.isra.0':
2023-03-02T15:02:10.5294445Z :: (.text+0x28ea): undefined reference to `XML_GetCurrentLineNumber'
2023-03-02T15:02:10.5294982Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x28f5): undefined reference to `XML_GetCurrentColumnNumber'
2023-03-02T15:02:10.5295545Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x28ff): undefined reference to `XML_ErrorString'
2023-03-02T15:02:10.5296245Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `pyexpat_xmlparser_UseForeignDTD':
2023-03-02T15:02:10.5296687Z :: (.text+0x2b5d): undefined reference to `XML_UseForeignDTD'
2023-03-02T15:02:10.5297316Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `flush_character_buffer':
2023-03-02T15:02:10.5297740Z :: (.text+0x2d0f): undefined reference to `XML_StopParser'
2023-03-02T15:02:10.5299104Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x2d99): undefined reference to `XML_SetExternalEntityRefHandler'
2023-03-02T15:02:10.5299722Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x2da9): undefined reference to `XML_SetCharacterDataHandler'
2023-03-02T15:02:10.5300418Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `my_XmlDeclHandler':
2023-03-02T15:02:10.5300842Z :: (.text+0x2faf): undefined reference to `XML_StopParser'
2023-03-02T15:02:10.5301503Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `my_DefaultHandlerExpandHandler':
2023-03-02T15:02:10.5301946Z :: (.text+0x31cf): undefined reference to `XML_StopParser'
2023-03-02T15:02:10.5302568Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `my_DefaultHandler':
2023-03-02T15:02:10.5302983Z :: (.text+0x33ef): undefined reference to `XML_StopParser'
2023-03-02T15:02:10.5303609Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `my_SkippedEntityHandler':
2023-03-02T15:02:10.5304025Z :: (.text+0x35ef): undefined reference to `XML_StopParser'
2023-03-02T15:02:10.5304640Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `my_AttlistDeclHandler':
2023-03-02T15:02:10.5427359Z :: (.text+0x381f): undefined reference to `XML_StopParser'
2023-03-02T15:02:10.5428193Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o):(.text+0x3acf): more undefined references to `XML_StopParser' follow
2023-03-02T15:02:10.5429020Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10-pic.a(pyexpat.o): in function `my_ExternalEntityRefHandler':
2023-03-02T15:02:10.5429515Z :: (.text+0x4b5c): undefined reference to `XML_SetExternalEntityRefHandler'
2023-03-02T15:02:10.5430226Z :: /snap/gnome-42-2204-sdk/current/usr/bin/ld: (.text+0x4b87): undefined reference to `XML_StopParser'

Those undefined references should come from the expat library, but I don’t know why that isn’t being linked in correctly.

Is there really no way?