Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Assert Failure in expandVariableReferences When Configuring Qt 5 for WebAssembly Build
Forum Updated to NodeBB v4.3 + New Features

Assert Failure in expandVariableReferences When Configuring Qt 5 for WebAssembly Build

Scheduled Pinned Locked Moved Solved Qt for WebAssembly
16 Posts 3 Posters 1.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L lorn.potter
    31 Oct 2019, 02:03

    @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. No make_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.

    D Offline
    D Offline
    DragonOsman
    wrote on 31 Oct 2019, 18:38 last edited by DragonOsman
    #7

    @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?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lorn.potter
      wrote on 31 Oct 2019, 19:45 last edited by
      #8

      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.

      Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
      Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DragonOsman
        wrote on 31 Oct 2019, 20:35 last edited by
        #9

        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.

        L 1 Reply Last reply 31 Oct 2019, 20:39
        0
        • D DragonOsman
          31 Oct 2019, 20:35

          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.

          L Offline
          L Offline
          lorn.potter
          wrote on 31 Oct 2019, 20:39 last edited by
          #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.

          Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
          Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DragonOsman
            wrote on 31 Oct 2019, 21:45 last edited by DragonOsman
            #11

            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?

            L 1 Reply Last reply 1 Nov 2019, 04:31
            0
            • D DragonOsman
              31 Oct 2019, 21:45

              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?

              L Offline
              L Offline
              lorn.potter
              wrote on 1 Nov 2019, 04:31 last edited by
              #12

              @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.

              Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
              Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

              1 Reply Last reply
              0
              • D Offline
                D Offline
                DragonOsman
                wrote on 1 Nov 2019, 10:22 last edited by
                #13

                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.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DragonOsman
                  wrote on 1 Nov 2019, 19:38 last edited by DragonOsman 11 Jan 2019, 21:27
                  #14

                  @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.

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    DragonOsman
                    wrote on 1 Nov 2019, 22:00 last edited by
                    #15

                    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.

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      DragonOsman
                      wrote on 5 Nov 2019, 21:30 last edited by
                      #16

                      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.

                      1 Reply Last reply
                      0

                      16/16

                      5 Nov 2019, 21:30

                      • Login

                      • Login or register to search.
                      16 out of 16
                      • First post
                        16/16
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved