1,303 questions
0
votes
0
answers
78
views
Where is wgpu::EmscriptenSurfaceSourceCanvasHTMLSelector located?
I'm following this C++ WebGPU tutorial (with associated Git repo here) in another language, and so must rewrite the build script accordingly.
The tutorial calls wgpu::glfw::CreateSurfaceForWindow ...
0
votes
0
answers
49
views
ASM_CONSTS mismatch when building two wasm modules using Emscripten: one with -msimd128 and one without #25631
I'm attempting to build a wasm module with Emscripten once with -msimd128 -msse2 and have a fallback without. This uses the makeflags
ifeq ($(P_SIMD),1)
LINKFLAGS += -msimd128 -msse2 // later passed ...
0
votes
1
answer
60
views
Problem in compiling c++ codes including FFmpeg libraries using em++ into WebAssembly
When I try to compile FFmpeg to WebAssebly I got wasm-ld-13: error: unknown file type: demux.o, I configure and install FFmpeg (ffmpeg-8.0) using:
emconfigure ./configure \
--prefix=$(pwd)/installed ...
0
votes
0
answers
74
views
emrun "Uncaught DOMException: A network error occurred.", but static webserver works
Trying to learn some webassembly. I've got a minimum hello world:
#include <emscripten.h>
#include <stdlib.h>
#include <stdio.h>
int main() {
printf("hello world");
}
...
2
votes
1
answer
101
views
Implement a custom runtime memory manager with Emscripten & Wasmtime?
I am using WebAssembly to implement a sandboxed plugin system in a C application. Users can write plugins in any language that will compile to WASM, and we just say "you can import a, b, c ...
1
vote
0
answers
74
views
Practices of making a tree-shakeable library, having debug and release WASM builds
Background: I'm creating a JS library that has part of its functionality written in C++ source code, and thus compiles the C++ into WASM. The WASM is then imported by the library code and wrapped into ...
0
votes
0
answers
61
views
Why would changing the function signature cause my parameter to be overwritten?
I've been chasing this bug down to a minimal example, but even at this point I can't quite track down what must be the root cause.
I'm calling a C function compiled into WASM using Emscripten. I can ...
0
votes
1
answer
32
views
Running multiple invocations of WASM js
I have compiled a niche interpretter with WASM and the below works fine on the first function call. However any successive calls do absolutely nothing.
My understanding is WASM js made with ...
2
votes
1
answer
85
views
How to register a boolean type when compiling TypeScript bindings with Emscripten?
I have some Emscripten binding code (a self-contained, trivial example of which is shown below) that converts my C++ status_t return-value class into a boolean that JavaScript code can deal with ...
3
votes
0
answers
171
views
Why isn't wasm heap memory being freed when I return a vector by value?
Could someone please tell me why my WASM used heap size keeps growing every time I call genVector?
Note, this binding is a very simplified reproduction of the problem.
std::vector<uint8_t> ...
1
vote
0
answers
34
views
Replace the implementation of Emscripten built-in libraries
Emscripten allows users to provide their own libraries implemented from JS with the --js-library flag. Emscripten itself also provides custom implementations of several libraries, for example, OpenAL -...
0
votes
0
answers
73
views
emscripten & Webgpu - certain calls made from C++ ends up with a mangled name in Javascript
I'm using emscripten 3.1.59.
When I make webgpu calls, some of the calls made from C++ layer, results in a garbage string value in JS layer.
As an example, a call to wgpuInstanceCreateSurface.
When I ...
0
votes
0
answers
75
views
WASM: Calling embind functions with PROXY_TO_PTHREAD=1 is propagated to the main thread
I am writing a rendering app. I need it to run in a secondary thread in order not to interfere with UI.
My linker config is as follow:
-sINITIAL_MEMORY=134217728 -sMAX_WEBGL_VERSION=2 -sWASM=1 -...
1
vote
1
answer
143
views
How to use embind with a String class that isn't std::string?
Emscripten's embind mechanism seems to have pretty nice support for converting JavaScript's native strings to and from C++'s std::string automatically; however, the C++ library that I'm trying to ...
0
votes
0
answers
164
views
Stripping all unused/unwanted import and export methods from the WASM
While playing with Webassembly, during the tests I have noticed that the final WASM file has many functions that are most likely added by the Emscripten once the WASM is generated. However, all those ...
0
votes
0
answers
50
views
Catching Errors from WebAssembly in an Optimized Code
I think I need some human input here :) I have a simple CPP code:
#include <stdexcept>
#include <emscripten/bind.h>
using namespace emscripten;
double add(double a, double b)
{
if(...
4
votes
1
answer
800
views
(C/C++ DevTools Support (DWARF)) Loaded debug symbols, but didn't find any source files
I am developing a c++ WASM app. I often work with Chrome C/C++ DevTools(DWARF) extension to step into C++ source code during WASM debugging. A few days ago it was working fine. Now when loading WASM ...
0
votes
0
answers
51
views
HTTP request on thread
I've spent some days trying to run a HTTP request on a background thread (with -pthread / USE_PTHREADS), and im completely stuck
I have tried using Xhr, JS fetch, and finally emscripten_fetch, and ...
-1
votes
2
answers
94
views
How to set Makefile build order?
i am changing an existing makefile without much knowledge about makefiles. after reading into it i am supposed to be able to change the build order by
abc: x y z y : z
here in the makefile i want to ...
-1
votes
1
answer
915
views
C++ emscripten setup
I'm setting up a C++ program using Visual Studio 2022 and Emscripten.
I read that I should check if emcc is setup from my command line:
c:\Users\emcc -v
emcc (Emscripten gcc/clang-like replacement + ...
0
votes
1
answer
209
views
How correctly convert _mm_hadd_epi32 to equivalent C++ code (wasm_simd128.h) with Emscripten?
I have some code written with simd instructions to convert RGBA color data to grayscale data compiled to WASM thanks to Emscripten. It works fine and i hadn't any issues doing this. But i would make a ...
2
votes
1
answer
108
views
clang-19 and alignas new formatting
Prior to Clang 19, it was possible to write:
struct alignas(8) my_struct {
void* a_pointer;
int a_variable;
int _padding;
};
However, in Clang 19, you must write:
struct my_struct {
...
0
votes
1
answer
98
views
WASM - Emscripten - Can't run ccall, cwrap or FS but I can call methods directly
I've compile a c library to WASM via Emscripten. I'm working on Windows, however, the conversion was done on WSL running Ubuntu.
What I'm finding is I can access methods in the library directly as ...
0
votes
0
answers
43
views
Uncaught TypeError: Cannot read properties of undefined (reading 'ccall')
I had a web Project that used Emscripten to build c++ Code and use "Module.ccall.." to call my c++ function, the main feature is to render by using OpenGL ES, now I want to add MediaPipe's ...
1
vote
1
answer
79
views
It seems that ”ccache“ doesn't work with CMAKE_TOOLCHAIN_FILE “emscripten.cmake”
when I was trying to add "ccache" to my cmake program, no new files were added to my ccache directory.
cmake -B build_wasm -S . -DCMAKE_TOOLCHAIN_FILE=/emsdk/upstream/emscripten/cmake/...
0
votes
0
answers
27
views
How to use an auto debug macro in emscripten?
I am using emscripten to build a wasm project. I want to print some debug information, but do not want it print in release mode. So I write like this:
#ifdef __DEBUG
#define DBGprint(...) printf(...
1
vote
0
answers
95
views
Catch2 Test failure crashes test suite when compiled with Emscripten
I have a c++ project that I am compiling to WebAssembly via Emscripten. I would like to use Catch2 for running tests, but I notice that when a test fails, rather than the test suite finishing with a ...
1
vote
0
answers
217
views
WebAssembly module not initializing with Emscripten-generated JavaScript
I'm new to WebAssembly. Can you please help for the below issue? I was trying to get solutions from GitHub copilot but no luck.
I'm trying to create a minimal example of using WebAssembly with ...
1
vote
1
answer
121
views
Build OpenCV's Core & ImgProc using Emscripten & CMake
When trying to build OpenCV's core and imgproc modules ONLY using a custom emcmake command, the build will fail due to deprecated wasm related keywords upon using emmake ninja install
System: Windows ...
0
votes
1
answer
205
views
Using protofub in C++ when compiling to WASM with emscripten. Error compiling example from documentation
I need help figuring out a problem
I am rewriting part of the javascript library to wasm.
I compile the c++ code to wasm using this command: emcc idw.cpp -Oz -s WASM=1 -s --no-entry -o idw.wasm (...
1
vote
1
answer
195
views
Emscripten memory management of string return values
I wrote this simple piece of C code:
#include <string.h>
#include <emscripten.h>
EMSCRIPTEN_KEEPALIVE
const char * helloWorldStatic( ) {
return "Hello World from C";
}
...
0
votes
0
answers
90
views
Emscripten Multiply defined symbol, vtable
I have compiled a variety of LLVM Object files.
However, when linking them together, I get this error:
error: Linking globals named '_ZTV4CRpg': symbol multiply defined!
I debugged and found there ...
1
vote
0
answers
229
views
Load WASM module within Cloudflare Worker
I am having issues loading an Emscripten-generated WASM module with an interface called Lib for a Cloudflare Worker (using Hono and Wrangler). The export definition is within, sparks.d.ts, and it is ...
0
votes
0
answers
62
views
CPU Supports msse4_2, but Cannot Compile Emscripten Project With msse4_2 Flag
$ grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 suported"|| echo "SSE 4.2 not supported"
"SSE 4.2 suported"
But if I add flag -msse4.2 I get the following error:
...
0
votes
0
answers
154
views
Fetching data simultaneously with Emscripten
I am trying to use Emscripten to fetch and process a set of images. The approach below works well with a single image file, but it fails when fetching multiple images simultaneously, resulting in ...
1
vote
1
answer
98
views
Error "expected top-level entity" when using emsdk:3.1.64, but not when using emsdk:3.1.26
My code compiled when using emsdk:3.1.64, but not when using emsdk:3.1.26
emcc C:\test\hello_world.cpp -O3 -r -o C:\test\libar.bc && emcc C:\test\libar.bc -O3 -o
C:\testtest_wasm.js C:\...
0
votes
1
answer
128
views
Preloading binary file does not work as expected with emscripten
I have a binary file Tetris.ch8 which is 494 bytes. I am trying to open that file from my emscripten project. I used --preload-file to load the file. When I am trying to open the file and read the ...
1
vote
1
answer
313
views
Why am I getting different integer results for emscripten and native code?
On a native build, the following code prints -1. Compiled to WASM and run in node.js, it prints 4294967295. Why are the results different?
#include <iostream>
int main() {
unsigned F = 20;
...
0
votes
0
answers
187
views
Can somebody help me with emcmake error finding FindQt5.cmake
I am trying to build project on Ubuntu with this command:
emcmake cmake .. -DCMAKE_PREFIX_PATH=/home/oleksiy/Qt/5.15.2/wasm_32/
and get this error
CMake Error at CMakeLists.txt:16 (find_package):
...
0
votes
1
answer
143
views
Embed libsodium.js in Google Chrome Extension Manifest V3
I am trying to use libsodium.js, a C-library that has been transpiled to WASM with Emscripten.
I have found two (1, 2) related posts that are now out of date and/or incomplete:
This old issue ...
-1
votes
1
answer
984
views
Issue with Emscripten and CMake: em++ Not Able to Compile a Simple Test Program
I'm encountering a persistent issue when trying to build my project using Emscripten. Despite trying various common solutions, I haven't been able to resolve the error. The problem occurs during the ...
1
vote
1
answer
374
views
How to Use C++ WebAssembly in a React + Vite Project?
I'm trying to integrate a C++ WebAssembly module into my React project using Vite. However, I'm encountering issues with the module not being recognized correctly. Here are the details of my setup:
...
0
votes
0
answers
40
views
Create a mmap-able index of a tar to load in WASM
We want to load contents of a tar file in WASM using the emscripten VFS packaging format. Right now we convert the tar file on the server into a data and metadata files according to the above VFS ...
2
votes
1
answer
117
views
What is the entropy source for this C function when compiled to .wasm using emscripten?
static inline void ed25519_randombytes(unsigned char *x,unsigned long long xlen)
{
int i;
if (ed25519_random_fd == -1) {
for (;;) {
ed25519_random_fd = open("/dev/urandom",...
0
votes
2
answers
76
views
Assertion Failed: Compiler flags to be set for a linker in qmake file of qt, so that we won't get Uncaught Runtime error , after main() function exits
I am trying to expose a UI (built using qt) on the browser, using Emscripten. Compiled dependencies, and could able to link those to the UI, it got compiled successfully without any errors, but while ...
1
vote
1
answer
680
views
Compiling Raylib-Rust game to WASM
I've successfully compiled my game to WASM with the flags:
EMCC_CFLAGS="-sUSE_GLFW=3 -sGL_ENABLE_GET_PROC_ADDRESS -sASYNCIFY -sASSERTIONS --preload-file src/resources" cargo build --release -...
1
vote
0
answers
83
views
Issues with building Speed Dreams using Emscripten
I'm a bit confused on how to build Speed Dreams, an open source racing game, with Emscripten (to port it to the web). When building with 'emcmake cmake' (emscripten's cmake toolchain), the building ...
1
vote
0
answers
357
views
Is it possible to webassembly a C++ Windows application using emscripten:
I have a complex windows application that uses MFC and some OpenGL.
I'd like to use Webassembly https://github.com/emscripten-core/emscripten
to use emscripten to convert the c++ application to web.
...
0
votes
0
answers
89
views
emscripten_request_pointerlock() returns EMSCRIPTEN_RESULT_UNKNOWN_TARGET
I have made an example that calls emscripten_request_pointerlock("screen", false); by mouse click:
void mousePressEvent(QMouseEvent *event) override
{
EMSCRIPTEN_RESULT result = ...
0
votes
1
answer
277
views
Module.requestFullscreen is not a function in Emscripten
When compiling to WebAssembly using Emscripten, Emscripten gives you .wasm file, a .html file and a .js file. The html file, it seems, is set up to give a basic demonstration of the workings of ...