emscripten-core / emsdk

Emscripten SDK
http://emscripten.org
Other
3k stars 682 forks source link

TypeError: Failed to execute 'createObjectURL' on 'URL': Overload resolution failed. #1398

Open Yidasvc opened 3 months ago

Yidasvc commented 3 months ago

I use pthread support of emcc. Compiler generated .worker.js as WebWorker routine. In .worker.js, createObjectURL was called with its old usage. However, old usage has been removed from browser engine. 截屏2024-06-07 23 18 57 Old usage:

URL.createObjectURL(blob);

New usage:

URL.createObjectURL(new Blob([blob],{type: 'application/zip'})); // value of "type" should be MIME type.

Compile command:

em++ main.cpp -O3 -s WASM=1 -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=2 -o $(WASM_JS)

main.cpp:

#include <stdio.h>
#include <emscripten/emscripten.h>
#include <pthread.h>

void* EMSCRIPTEN_KEEPALIVE routine(void* param){
    printf("Routine\n");
    return NULL;
}

int main(int argc, char **argv)
{
    printf("Hello WASM\n");
    pthread_t pthread;
    pthread_create(&pthread, NULL, routine, NULL);
    pthread_join(pthread, NULL);
}

Error in chrome console: 截屏2024-06-07 23 17 37

sbc100 commented 3 months ago

This code path changes at lot in 3.1.58 (the worker.js file was actually removed completely). Can you try rebuilding and see if you are still effected?