Qt Web Assembly:配置套件 [英] Qt web assembly: configure kit

查看:605
本文介绍了Qt Web Assembly:配置套件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的科学程序测试QT WebAssembly。
因此,我安装了emscripten。

I want to test out QT WebAssembly for my scientific program. Therefore, I installed emscripten.

$em++ --version

返回

emcc (Emscripten gcc/clang-like replacement) 1.38.30 (commit a5082b232617c762cb65832429f896c838df2483)...

然后我使用Qt WebInstaller安装了Qt。
在我的安装目录中,有一个 wasm_32 文件夹,其中包含 bin qmake

Then I installed Qt using the Qt WebInstaller. In my installation directory I have a wasm_32 folder which contains bin and qmake:

$ ~/Qt_web/5.13.2/wasm_32/bin/qmake --version 

返回

QMake version 3.1
Using Qt version 5.13.2 in /home/myName/Qt_web/5.13.2/wasm_32/lib

但是,当我启动Qt Creator时,单击 Projects 我会看到一个名为: Qt 5.13.2的工具包WebAssembly ,但我无法选择它(它显示为灰色)。
当我单击Manage Kits时,我发现没有为Qt 5.13.2.WebAssembly选择C和C ++编译器。

However, when I start Qt creator, click on Projects I see a Kit called: Qt 5.13.2 WebAssembly but I cannot select it (it is grayed out). When I click on manage Kits I saw that there is no C and C++ compiler selected for Qt 5.13.2.WebAssembly.

当我更改为 Qt版本。警告说:

ABI detection failed: Make sure to use a matching compiler when building. No qmlscene installed. 

这是所有可选编译器的列表:

This is a list of all compilers which are selectable:

问题:

我不太了解 emscripten 与所有这些有关。 emscripten是编译器吗?如果是,应该使用 Qt 5.13.2 WebAssembly 套件自动选择它吗?
正确的 Qt WebAssembly 套件的外观如何?

I do not really understand what emscripten has to do with all that. Is emscripten a compiler? If yes should it have been auto-selected by the Qt 5.13.2 WebAssembly kit? How does a proper Qt WebAssembly kit look like?

如果我选择gcc作为编译器,则会出现一条错误消息:

If I select gcc as my compiler I get an error saying:

/home/myName/Qt_web/5.13.2/wasm_32/plugins/platforms/libqwasm.a:-1: error: error adding symbols: File format not recognized

编辑:

当我打开qt维护工具并查看已安装的程序包,我得到以下信息:

When I open the qt maintenance tool and look at the installed packages I get the following:

EDIT2:
更改后到Qt Creator 4.11.0-beta2(4.10.83)中,我得以遵循

也许与我现在得到的错误有关:

Maybe it has to do with this error that I get now:

EDIT3:

好像我的脚本编译器具有一些问题。
编译器是否位于:

seems as if my emscripten compiler has some problems. Is the compiler located in:

emscripten/emsdk/clang/e1.38.30_64bit/clang++
emscripten/emsdk/clang/e1.38.30_64bit/clang

我注意到的一件事是,如果我使用在QtCreator >>套件>>中,选择添加,然后选择 Add>> Web组装>> C 会在手册>>中生成一个新条目。 C ++>> Emscripten Compiler 而不是 Manual>> C> Emscripten编译器。这有问题吗?

One thing I noticed is that If I use add in QtCreator >> Kits >> Compilers and I select Add >> WebAssembly >> C It generates a new entry in Manual >> C++ >> Emscripten Compiler and not in Manual >> C >> Emscripten Compiler. Is this a problem?

编辑

这是我的编译器页面的样子:

This is how my Compilers page looks like:

推荐答案


  1. 您需要复制从emsdk目录到您的主目录(.home / myUsername)的.emscripten文件。

  1. You need to copy the .emscripten file from emsdk directory to your home (/home/myUsername).

您需要手动修复文件中的路径(请参见

You need to fix the paths in the file manually (See example below).

请注意,.emscripten文件至少在我使用的版本(1.39.8)中,是python脚本(可能是错误吗?)

Notice that .emscripten file , at least in the version (1.39.8) i am using, is a python script (maybe a bug?)

编辑前的示例文件:

import os
emsdk_path = os.path.dirname(os.environ.get('EM_CONFIG')).replace('\\', '/')
NODE_JS = emsdk_path + '/node/12.18.1_64bit/bin/node'
LLVM_ROOT = emsdk_path + '/upstream/bin'
BINARYEN_ROOT = emsdk_path + '/upstream'
EMSCRIPTEN_ROOT = emsdk_path + '/upstream/emscripten'
TEMP_DIR = emsdk_path + '/tmp'
COMPILER_ENGINE = NODE_JS
JS_ENGINES = [NODE_JS]

编辑后:

import os
emsdk_path = os.path.dirname(os.environ.get('EM_CONFIG')).replace('\\', '/')
NODE_JS = '/home/myUsername/node/12.18.1_64bit/bin/node'
LLVM_ROOT = '/home/myUsername/upstream/bin'
BINARYEN_ROOT = '/home/myUsername/upstream'
EMSCRIPTEN_ROOT = '/home/myUsername/upstream/emscripten'
TEMP_DIR = '/home/myUsername/tmp'
COMPILER_ENGINE = NODE_JS
JS_ENGINES = [NODE_JS]

完成上述步骤后,qt创建者能够检测到Emscripten编译器没有错误。

When above steps are completed qt creator was able to detect the Emscripten Compiler with no errors.

这篇关于Qt Web Assembly:配置套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