Build Postgresql driver for Webassembly

  • Hello all and thanks for your suppot,

    I was working on a QT application and intended to try to build it for webassembly.

    I followed the instructions here "" and was able to build qt using emscripten.

    Since my application uses Postgresql, I have to build the drivers for webassembly as well, this is where things got confusing, I tried to follow the instructions here "":

    "cd $QTDIR/qtbase/src/plugins/sqldrivers
    qmake -- PSQL_INCDIR=/usr/include/pgsql
    make sub-psql"

    where "qmake" is the one resulting from the emscripten build

    but running "make sub-psql" results in a message:
    "Project ERROR: No module claims plugin type 'sqldrivers'
    Makefile:44: recipe for target 'sub-psql' failed"

    Appreciate your help.

    Best Regards,

  • Lifetime Qt Champion


    I haven't used that module yet but the first thing I would check is whether PostgreSQL has libraries for WASM.

  • Hello SGaist,

    Thanks for your response.

    Let me make sure I understand, the commends :
    qmake -- PSQL_INCDIR=/usr/include/pgsql
    make sub-psql"

    builds the SQL library of Qt, but it requires the driver APIs to be compatible, but what I did is that I provided PostgreSQL include path that is a desktop build not emscripten, so the qmake script recognized that and failed ?

    If that's the case, would building PostgreSQL using emscripten be an alternative ? I looked online for a ready build but couldn't find something that seemed mature.

    Appreciate your help.


  • Let me ask another question, is there a different SQL database solution that would allow me to port my application to WASM with minimal overhead ?


  • @YasserFathy
    So far as I understood, QtSql is not supported (yet?) in WASM, that would include even SQLite. @lorn-potter would be your expert, if he happens to see this.

  • Thanks Jon, hope he sees it.

Log in to reply