Questions tagged [emcc]

43 questions
11
votes
3 answers

Is there a way to use C++ in JavaScript?

From this, I found out that JavaScript is written in C++. I also have found out/deduced that a majority of JavaScript is C++ (e.g. Math.atan+"" and Math.atan.toString() yielding "function atan() { [native code] }"). The [native code I assume to be…
Conor O'Brien
  • 987
  • 2
  • 16
  • 40
4
votes
1 answer

WebAssembly LinkError: _sprintf function import requires a callable

Creating the WebAssembly.Instance in JS from a Emscripten compiled WASM which included a call to sprintf, results in this error: Uncaught (in promise) LinkError: WebAssembly.Instance(): Import #1 module="env" function="_sprintf" error: function…
Terry
  • 95
  • 9
3
votes
1 answer

Bazel target compiles in gcc but fails in emscripten

I am building a system using Bazel where I have a C++ target and an emscirpten (emcc) target to compile to web assembly. Both depend on "myAPI", which has external dependencies libpng, libz, opencv and some others. This compiles properly: #…
Harry R.
  • 751
  • 1
  • 5
  • 11
3
votes
1 answer

webassembly (C) How can I create configuration files?

I would like to create configuration for my webassembly app. It just needs to be able to store some key-value pairs: whether it's JSON, XML, .cfg, .csv or .txt any will do. Is it possible to do this with webassembly? Do I need to serve the config…
Neil
  • 3,020
  • 4
  • 25
  • 48
2
votes
1 answer

Unable to import compiled javascript file from Emscripten for WebAssembly (C++ wrriten) to React

Hi I've compiled the C++ file via emcc (emscripten frontends). The output I expected is one .wasm file and .js file to implement javascript. I build React application which try to import WebAssembly via .js module like below. (./wasm/dist/my-module…
2
votes
1 answer

wasm-ld: error: initial memory too small, 18317952 bytes needed

I want to compile ffmpeg to wasm.After downloading FFMPEG and emsdk source code,I used command below to build. emconfigure ./configure --cc="emcc" --enable-cross-compile --target-os=none --arch=x86_32 --cpu=generic \ --disable-ffplay…
mengzz
  • 71
  • 1
  • 5
2
votes
1 answer

EM_JS can't export functions in emscripten

If I use the emscripten interface, EM_JS the symbols don't seem to be exported or anything. If I use the following C code: #include #include //Function in Javascript Land extern void writeout( int o ); EM_JS(void,…
Charles Lohr
  • 695
  • 1
  • 8
  • 23
2
votes
0 answers

Has anyone tried to compile OpenBLAS to Webassembly using clang/emcc?

In the OpenBLAS root directory on a linux system, with emcc sdk already loaded by (in the emsdk directory, source ./emsdk_env.sh) I was trying to use emcc to compile OpenBLAS by make CC=emcc NOFORTRAN=1 HOSTCC=emcc BINARY=64 libs, but it complained…
Chen
  • 188
  • 2
  • 11
2
votes
2 answers

How to set gcc flags in Emscripten

I compile with the following command: gcc -Wall -march=native -O3 -ffast-math -I/usr/local/include -I/usr/local/include -o waon main.o notes.o midi.o analyse.o fft.o hc.o snd.o -L/usr/local/lib -L/usr/local/lib -lfftw3 -L/usr/local/lib -lsndfile…
Bob van Luijt
  • 7,153
  • 12
  • 58
  • 101
1
vote
0 answers

missing when compiling emscripten

I tried compiling a game I made with glut using RakNet in C++. But whenever try to compile it for browser. I get this error: lib/RakNet/Source/FileList.cpp:24:10: fatal error: 'sys/io.h' file not found #include ^~~~~~~~~~ 1 error…
bonii
  • 71
  • 1
  • 9
1
vote
1 answer

EXPORTED_FUNCTIONS ignored during emcc compilation

I'm trying to learn how to compile CPP into WASM and I can't seem get it to work properly. I have a simple CPP code that implements a squarer function which squares a given integer: #ifdef __EMSCRIPTEN__ #include #endif int…
user92563
  • 11
  • 2
1
vote
1 answer

Why are the WASM files different?

I want to use WebAssembly, so i have to compile C file to WASM file. The contents of the C file are as follows //The online 'add.c' WASM_EXPORT int add(int a, int b) { return a + b; } It's a very simple C file. This WASM file is compiled by…
Aves_LH
  • 11
  • 2
1
vote
1 answer

How to control where the canvas is placed in the document?

I have a C++ application with a UI that I converted to JS using emcc. The UI of this application takes the form of a canvas on the web page and is appended to the body. How can I control where the canvas is appended? What if I want the canvas to be…
Maxime Dupré
  • 5,319
  • 7
  • 38
  • 72
1
vote
1 answer

emcc won't run on Mac OSX 10.15, clang-10: error unknown argument: '-fignore-exceptions'

I have a simple hello.c file with the following contents: #include #include #include int main() { printf("hello wasm\n"); } I am trying to compile this into a .html with emscripten emcc command using: emcc…
suraj
  • 581
  • 7
  • 17
1
vote
2 answers

Why do I get "unsupported shader version" using "#version 300 es" at emscripten?

I don't know why I get a "unsupported shader version" error message using #version 300 es in my vertex shader with the latest emscripten 1.39. With #version 100 it works fine. const GLchar* vertex_shader_code[] = { "#version 300 es\n" …
PowerNow
  • 363
  • 1
  • 2
  • 15
1
2 3