Assert Failure in expandVariableReferences When Configuring Qt 5 for WebAssembly Build
-
I decided to try building Qt 5 for WebAssembly again. When I gave this command to configure the build:
configure -no-warnings-are-errors -xplatform wasm-emscripten -platform win32-g++ -nomake examples -prefix C:/qt5/wasm32/qtbase -release -static -c++std c++17
I had an error saying:
ASSERT failure in expandVariableReferences: "Unrecognized token", file C:/qt5/qtbase/qmake/library/qmakeevaluator.cpp, line 1683
. What's the reason for this error? Did I add something I shouldn't have in my configuration command?I'm using the Developer Command Prompt for VS2019. I saw when I ran
configure
earlier, before specifying C++17 as the standard I wanted to use (I'd also forgotten to add-release
and-static
that time as well), that it configured without errors but that it didn't detect C++14 features. Nomake_unique
either for some reason, even though VS2017 and above have full support for C++14 and C++17. I also want to know how and where to specify that I want to generate LLVM bitcode for targeting wasm32. I believe I need to pass--emit-llvm --target=wasm32
somewhere appropriate.Any help is appreciated. Thanks in advance.
-
Hi
I dont know what that error means but i was wondering why the included precompiled was not usable ?Its for wrong version of Qt ? or you want it static ?
-
@DragonOsman
OK that makes sense. -
@DragonOsman said in Assert Failure in expandVariableReferences When Configuring Qt 5 for WebAssembly Build:
@mrjj I want to use the latest version of Emscripten but there are problems with that when using Qt. So I wanted to try building Qt myself.
For Qt 5.13 webassembly, you need to use emscripten 1.38.27 (or 1.38.30 for threaded)
-
@DragonOsman said in Assert Failure in expandVariableReferences When Configuring Qt 5 for WebAssembly Build:
I decided to try building Qt 5 for WebAssembly again. When I gave this command to configure the build:
configure -no-warnings-are-errors -xplatform wasm-emscripten -platform win32-g++ -nomake examples -prefix C:/qt5/wasm32/qtbase -release -static -c++std c++17
I had an error saying:
ASSERT failure in expandVariableReferences: "Unrecognized token", file C:/qt5/qtbase/qmake/library/qmakeevaluator.cpp, line 1683
. What's the reason for this error? Did I add something I shouldn't have in my configuration command?I'm using the Developer Command Prompt for VS2019. I saw when I ran
configure
earlier, before specifying C++17 as the standard I wanted to use (I'd also forgotten to add-release
and-static
that time as well), that it configured without errors but that it didn't detect C++14 features. Nomake_unique
either for some reason, even though VS2017 and above have full support for C++14 and C++17. I also want to know how and where to specify that I want to generate LLVM bitcode for targeting wasm32. I believe I need to pass--emit-llvm --target=wasm32
somewhere appropriate.Any help is appreciated. Thanks in advance.
You should not need to manually add --emit-llvm.
There is --device-option WASM_OBJECT_FILES=1 for configuring Qt, which is what I think you want.
-
@lorn-potter Thanks for the reply.
I tried to configure by running:
configure -no-warnings-are-errors -xplatform wasm-emscripten -platform win32-g++ -nomake examples -prefix qtbase -DLLVM_INSTALL_DIR=C:/emsdk/upstream/bin -DZLIB_LIBRARY=C:/zlib/lib/zlibstatic.lib --device-option WASM_OBJECT_FILES=1
and had this error:
ERROR: No value supplied to command line option 'device-option'. ERROR: Assigning unknown variable 'WASM_OBJECT_FILES' on command line.
and then I passed the option as
--device-option="WASM_OBJECT_FILES=1"
and it this happened:Running configuration tests... Project ERROR: Unknown feature object shared in expression '!features.shared'.
What's the correct way to pass that option? Also, how do I tell it the location of zlib correctly? And if I want it to use the LLVM/Clang that's in the EMSDK, did I pass the flag correctly for that?
-
Sorry, it is: -device-option WASM_OBJECT_FILES=1
No need to pass extra arguments, this instructs emscripten to use the new clang backend to output wasm files directly, instead of outputting javascript before transpiling that to wasm.Qt uses its own zlib, the emscripten zlib is too old and may have issues with Qt. Safest to use the built-in zlib.
-
I actually built my own zlib. That's what I'm trying to use.
What about LLVM path, though? Is it okay to give the path to the one used by Emscripten? It's LLVM 10.
-
@DragonOsman said in Assert Failure in expandVariableReferences When Configuring Qt 5 for WebAssembly Build:
I actually built my own zlib. That's what I'm trying to use.
What about LLVM path, though? Is it okay to give the path to the one used by Emscripten? It's LLVM 10.
You shouldn't need to pass any llvm path, emscripten does all the magic.
-
I want to pass the path to LLVM to it because of this warning:
WARNING: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation. Either ensure that llvm-config is in your PATH environment variable, or set LLVM_INSTALL_DIR to the location of your llvm installation. On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution. On macOS, you can use Homebrew's llvm package. On Windows, you must set LLVM_INSTALL_DIR to the installation path.
Also, do I need to build qtwebengine for Qt for WebAssembly or am I going to be fine without it?
-
@DragonOsman said in Assert Failure in expandVariableReferences When Configuring Qt 5 for WebAssembly Build:
I want to pass the path to LLVM to it because of this warning:
WARNING: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.
Do you need to build the docs? Otherwise you can ignore this warning.
Also, do I need to build qtwebengine for Qt for WebAssembly or am I going to be fine without it?
Depends on which modules you are going to actually use.
I usually only build qtbase, qtdeclarative, qtquickcontrols2, and maybe one or two others. -
I still don't actually understand what modules I need. For now I'm just thinking of building all of the ones tested and known to be good for Wasm.
-
@lorn-potter The build completed a few minutes ago with the command
mingw32-make module-qtbase module-qtdeclarative module-qtquickcontrols2 module-qtwebsockets module-qtsvg module-qtcharts module-qtmqtt
and I got this at the end:
mingw32-make: *** No rule to make target 'module-qtmqtt'. Stop.
I'll rerun it and this time I'll redirect the output to a file so I show it to you.
Edit: Okay, I can't get a file for the full output. I'll have to make do with what I have from the initial run which isn't the whole thing. https://gist.github.com/DragonOsman/6bbe1f3e8035566104f85ecf76e2173e . I have the environment variable EMCC_DEBUG set to 1, so I also the Emcripten debug output in there.
-
And just now I tried using the Qt I just built to build the Notepad project again. Here's the result: https://gist.github.com/DragonOsman/14cc0ce690f1c5ac1e76ae796741398f . There's still one .obj file that isn't determined to be of machine-type of wasm32. Any ideas on how I can fix this? Thanks in advance.
-
I think the reason for the Assert Failure errors is that I forgot to delete the files in the qtbase folder after a given build attempt. I think that's fixed now, but I still have some issues in building Qt so I'll open a thread now.