简体   繁体   English

无法运行我的 Snap 包(由 Rust 应用程序构建)

[英]Cannot run my Snap package (built from Rust App)

This is how my snapcraft.yaml looks like (at the root of my Rust project):这就是我的 snapcraft.yaml 的样子(在我的 Rust 项目的根目录):

name: keval-snap 
base: core20 
version: '0.1'
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: stable
confinement: strict

apps:
  keval-snap:
    command: bin/keval-snap
    daemon: simple

parts:
  my-part:
    plugin: rust
    source: .
    build-packages:
      - pkg-config
      - libssl-dev

And my Cargo.toml :还有我的 Cargo.toml :

[package]
name = "my-package"
version = "0.1.0"
edition = "2021"
default-run = "keval-snap"

[[bin]] # Bin to run the http client
name = "keval-snap"
path = "src/main.rs"
doc = false
.............

After creating the YAML I did创建 YAML 后,我做了

snapcraft

snapcraft upload --release=stable keval-snap_0.1_amd64.snap

I can see my package on my Snapcraft account我可以在我的 Snapcraft 帐户上看到我的包裹

Then, I Installed with snap install keval-snap然后,我安装了snap install keval-snap

The only thing is when I run keval-snap --help it says command not found !唯一的事情是当我运行keval-snap --help它说 command not found !

I expect to see the possible commands and options here.我希望在这里看到可能的命令和选项。

Is there anything wrong with snapcraft.yaml OR cargo.toml ? snapcraft.yaml 或 cargo.toml 有什么问题吗?

The issue was mismatching names.问题是名称不匹配。 I used snapcraft --debug and saw all the files inside VM.我使用snapcraft --debug并查看了 VM 中的所有文件。

Turns out, application command name should match with part name.事实证明,应用程序命令名称应与部件名称匹配。 I had my code built inside bin/my-part , and I was calling the command bin/keval-snap我在bin/my-part中构建了我的代码,并且我正在调用命令bin/keval-snap

Changed my part name to keval-snap & Issue was resolved !将我的零件名称更改为keval-snap & 问题已解决!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM