-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Please include the following in your bug report:
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.46 (1960782)
clang version 18.0.0 (https://github.com/llvm/llvm-project 75501f53624de92aafce2f1da698b249a7293dc7)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: C:\emsdk1\upstream\bin
I downloaded the entire emscripten project from github on 2023/9/28, the compiled xxx.wasmmodule.js by this new version came out a problem after being loaded: Uncaught Error: Converting base64 string to bytes failed.
I locate the problem and compare it with the emscripten I downloaded on 2022, in xxx.wasmmodule.js, the 2023 version is
// include: base64Utils.js
// Converts a string of base64 into a byte array.
// Throws error on invalid input.
function intArrayFromBase64(s) {
try {
var decoded = atob(s);
var bytes = new Uint8Array(decoded.length);
for (var i = 0 ; i < decoded.length ; ++i) {
bytes[i] = decoded.charCodeAt(i);
}
return bytes;
} catch (_) {
throw new Error('Converting base64 string to bytes failed.');
}
}
the 2022 version (which is no error) is
// Converts a string of base64 into a byte array.
// Throws error on invalid input.
function intArrayFromBase64(s) {
try {
var decoded = decodeBase64(s);
var bytes = new Uint8Array(decoded.length);
for (var i = 0 ; i < decoded.length ; ++i) {
bytes[i] = decoded.charCodeAt(i);
}
return bytes;
} catch (_) {
throw new Error('Converting base64 string to bytes failed.');
}
}
and emcc -v of the 2022 version is
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.7 (48a16209b1a0de5efd8112ce6430415730008d18)
clang version 15.0.0 (https://github.com/llvm/llvm-project fbce4a78035c32792b0a13cf1f169048b822c06b)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: C:\emsdk\upstream\bin
the compile command is like
emcc -lembind `
source/xxx `
-o dist/xxx.wasmmodule.js `
-I xxx `
-O1 `
-s TOTAL_MEMORY=128MB `
-s SINGLE_FILE=1 `
-s BINARYEN_ASYNC_COMPILATION=0 `
-s ENVIRONMENT=web `
-s EXPORT_NAME=xxx `
-Wno-c++11-narrowing -Wno-implicit-function-declaration `
--post-js thirdparty/em-es6-module.js