sql-js / sql-js/sql.js

Compile to wasm produces undefined stackAlloc [error]

Offen
#190 1 Kommentar 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
JavaScript
Sterne
13.7k
Forks
1.1k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hello, I am trying to compile and run using native wasm. I updated Makefile like so:

wasm/debug: EMFLAGS= -O1 -g -s INLINING_LIMIT=10 -s RESERVED_FUNCTION_POINTERS=64 -s WASM=1
wasm/debug: js/sql-debug.js

I'm loading a module into sql-debug.js following the pattern in emscripten generated html output:

here is a gist with a few more details.

errors:

#chrome Version 57.0.2984.0 dev (64-bit)
Uncaught TypeError: Cannot read property 'apply' of undefined
    at Object.Module.stackAlloc (sql-debug.js:6069)
    at sql-debug.js:6388
    at sql-debug.js:7229
    
#firefox 54.0a1 (2017-03-06) (64-bit)
TypeError: Module.asm.stackAlloc is undefined[Learn More]

if stackAlloc is left undefined by doing this in sql-debug.js

//original 
var stackAlloc = Module["stackAlloc"] = function() { return Module["asm"]["stackAlloc"].apply(null, arguments) };

//edit 
var stackAlloc = Module["stackAlloc"] = function() { return Module["stackAlloc"].apply(null, arguments) };

then this is executed in index.html before errors are thrown when stackAlloc is called to execute SQL.

var sql = window.SQL;
 // Create a database
var db = new sql.Database();
// NOTE: You can also use new sql.Database(data) where
// data is an Uint8Array representing an SQLite database file

// Execute some sql
sqlstr = "CREATE TABLE hello (a int, b char);";
sqlstr += "INSERT INTO hello VALUES (0, 'hello');"
sqlstr += "INSERT INTO hello VALUES (1, 'world');"
db.run(sqlstr); // Run the query without returning anything

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Start by comparing the wasm/debug flags in Makefile with the generated exports and Module.asm.stackAlloc usage in sql-debug.js. Reproduce the failure using the index.html example and the browser errors; done means the wasm module loads and the Database/SQL example runs without the undefined stackAlloc error.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, sqlite, wasm
Bereich
build-system, databases, web-dev
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.