snapcrafters / sommelier-core

Package a Windows application for Linux using a Snap with Wine.
MIT License
30 stars 10 forks source link

[Bug]: snapcraft fails on Ubuntu 24.04 at building script for part 'sommelier-core' #47

Closed senneschall closed 2 months ago

senneschall commented 2 months ago

What happened?

Trying to build a new snap via fails with the error message:

~/snapcraft/HxD > snapcraft 
Failed to run the build script for part 'sommelier-core'.                                                                                                                         
Failed to execute pack in instance.                                                                                                                                               
Recommended resolution: Run the same command again with --debug to shell into the environment if you wish to introspect this failure.                                             
Full execution log: '/home/test/.local/state/snapcraft/log/snapcraft-20240508-074403.782439.log'                                                                                  

The relevant part of the full exection log is attached below.

The yaml:

name: hxd
base: core22
version: '2.5.0.0'
summary: HxD
description: HxD (wine) Hex Editor
grade: stable
confinement: strict
license: Proprietary
compression: lzo

plugs:
  wine-runtime:
    interface: content
    target: $SNAP/wine-runtime
    default-provider: wine-platform-runtime-core22
  wine-platform-9-stable-core22:
    interface: content
    target: $SNAP/wine-platform
    default-provider: wine-platform-9-stable-core22

parts:
  sommelier-core:
    plugin: make
    source: https://github.com/snapcrafters/sommelier-core.git
    source-branch: "1.0"

environment:
  WINEDLLOVERRIDES: "mscoree,mshtml="
  SOMMELIER_KEEP_CWD: "1"
  NO_AT_BRIDGE: "1"
  SOMMELIER_NO_THEME: "1"
  RUN_EXE: "$SNAP/HxD.exe"

apps:
  hxd:
    extensions: [gnome]
    command: bin/sommelier run-exe
    plugs: [home, network, removable-media]
  wine:
    extensions: [gnome]
    command: bin/sommelier
    plugs: [home, network, removable-media]
  winetricks:
    extensions: [gnome]
    command: bin/sommelier winetricks
    plugs: [home, network, removable-media]

What should have happened?

I expected it to buld a snap.

Output of snap info $snap_name

no snap was created

Output of snap connections $snap_name

no snap was created

Output of snap version

snap    2.62+24.04build1
snapd   2.62+24.04build1
series  16
ubuntu  24.04
kernel  6.8.0-31-generic

Relevant log output

