Skip to content

Released web bindings are incompatible with newest emscripten #1593

@jessesna

Description

@jessesna

Maybe this is more of a info than a bugreport because it's already common knowledge but i couldn't find any info about the constraints of the released file and hope it might help someone?

I'm on Windows and couldn't get a language compiled with emscripten to work together with the tree-sitter.js and tree-sitter.wasm files from the latest GitHub release as described here with some basic test code:

const Parser = require('web-tree-sitter');
Parser.init().then(() => {
    (async function(a, b) {
        const language = await Parser.Language.load('tree-sitter-g_code_sinumerik.wasm');
        const parser = new Parser;

I always got the error

Assertion failed: undefined
node_modules/web-tree-sitter/tree-sitter.js:1
Uncaught RuntimeError: abort(Assertion failed: undefined). Build with -s ASSERTIONS=1 for more info.

Turns out this is because the emcc i'm using

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.0 (8e1e305519e1027726a48861a1fec5662f7e18a2)

is too new or because i'm on windows?

When i compare a wasm i get through npm install, f.e. tree-sitter-javascript.wasm with my own, there's a difference in the dylink secion.
The former is at

wasm-objdump -h tree-sitter-javascript.wasm
tree-sitter-javascript.wasm:    file format wasm 0x1
Sections:
   Custom start=0x0000000a end=0x00000018 (size=0x0000000e) "dylink"

and mine at
Custom start=0x0000000e end=0x0000001e (size=0x00000010) "dylink.0"

After rebuilding tree-sitter.js and tree-sitter.wasm the error disappeared because the checks done in loadModule (they look like these here at line 370 ff) now match the expectations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy