ubuntu / app-center

App Store for Ubuntu made with Flutter ๐Ÿงก ๐Ÿ’™
GNU General Public License v3.0
662 stars 116 forks source link

Run 'Snacraft --debug --use-lxd` on Ubuntu 22.04 not working #375

Closed yuanhoujun closed 2 years ago

yuanhoujun commented 2 years ago

Like this: image

Entered shell command environment.

Feichtmeier commented 2 years ago

Hi ๐Ÿ˜Œ๐Ÿ‘‹ I do not understand what you were trying to achieve that you'd expect as a result or a feature of this app?

oSoMoN commented 2 years ago

@yuanhoujun Can you share more details, including the snapcraft log, and your expectations?

yuanhoujun commented 2 years ago

@Feichtmeier @oSoMoN Thanks for your reply. I'm working on a new Flutter app on Ubuntu. The official website is here: https://cca.yhdm360.cn/. I can generate AppImage binary, and other binaries exclude snap.

I try to use core18 as my base, but audioplayers library depend a newer stdc++ library, so I have to update base to core22 or core20. But there aren't Flutter extension in core20 and core22.

By chance, I found this library, I refer to your configuration of snapcraft. But it's not working, It entered snapcraft shell env.

I'm not very familiar with snap, I hope you guys could help me, I'll very appreciate that.

snapcraft.yaml:

name: chinese-chess-assistant
version: git
summary: Chinese Chess Assistant
description: |
  Snap Store is a graphical desktop application for discovering, installing and managing snaps and traditional packages on Linux.

  Snap Store showcases featured and popular applications with useful descriptions and screenshots.

  Applications can be found either through browsing categories or by searching.

  Snap Store can also be used to switch channels, manage snap permissions, install traditional packages (deb/rpm), check for and install updates.
confinement: devmode
base: core22
grade: stable

parts:
  flutter-git:
    source: https://github.com/flutter/flutter.git
    source-branch: stable
    plugin: nil
    override-build: |
      set -eux
      mkdir -p $CRAFT_PART_INSTALL/usr/bin
      mkdir -p $CRAFT_PART_INSTALL/usr/libexec
      cp -r $CRAFT_PART_SRC $CRAFT_PART_INSTALL/usr/libexec/flutter
      ln -sf $CRAFT_PART_INSTALL/usr/libexec/flutter/bin/flutter $CRAFT_PART_INSTALL/usr/bin/flutter
      export PATH="$CRAFT_PART_INSTALL/usr/bin:$PATH"
      flutter doctor
      flutter channel stable
      flutter upgrade
    build-packages:
      - clang
      - cmake
      - curl
      - ninja-build
      - unzip
    override-prime: ''

  chinese-chess-assistant:
    after: [ flutter-git ]
    plugin: nil
    source: .
    build-packages:
      - jq
    override-build: |
      set -eux
      flutter pub get
      flutter build linux --release -v
      craftctl set version="$(jq -r '.version' build/flutter_assets/version.json)"
      mkdir -p $CRAFT_PART_INSTALL/bin
      mkdir -p $CRAFT_PART_INSTALL/bin/gui
      cp -r build/linux/*/release/bundle/* $CRAFT_PART_INSTALL/bin/
      cp -r snap/gui/* $CRAFT_PART_INSTALL/bin/gui/*
      sed -i -e 's|\(Icon=\).*|\1/bin/snap/gui/app_icon.png|' \
          $CRAFT_PART_INSTALL/bin/snap/gui/app_icon.desktop

apps:
  chinese-chess-assistant:
    command: bin/chinese_chess_assistant
    desktop: bin/snap/gui/app_icon.desktop
    extensions: [gnome]

OS: Ubuntu 22.04

Stack trace:

exit
'override-build' in part 'flutter-git' failed with code 1.
Review the scriptlet and make sure it's correct.                
Full execution log: '/tmp/snapcraft.log'                                                                                   

Traceback (most recent call last):
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 448, in _run_in_provider
    instance.execute_run(cmd, check=True, cwd=output_dir)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/craft_providers/lxd/lxd_instance.py", line 289, in execute_run
    return self.lxc.exec(
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/craft_providers/lxd/lxc.py", line 329, in exec
    return runner(final_cmd, **kwargs)  # pylint: disable=subprocess-run-check
  File "/snap/snapcraft/8187/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:snapcraft-chinese-chess-assistant-on-amd64-for-amd64-3541835', '--cwd', '/root/project', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'SNAPCRAFT_MANAGED_MODE=1', 'http_proxy=http://192.168.0.200:10809/', 'https_proxy=http://192.168.0.200:10809/', 'no_proxy=localhost,127.0.0.0/8,::1', 'snapcraft', 'pack', '--debug', '--build-for', 'amd64']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/snap/snapcraft/8187/bin/snapcraft", line 8, in <module>
    sys.exit(run())
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/cli.py", line 208, in run
    _run_dispatcher(dispatcher)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/cli.py", line 197, in _run_dispatcher
    dispatcher.run()
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/craft_cli/dispatcher.py", line 419, in run
    return self._loaded_command.run(self._parsed_command_args)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 247, in run
    super().run(parsed_args)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 120, in run
    parts_lifecycle.run(self.name, parsed_args)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 202, in run
    _run_command(
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 248, in _run_command
    _run_in_provider(project, command_name, parsed_args)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 452, in _run_in_provider
    raise ProviderError(
craft_providers.errors.ProviderError: Failed to execute pack in instance.
oSoMoN commented 2 years ago

That's not the right place for this. Please ask on the snapcraft forum.