sql-js / sql-js/sql.js

Compile to wasm produces undefined stackAlloc [error]

Đang mở
#190 1 bình luận 3 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
JavaScript
Star
13.7k
Fork
1.1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, sqlite, wasm
Lĩnh vực
build-system, databases, web-dev
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
30/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.