[Development] wasm and static vs. shared libs

Lorn Potter lorn.potter at gmail.com
Wed Oct 2 00:02:01 CEST 2019


Hi Martin,


On 1/10/19 4:38 PM, Martin Koller wrote:
> Hi,
> 
> I see that compiling Qt for wasm produces .a static libs.
> This however leads to a couple of duplicate symbols when linking my existing large application.
> 
> Here
> https://emscripten.org/docs/compiling/Building-Projects.html?highlight=link#archive-a-files
> I read
> "Where possible it is better to generate shared library files (.so) rather than archives (.a) — this is generally a simple change in your project’s build system. Shared libraries are simpler, and are more predictable with respect to linking."
> 
> so my question is: why does qt/wasm not allow to be built as -shared ?


https://github.com/emscripten-core/emscripten/wiki/Linking


Probably my main concern is the performance hit of dynamic linking. 
5-10% performance hit did not seem like an acceptable trade-off to me. 
Not sure if the performance drop is different for running wasm instead 
of the javascript like when this was first started.

As well, getting the build system to behave is easier in wasm with 
static libraries.

That said, there is a task for wasm dynamic linking support, but has not 
been worked on recently, and the WIP change is out of date.

https://bugreports.qt.io/browse/QTBUG-63925


-- 
Lorn Potter
Freelance Qt Developer. Maintainer QtSensors, Qt WebAssembly



More information about the Development mailing list