Qt5 [make -snap]无法正确编译:进程“ / usr / bin / snap”以代码1退出

问题描述 投票:0回答:1

我将一台Qt5项目文件夹从一台计算机复制/粘贴到另一台计算机。它们都是Ubuntu 18.04

Qt5的相同版本和相同的库/依赖项。在新计算机上,我有CMake 3.10.2,但是我不记得在前一台计算机上有CMake的版本。 (可能是CMake 3.8)。

打开Qt5并打开包含CMakeLists.txt文件的文件夹,然后单击它,我从输出中得到以下结果:

08:02:22: Running steps for project newcam-proc...     
08:02:22: Persisting CMake state...  
08:02:22: Starting: "/usr/bin/snap" --build . --target all error: unknown flag `build' 
08:02:22: The process "/usr/bin/snap" exited with code 1. 
Error while building/deploying project myProject (kit: Desktop Qt 5.12.5 GCC 64bit) 
The kit Desktop Qt 5.12.5 GCC 64bit has configuration issues which might be the root cause for this problem. When executing step "CMake Build" 
08:02:22: Elapsed time: 00:00.

General Message以下,我得到:

Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
Could not read qmake configuration file /home/emanuele/Qt/5.12.5/android_armv7/mkspecs/android-clang/qmake.conf.
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
Could not read qmake configuration file /home/emanuele/Qt/5.12.5/android_x86/mkspecs/android-clang/qmake.conf.
Running /usr/bin/snap /home/emanuele/Desktop/myProject -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_CXX_COMPILER:STRING=/usr/bin/g++ -DCMAKE_C_COMPILER:STRING=/usr/bin/gcc -DCMAKE_PREFIX_PATH:STRING=/home/emanuele/Qt/5.12.5/gcc_64 -DQT_QMAKE_EXECUTABLE:STRING=/home/emanuele/Qt/5.12.5/gcc_64/bin/qmake in /tmp/QtCreator-vlHbHY/qtc-cmake-LvUefYdh.
error: unknown command "/home/emanuele/Desktop/myProject", see 'snap help'.
CMake process exited with exit code 1.

我从不需要在以前的项目中使用Android NDK,也不必安装它。而且我不确定为什么在新计算机上会显示此消息。

此外,似乎正在尝试使用snap而不是通常的make

我不确定正在发生什么以及为什么。

到目前为止我尝试过的事情:

1)我唯一想到的就是尝试创建一个小的示例应用程序,看看它是否运行,它实际上运行正常,并且没有出现错误,如下所示:

08:16:00: Running steps for project untitled...
08:16:00: Configuration unchanged, skipping qmake step.
08:16:00: Starting: "/usr/bin/make" -j8
make: Nothing to be done for 'first'.
08:16:00: The process "/usr/bin/make" exited normally.
08:16:00: Elapsed time: 00:00.

似乎复制/粘贴的项目使用snap,如果我创建一个新项目(例如Qt Widget application,它实际上使用make,则在输出中正确退出。

c++ qt cmake qt5 qt-creator
1个回答
1
投票

--build . --target all标志是通常会传递给cmake可执行文件而不是snap可执行文件的标志。这表明在新计算机的IDE中未正确配置CMake环境。我建议按照QtCreator CMake设置说明here进行配置:

指定CMake可执行文件的路径:

  1. 选择工具> 选项> 套件> CMake> 添加
  2. 名称字段中,为工具指定名称。
  3. Path字段中,指定CMake可执行文件的路径。
  4. 选择自动创建构建目录复选框以自动为CMake项目创建构建目录。
  5. 选择应用保存更改。
© www.soinside.com 2019 - 2024. All rights reserved.