Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved QT-Webassembly - Compile Examples

    General and Desktop
    3
    6
    683
    Loading More Posts
    • 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.
    • David_001
      David_001 last edited by David_001

      Hi everybody,

      i would like to compile some of the qt examples with emcc compiler, but i have some trouble with it.
      I already searched for this error some hours but didn't get a good solution.

      So here is what i have done:

      1. Downloaded qt web installer (linux) from qt.io
      2. Installed qt 5.13 (complete) => with sources and Webassembly
      3. => Since 5.13 i think there is no need to compile Webassembly on his own like on 5.12 anymore.
      4. Than i installed emcc like the instruction on emscription.org said.

      git clone https://github.com/emscripten-core/emsdk.git
      cd emsdk
      git pull
      ./emsdk install latest
      ./emsdk activate latest
      source ./emsdk_env.sh
      sudo apt-get install python2.7
      sudo apt-get install cmake
      sudo apt-get install default-jre
      

      After i have done that i verified the emcc installation. Everything is fine.

      5. Started QtCreator => There is already an QtWebassembly Kit but without an Compiler
      6. Added emcc and em++ compiler to QtCreator (custom-compiler)

      Name: emcc
      Compiler-Path:  ~/work/privat/project/emc/emsdk/fastcomp/emscripten/emcc
      Path to Make: /usr/bin/make
      ABI: x86,linux,generic, elf,64bit
      QT-mkspecs: empty
      
      Name: em++
      Compiler-Path:  ~/work/privat/project/emc/emsdk/fastcomp/emscripten/em++
      Path to Make: /usr/bin/make
      ABI: x86,linux,generic, elf,64bit
      QT-mkspecs: empty
      
      Everything else on Default.
      

      7. Added Compiler to QtWebassembly-Kit
      8. Opened any example from Qt and also made a simple Window with an anchors.fill red Rectangle
      9. Compiling staring like always BUTTTTT than there where some issues.

      warning: unexpected return type i32 in call to 'lseek', should be i64
      warning: unexpected argument type i32 at index 5 in call to '__mmap', should be i64
      warning: unexpected argument type i32 at index 5 in call to '__mmap', should be i64
      warning: unexpected argument type i32 at index 5 in call to '__mmap', should be i64
      warning: unexpected argument type i32 at index 5 in call to '__mmap', should be i64
      warning: unexpected argument type i32 at index 5 in call to '__mmap', should be i64
      warning: unexpected argument type i32 at index 1 in call to 'lseek', should be i64
      warning: unexpected return type i32 in call to 'lseek', should be i64
      warning: unexpected argument type i32 at index 5 in call to '__mmap', should be i64
      emcc: warning: cannot represent a NaN literal '0x1b1af280' with custom bit pattern in NaN-canonicalizing JS engines (e.g. Firefox and Safari) without erasing bits!
        in   ret double 0x7FF4000000000000 in _ZL7qt_snanv() 
      emcc: warning: cannot represent a NaN literal '0x1b1af280' with custom bit pattern in NaN-canonicalizing JS engines (e.g. Firefox and Safari) without erasing bits!
        in   ret double 0x7FF4000000000000 in _ZL7qt_snanv.24722() 
      warning: unexpected return type i32 in call to '__ftello', should be i64
      warning: unexpected argument type i32 at index 1 in call to 'lseek', should be i64
      warning: unexpected return type i32 in call to 'lseek', should be i64
      

      After a while QtCreator starts printing a lot lot lot lot output in assmbly (takes lot of time)

      alt text

      Ending up with this error:

      fatal: error in validating output shared:error:
      --total-memory=16777216 --trap-mode=clamp -Os --mem-init=./untitled.js.mem --mem-base=1024 --wasm-only -g -o ./untitled.wast -S --mvp-features' failed (1)
      

      As i said i already searched for it at google and tried some option i found:

      QMAKE_CXXFLAGS += -s WASM=0
      QMAKE_CXXFLAGS += -s TOTAL_MEMORY=52428800
      

      Still the same :( Does anyone knows where i made a mistake ? What am i doing wrong?

      lorn.potter 1 Reply Last reply Reply Quote 0
      • lorn.potter
        lorn.potter @David_001 last edited by

        @david_001 What version of emscripten do you have?
        Qt 5.13 webassembly requires 1.38.27
        https://wiki.qt.io/Qt_for_WebAssembly

        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 Reply Quote 3
        • David_001
          David_001 last edited by David_001

          Lastest => 1.38.39 shouldn't it work with a newer version as well?

          lorn.potter 1 Reply Last reply Reply Quote 0
          • lorn.potter
            lorn.potter @David_001 last edited by

            @david_001
            emscripten can and do make radical and non compatible changes. So we decided that we would tie a certain Qt version to a certain emscripten version.
            We have not made any changes to enforce this, or at least to point out to the developer that a certain version is required.

            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 Reply Quote 0
            • David_001
              David_001 last edited by David_001

              I used the Version you recommended, with the Version 1.38.27 the compilation will successfully.

              Here a Tutorial to setup:

              1. Downloaded qt web installer (linux) from qt.io
              2. Installed qt 5.13 (complete) => with sources and Webassembly
              3. => Since 5.13 i think there is no need to compile Webassembly on his own like on 5.12 anymore.
              4. Than i installed emcc like the instruction on emscription.org said.

              git clone https://github.com/emscripten-core/emsdk.git
              cd emsdk
              git pull
              ./emsdk install sdk-1.38.27-64bit
              ./emsdk activate sdk-1.38.27-64bit
              source ./emsdk_env.sh
              sudo apt-get install python2.7
              sudo apt-get install cmake
              sudo apt-get install default-jre
              

              After i have done that i verified the emcc installation. Everything is fine.

              5. Started QtCreator => There is already an QtWebassembly Kit but without an Compiler
              6. Added emcc and em++ compiler to QtCreator (custom-compiler)

              Name: emcc
              Compiler-Path:  ~/work/privat/project/emsdk/emscripten/1.38.27/emcc
              Path to Make: /usr/bin/make
              ABI: x86,linux,generic, elf,64bit
              QT-mkspecs: empty
              
              Name: em++
              Compiler-Path:  ~/work/privat/project/emsdk/emscripten/1.38.27/em++
              Path to Make: /usr/bin/make
              ABI: x86,linux,generic, elf,64bit
              QT-mkspecs: empty
              
              Everything else on Default.
              

              7. Added Compiler to QtWebassembly-Kit
              8. DONE

              1 Reply Last reply Reply Quote 0
              • N
                NativeCasinos Banned last edited by

                This post is deleted!
                1 Reply Last reply Reply Quote -2
                • First post
                  Last post