Questions tagged [emcc]

43 questions
1
vote
1 answer

Webassembly - Trying to compile a code buffer and execute it via EM_JS through C

I'm experimenting with webassembly and I've made a toy module that brute forces primes in C extern "C" { bool isPrime(int n) { for (int i = 2; i <= n; i++) { if (n % i == 0) return false; } return true; } int getPrimes() { …
uwuwuwu
  • 11
  • 1
1
vote
1 answer

Shared memory ('sys/shm.h') with emscripten

I've been exploring emscripten by trying to compile some basic wasm example that uses 'sys/shm.h' Here's the code I'm trying to compile: #include #include int main(int argc, char *argv[]) { key_t key = ftok("shmfile",65);…
waveburst
  • 11
  • 1
1
vote
1 answer

How to include library header when building with Emscripten?

I am trying to build codecbox.js on Ubuntu 18.04, which involves building FFmpeg with emcc. I have been stuck with the misleading libmp3lame >= 3.98.3 not found error. In my case, there is no problem with libmp3lame installation. After further…
1
vote
0 answers

Fatal: initialStackPointer must be set , shared:ERROR

I want to build bananabread c++ project with emscripten. I added BINARYEN_ROOT intro ./emscripten . I also build BINARYEN. LLVM_ROOT = '/Volumes/POMOCNI/WWW-HTDOCS/emsdk-demos/emsdk/emsdk/fastcomp/bin' EMSCRIPTEN_ROOT =…
Nikola Lukic
  • 4,001
  • 6
  • 44
  • 75
0
votes
0 answers

emmake: error: unable to find library -lTKernel

guys! I am trying to use emmake to compile a project containing OpenCascade api. When I used cmake .. and make commands, everying works fine! Note that I already installed OpenCascade on my machine. My CMakeLists.txt is as…
Rick.X
  • 513
  • 5
  • 10
0
votes
3 answers

How to convert a float to a half type and the other way around in C

How can I convert a float (float32) to a half (float16) and the other way around in C while accounting for edge cases like NaN, Infinity etc. I don't need arithmetic because I just need the types in order to fulfill the requirement of supporting…
juffma
  • 39
  • 5
0
votes
0 answers

Enabling C++ linkage for Emscripten compilation

EDIT: the linkage is for the #include directives for the .h files. I figured out that the error occurs when the same #include statements is declared twice in different .cpp files. I m trying to use Emscripten to compile my c++ project codes, but…
0
votes
0 answers

Compiling Nuitka C generated code into WASM

I am trying to compile Python code into C using Nuitka and then use emcc to compile the generated C code into WASM. I have successfully generated C code from a simple HelloWorld.py file using the following command: python -m nuitka --standalone…
guibvieira
  • 125
  • 1
  • 2
  • 11
0
votes
0 answers

Use the `emconfigure`, `emmake` command to compile it to a `.wasm` file

I am trying to build a cpp project into a wasm file using the command like this ./emcc test/hello_world.c -o hello.html from the link here. That works. However, when I am using a c++ project that has .configure file and the result creates multiple…
Gary
  • 2,293
  • 2
  • 25
  • 47
0
votes
0 answers

emscripten blocking and resuming main()

I am trying to basically imitate the cin functionality in a Wasm module taking the input of the user from an `. I am approach the problem defining an extern "C" function which I will then import into my c++ code from JS using the --js-library…
ddgg
  • 145
  • 1
  • 10
0
votes
1 answer

Passing JS functions to WASM

I am reading a beautiful book about WebAssembly, and I am trying to learn how to import JS functions into wasm without using "glue code". So this is the C file where 2 extern functions are declared extern int jsClearRect(); extern int…
ddgg
  • 145
  • 1
  • 10
0
votes
0 answers

Web Assembly, issue to apply 2000 functions in C++ and JavaScript (with for loop)

The program is showing an issue to send 2000 rows of text to C++ code in Web Assembly I tried to send all the content together and failed. I decided to send line by line, it sent only up to 1400 Maybe there is a better solution to check why it has…
Arthur
  • 1
  • 3
0
votes
0 answers

Can't create a WebAssembly module out of an MDL file using EMCC

I am trying to create a WebAssembly module out of an MDL file. I am following this tutorial: https://github.com/climateinteractive/SDEverywhere/tree/main/examples/hello-world The problem is that when I run the following command npm run dev I get…
nix86
  • 2,837
  • 11
  • 36
  • 69
0
votes
0 answers

How to set program name?

How to set program name/argument 0 (argv[0]) with emcc? For example, emcc hello.c -o hello.html with --set-name main*. This is not the same as setting Module.arguments (which changes arguments 1 and up, I want argument 0). in auto-generated…
jmpsabisb
  • 182
  • 1
  • 10
0
votes
1 answer

How to pass args to wasm?

I use emcc to complie a C++ code into js. But how to pass args to C++ code? #include int main(int argc, char** argv) { if (argc > 1) printf("%s", argv[1]); } build : emcc ./test.cpp -sENVIRONMENT=shell -o test.js pass commadline…
Enzo
  • 1