[osg-users] Building for platform without threads?

OpenSceneGraph Users osg-users at lists.openscenegraph.org
Wed Apr 1 09:12:06 PDT 2020


Hi, Phil,

I have a small sample with single threaded osgViewer that might help
you: https://github.com/OGStudio/openscenegraph-cross-platform-guide/tree/master/1.10.SampleWeb
OSG sources host the same Emscripten sample. Though, compile time
flags might need just a bit of tweaking (see
openscenegraph-cross-platform-guide open issues).

Regards,
Michael.

On Tue, 31 Mar 2020 at 02:35, OpenSceneGraph Users
<osg-users at lists.openscenegraph.org> wrote:
>
> The issue is actually before anything runs, it’s link-time errors (in this case, linking the compiled WebAssembly). OpenThreads uses the standard FindThreads.cmake module, which in the case of WebAssembly still finds the pthreads headers, but at link time no pthreads libraru is available so the pthreads symbols can’t be resolved.
>
> I don’t recall if I mentioned earlier, but the multi-threaded version works just fine in multi-threaded WebAssembly. This depends on SharedArrayBuffer support in Javascript, which has been disabled in many browsers to mitigate spectre-style attacks. So I’m trying to support the single-threaded case as well to support those browsers. This is primarily on mobile platforms.
>
> I guess to build a usable single-threaded version, what is needed is a patch to OpenThreads to ignore all pthreads headers, and effectively stub-out some of the methods. In single-threaded WebAssembly there are apparently still gcc-style internals available for atomics, so it wouldn’t be necessary to create new code for all stubs.
>
> Kind regards,
> Phil.
>
> > On 30/03/2020, at 10:22 PM, OpenSceneGraph Users <osg-users at lists.openscenegraph.org> wrote:
> >
> > Hi, Phil,
> >
> > when you run single threaded osgViewer, you have single thread. Which
> > browsers don't like that and why?
> >
> > Regards,
> > Michael.
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


More information about the osg-users mailing list