【发布时间】:2021-01-29 09:23:24
【问题描述】:
已在此处提出此问题,并且(错误地)作为副本关闭,并带有指向旧 CMAKE 问题的链接。可能关闭的人没有正确阅读问题。这与普通的 CMake 配置无关,除非您想在 snapcraft 源代码中配置 CMake 使用。
Error when building flutter app for Linux snap package using snapcraft
事实上,运行 snapcraft 失败了。使用 --debug 运行它会给你一个 snapcraft / multipass 文件系统的根控制台,whoami 说是 root,但你只能看到周围的快照(例如,不是你的家)。无论如何,错误说
CMake Error: The current CMakeCache.txt directory /root/parts/xxxxx/build/build/linux/release/CMakeCache.txt is different than the directory
/home/zolal/flutterapps/xxxxx/build/linux/release where CMakeCache.txt was created. This may result in binaries being created in the wrong
place. If you are not sure, reedit the CMakeCache.txt
(当然,您不能重新编辑 CMAKECache.txt,因为这是由 snapcraft 创建的)
似乎 cmake 构建在 snapcraft / multipass VM 之外开始,然后移动到 multipass VM 导致 CMake 错误。因为前一阵子问了原始问题,显然这仍然行不通。有人解决了这个问题吗?
更新、清除多通道并尝试使用 lxd:
snapcraft --use-lxd
Launching a container.
Waiting for container to be ready
Waiting for network to be ready...
snap "snapd" has no updates available
The flutter plugin is currently in beta, its API may break. Use at your own risk.
snapd is not logged in, snap install commands will use sudo
snap "core18" has no updates available
Skipping pull flutter-extension (already ran)
Skipping pull geraspine-outcome-pc (already ran)
Skipping pull gnome-3-28-extension (already ran)
Skipping build flutter-extension (already ran)
Building geraspine-outcome-pc
flutter pub get
Woah! You appear to be trying to run flutter as root.
We strongly recommend running the flutter tool without superuser privileges.
/
????
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Failed to run 'flutter pub get' for 'geraspine-outcome-pc': Exited with code 1.
Verify that the part is using the correct parameters and try again.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
当然,pubspec.yaml 是存在的,但文件显然没有传输到 VM。
【问题讨论】:
-
面临同样的问题你找到解决方案了吗,接受的答案似乎对我不起作用
-
不,对不起,我最终放弃了。