openzim / openzim/javascript-libzim

Compile without Atomics / POSIX threads / pthreads

Open
#43 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build
Dominant language
JavaScript
Stars
5
Forks
2
PR merge metrics
No merged PRs in 30d

Description

The main reason why reading a ZIM archive with libzim fails with the current build in older browsers is that somewhere in the build chain one or more of the binaries has been compiled with pthreads (Atomics). As we will never write or modify data (the main reason for atomic operations), it should be possible to do without them at least for a specific JavaScript (ASM) build targeting older browsers (#17).

@mgautierfr Is this something you're aware of in the libzim build chain? Any clue as to where pthreads are being required?

In JavaScript, the pthreads translate into JavaScript Atomic operations, which are not available in a wide range of potential targets. E.g., although Atomics are supported in latest Chromium and Firefox (desktop), they fail on: Safari (both on Mac OS and on iOS, as well as any other browser on iOS), on EdgeHTML (used still in UWP app webview), on ESR versions of Firefox, and on Internet Explorer (despite the fact that we can compile to ASM, which would be supported by IE11 were it not for the Atomics requirement). Any Android browser other than those based directly on Chromium also fail.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace the libzim build chain for the JavaScript outputs and identify where pthreads or Atomics are introduced. Compare the WASM and ASM targets, then verify that an ASM build without pthreads works for the older browsers listed in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, wasm
Domain
build-system, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.