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. Link OpenSSL to webassembly works in 5.13.2 but not in 5.15.2 ?
QtWS25 Last Chance

Link OpenSSL to webassembly works in 5.13.2 but not in 5.15.2 ?

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
opensslwebassembly5.155.13.2
4 Posts 2 Posters 1.9k Views
  • 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.
  • M Offline
    M Offline
    Mixlu
    wrote on last edited by
    #1

    Hi,

    For context, I am trying to make a minimalist webassembly application using OpenSSL encryption for a proof of concept, just to be sure it's possible.

    I have correctly handled this for an Qt 5.13.2 application like this :

    Build OpenSSL 1.1.1k on a Linux VM

    1. Install Emscripten 1.38.30
    ./emsdk install sdk-fastcomp-1.38.30-64bit
    ./emsdk activate sdk-fastcomp-1.38.30-64bit
    source ./emsdk_env.sh
    
    1. Compile OpenSSL
    emmake ./config -no-asm
    emmake make
    

    Build Qt app (on Windows)

    1. Link OpenSSL in the .pro
    INCLUDEPATH += "C:/***/openssl-wasm/include"
    LIBS += "C:/***/openssl-wasm/libcrypto.a" "C:/***/openssl-wasm/libssl.a"
    
    1. Compile in Webassembly
    mkdir build-wasm
    cd build-wasm
    emsdk activate sdk-fastcomp-1.38.30-64bit
    emsdk_env
    C:\Qt\5.13.2\wasm_32\bin\qmake.exe ..
    C:\Qt\Tools\mingw730_64\bin\mingw32-make.exe
    

    After these steps, I have a working webassembly app that can use OpenSSL encryption.

    Problem comes when I tried to compile the same minimalist app but for Qt 5.15.2 :
    -I compiled OpenSSL with emsdk-1.39.7 instead.
    -Static link OpenSSL (as before in the .pro)
    -Compiled in webassembly with emscripten 1.39.7 (make with mingw 810_64)
    But the compilation give me this error :
    2db1e8bf-44e6-4bbe-9d94-f55ec61939b1-image.png

    I also tried with emscripten 1.39.8, but with the same error.

    I guess it should be possible to link OpenSSL with Qt 5.15.2. Am I missing something here ? Any hints would be really helpful and appreciated.

    Thanks ;)
    Mathis

    1 Reply Last reply
    0
    • lorn.potterL Offline
      lorn.potterL Offline
      lorn.potter
      wrote on last edited by
      #2

      Hi,
      I haven't tested ssl support for a while now. Off the top of my head, you my need to play with build arguments of openssl. It looks like openssl might be using pthreads, which Qt WebAssembly does not use by default.

      What version of openssl are you using?

      In the meantime, if you could report this bug to Qt, that would be great!
      https://wiki.qt.io/Reporting_Bugs

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

      M 1 Reply Last reply
      0
      • lorn.potterL lorn.potter

        Hi,
        I haven't tested ssl support for a while now. Off the top of my head, you my need to play with build arguments of openssl. It looks like openssl might be using pthreads, which Qt WebAssembly does not use by default.

        What version of openssl are you using?

        In the meantime, if you could report this bug to Qt, that would be great!
        https://wiki.qt.io/Reporting_Bugs

        M Offline
        M Offline
        Mixlu
        wrote on last edited by Mixlu
        #3

        @lorn-potter hi and thanks for you reply

        openssl might be using pthreads, which Qt WebAssembly does not use by default

        Does that mean that I should build qt from source and enable thread support with the "-feature-thread" flag ? As the binary packages do not support multithreading.

        I am trying to link OpenSSL 1.1.1k, but if you know and other known good version I am interested.

        From the OpenSSL wiki, I see the no-threads option, I'll try and let you know.

        I think I will search a bit deeper before submitting a bug.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mixlu
          wrote on last edited by
          #4

          Building OpenSSL with the no-threads option solve the problem in my case.

          I don't really search deeper what is the consequences of that build option but maybe it can help someone ;)

          1 Reply Last reply
          0

          • Login

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