2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.815 Building sommelier-core
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.815 execute action sommelier-core:Action(part_name='sommelier-core', step=Step.BUILD, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.816 load state file: /root/parts/sommelier-core/state/pull
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.823 remove directory /root/parts/sommelier-core/build
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.835 Executing PosixPath('/root/parts/sommelier-core/run/build.sh')
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.838 :: + make -j4
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.860 :: # Build the 32-bit version of the bindtextdomain patch. This patch
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.862 :: # makes it easier for applications to find gettext translations shipped
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.865 :: # by snaps.
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.870 :: #
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.874 :: # The Gnome extensions only compile the library for 64-bit arch.
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.876 :: sudo apt-get -y install libc6-dev-i386
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.879 :: make: sudo: No such file or directory
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.880 :: make: *** [Makefile:14: build] Error 127
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.881 Failed to run the build script for part 'sommelier-core'.
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889 Traceback (most recent call last):
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/snapcraft/application.py", line 361, in main
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     return app.run()
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/craft_application/application.py", line 488, in run
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     dispatcher = self._get_dispatcher()
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/snapcraft/application.py", line 220, in _get_dispatcher
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     raise errors.ClassicFallback()
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889 snapcraft.errors.ClassicFallback
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889 During handling of the above exception, another exception occurred:
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889 Traceback (most recent call last):
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/craft_parts/executor/step_handler.py", line 148, in _builtin_build
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     _create_and_run_script(
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/craft_parts/executor/step_handler.py", line 459, in _create_and_run_script
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     subprocess.run(
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/usr/lib/python3.10/subprocess.py", line 526, in run
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     raise CalledProcessError(retcode, process.args,
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889 subprocess.CalledProcessError: Command '[PosixPath('/root/parts/sommelier-core/run/build.sh')]' returned non-zero exit status 2.
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889 The above exception was the direct cause of the following exception:
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889 Traceback (most recent call last):
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/snapcraft/parts/parts.py", line 222, in run
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     aex.execute(action, stdout=stream, stderr=stream)
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/craft_parts/executor/executor.py", line 327, in execute
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     self._executor.execute(actions, stdout=stdout, stderr=stderr)
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/craft_parts/executor/executor.py", line 137, in execute
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     self._run_action(act, stdout=stdout, stderr=stderr)
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/craft_parts/executor/executor.py", line 214, in _run_action
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     handler.run_action(action, stdout=stdout, stderr=stderr)
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/craft_parts/executor/part_handler.py", line 170, in run_action
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     state = handler(step_info, stdout=stdout, stderr=stderr)
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/craft_parts/executor/part_handler.py", line 309, in _run_build
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     self._run_step(
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/craft_parts/executor/part_handler.py", line 491, in _run_step
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     return step_handler.run_builtin()
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/craft_parts/executor/step_handler.py", line 108, in run_builtin
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     return handler()
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889   File "/snap/snapcraft/11627/lib/python3.10/site-packages/craft_parts/executor/step_handler.py", line 157, in _builtin_build
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889     raise errors.PluginBuildError(part_name=self._part.name) from process_error
2024-05-08 07:51:45.460 :: 2024-05-08 07:51:44.889 craft_parts.errors.PluginBuildError: Failed to run the build script for part 'sommelier-core'.

Teminal output of app

No response

mmtrt commented 2 months ago

Need to add this to sommelier-core part

    build-packages:
      - libc6-dev-i386
      - gcc-multilib

edit: also use wine 9 stable plug name as wine-9-stable

senneschall commented 2 months ago

I don't think that's the problem here, because of that part of the log file:

2024-05-08 11:45:42.222 Installing packages: gcc gcc-multilib git libc6-dev-i386 make
...
2024-05-08 11:45:53.167 :: Get:23 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libc6-dev-i386 amd64 2.35-0ubuntu3.7 [1445 kB]
...
2024-05-08 11:46:00.732 :: Selecting previously unselected package libc6-dev-i386.
2024-05-08 11:46:00.736 :: Preparing to unpack .../09-libc6-dev-i386_2.35-0ubuntu3.7_amd64.deb ...
2024-05-08 11:46:00.740 :: Unpacking libc6-dev-i386 (2.35-0ubuntu3.7) ...
...
2024-05-08 11:46:03.149 :: Setting up libc6-dev-i386 (2.35-0ubuntu3.7) ...
...
2024-05-08 11:46:03.922 Found installed version 2.35-0ubuntu3.7 for package libc6-dev-i386
...
2024-05-08 11:51:41.662 Pulling sommelier-core
2024-05-08 11:51:41.663 execute action sommelier-core:Action(part_name='sommelier-core', step=Step.PULL, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))
2024-05-08 11:51:41.665 Executing: git clone --recursive --branch 1.0 https://github.com/snapcrafters/sommelier-core.git
2024-05-08 11:51:41.676 :: Cloning into '/root/parts/sommelier-core/src'...
...
2024-05-08 11:51:44.011 Building sommelier-core
2024-05-08 11:51:44.012 execute action sommelier-core:Action(part_name='sommelier-core', step=Step.BUILD, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))
2024-05-08 11:51:44.013 load state file: /root/parts/sommelier-core/state/pull
2024-05-08 11:51:44.024 remove directory /root/parts/sommelier-core/build
2024-05-08 11:51:44.036 Executing PosixPath('/root/parts/sommelier-core/run/build.sh')
2024-05-08 11:51:44.039 :: + make -j4
2024-05-08 11:51:44.059 :: # Build the 32-bit version of the bindtextdomain patch. This patch
2024-05-08 11:51:44.062 :: # makes it easier for applications to find gettext translations shipped
2024-05-08 11:51:44.064 :: # by snaps.
2024-05-08 11:51:44.066 :: #
2024-05-08 11:51:44.070 :: # The Gnome extensions only compile the library for 64-bit arch.
2024-05-08 11:51:44.072 :: sudo apt-get -y install libc6-dev-i386
2024-05-08 11:51:44.074 :: make: sudo: No such file or directory
2024-05-08 11:51:44.074 :: make: *** [Makefile:14: build] Error 127
2024-05-08 11:51:44.081 Failed to run the build script for part 'sommelier-core'.
2024-05-08 11:51:44.089 Traceback (most recent call last):
2024-05-08 11:51:44.089   File "/snap/snapcraft/11627/lib/python3.10/site-packages/snapcraft/application.py", line 361, in main
2024-05-08 11:51:44.089     return app.run()
2024-05-08 11:51:44.089   File "/snap/snapcraft/11627/lib/python3.10/site-packages/craft_application/application.py", line 488, in run
2024-05-08 11:51:44.089     dispatcher = self._get_dispatcher()
2024-05-08 11:51:44.089   File "/snap/snapcraft/11627/lib/python3.10/site-packages/snapcraft/application.py", line 220, in _get_dispatcher
2024-05-08 11:51:44.089     raise errors.ClassicFallback()
2024-05-08 11:51:44.089 snapcraft.errors.ClassicFallback

I tried this after cleaning up and re-doing the process with the updated yaml:

name: hxd
base: core22
version: '2.5.0.0'
summary: HxD
description: HxD (wine) Hex Editor
grade: stable
confinement: strict
license: Proprietary
compression: lzo
architectures:
  - build-on: [amd64]

plugs:
  wine-runtime:
    interface: content
    target: $SNAP/wine-runtime
    default-provider: wine-platform-runtime-core22
  wine-9-stable:
    interface: content
    target: $SNAP/wine-platform
    default-provider: wine-platform-9-stable-core22

parts:
  hxd:
    plugin: dump
    source: .
    source-type: local
  sommelier-core:
    plugin: make
    source: https://github.com/snapcrafters/sommelier-core.git
    source-branch: "1.0"
    build-packages: [libc6-dev-i386, gcc-multilib]

environment:
  WINEDLLOVERRIDES: "mscoree,mshtml="
  SOMMELIER_KEEP_CWD: "1"
  NO_AT_BRIDGE: "1"
  SOMMELIER_NO_THEME: "1"
  RUN_EXE: "$SNAP/HxD.exe"

apps:
  hxd:
    extensions: [gnome]
    command: bin/sommelier run-exe
    plugs: [home, network, removable-media]
  wine:
    extensions: [gnome]
    command: bin/sommelier
    plugs: [home, network, removable-media]
  winetricks:
    extensions: [gnome]
    command: bin/sommelier winetricks
    plugs: [home, network, removable-media]
mmtrt commented 2 months ago

ah sommelier 1.0 branch is missing changes try using master branch for now.

EDIT: fix wine-runtime core22 plug name to wine-runtime-c22

senneschall commented 2 months ago

That fixed it. Many thanks!