简体   繁体   English

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

[英]Qt5 [make -snap] doesn't compile properly: The process "/usr/bin/snap" exited with code 1

I copied/paste a Qt5 project folder from a computer to another computer.我将Qt5项目文件夹从一台计算机复制/粘贴到另一台计算机。 They are both Ubuntu 18.04 .它们都是Ubuntu 18.04

Same version of Qt5 and same libraries/dependencies.相同版本的Qt5和相同的库/依赖项。 On the new computer, I have CMake 3.10.2 , but I don't remember the verion of CMake I had on the former one.在新电脑上,我有CMake 3.10.2 ,但我不记得我在前一台上的CMake (Probably CMake 3.8 ). (可能是CMake 3.8 )。

As soon as I open Qt5 and open the folder containing the CMakeLists.txt file, and click on it, I get the following result from the output:一旦我打开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.

And below the General Message I get:在我得到的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.

I never had to use Android NDK on my previous project, nor I had to install it.我从来没有在我以前的项目中使用过Android NDK ,我也不必安装它。 And I am not sure why on the new machine is showing this message.而且我不确定为什么在新机器上显示此消息。

In addition it seems that is trying to use snap instead of the usual make .此外,似乎正在尝试使用snap而不是通常的make

I am not sure about what is happening and why.我不确定发生了什么以及为什么。

What I tried so far:到目前为止我尝试过的:

1) The only thing that came to my mind was to try to create a small example application and see if it runs, it actually runs properly and gives no error as shown below: 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.

It seems that the project that I copied/paste uses snap and if I create a new project, like a Qt Widget application , it actually uses make , exiting correctly in the output.似乎我复制/粘贴的项目使用snap并且如果我创建一个新项目,如Qt Widget application ,它实际上使用make ,在输出中正确退出。

The flags --build . --target all标志--build . --target all --build . --target all are flags you typically see passed to the cmake executable, not the snap executable. --build . --target all是您通常看到传递给cmake可执行文件的标志,而不是snap可执行文件。 This hints that your CMake environment is not configured correctly in the IDE on your new machine.这暗示您的 CMake 环境未在新机器上的 IDE 中正确配置。 I suggest following the QtCreator CMake setup instructions here to help get it configured:我建议按照此处的 QtCreator CMake 设置说明进行操作以帮助对其进行配置:

To specify paths to CMake executables:要指定 CMake 可执行文件的路径:

  1. Select Tools > Options > Kits > CMake > Add .选择“工具” >“选项” >“工具包” >“ CMake” >“添加”
  2. In the Name field, specify a name for the tool.名称字段中,指定工具的名称。
  3. In the Path field, specify the path to the CMake executable.路径字段中,指定 CMake 可执行文件的路径。
  4. Select the Auto-create build directories check box to automatically create build directories for CMake projects.选中自动创建构建目录复选框以自动为 CMake 项目创建构建目录。
  5. Select Apply to save your changes.选择应用以保存您的更改。

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

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