Converting code to Javascript with Emscripten

Hello All,

I recently finished my project and would like to convert my code to JavaScript so that I may embed my project in a website.

I’m trying to use the OpenFrameworks guide found here to transpile my code. I have successfully installed emscripten (I think) following the guides instructions using git.

Now when I open the git terminal in the project file, and run the command ‘emmake make’ the git terminal says “bash: emmake: command not found”

Anyone know whats wrong? Is the guide outdated? Is it not compatible with my setup?

I’m on a windows machine and the project was coded in Visual Studio 2019.

I’m very new to emscripten and git so its possible I made a rookie mistake that isn’t covered in the guide.

Any help would be appreciated, thanks!!

Hi, I think that emmake comes with the install of emscripten. I am not sure if it will get installed in the git terminal or not. I’d say, first try to install emscripten on your system as it is recommended by them (emscripten people) and once you’ve gotten it to work try it with of. hope this helps somehow.

I’ve just tried that, unfortunately it didn’t work. I’m navigating to the folder and opening the git terminal like so (see attached):

. I think the issue might be that I’m not initializing / calling on the emscripten function / emsdk folder first? so when I type ‘emmake make’, the terminal has no idea what I’m talking about.

That or perhaps there is a windows equivalent command for the ‘emmake make’. I suspect the guide may have been written for Mac users.

Ok, so I think I was on the right path when I was talking about calling on the emsdk folder, when I enter the git terminal in emsdk directory, and then specify the folder and then try the “emmake make” command, I’m greeted with a different error message: “too many arguments” (see Attached).

Anyone know what I’m doing wrong?

you are trying to run 2 commands in a single line.
cd stands for Change Directory and it requires 1 argument, which is the directory to which you want to change. The rest you have should go as a different command.
and you only need to cd to the same folder once

yet, you already mentioned that you got the error command not found, which means that emmake is not installed in that system, or it is inaccessible through the git terminal

So I think I figured out how to use the ‘emmake make’ command. So I was correct on how to open the terminal (see first photo of post). Once you do that, you actually have to navigate to the “make” command in the emscripten folded, copy the file location, and input it into the terminal like so: Now, I get a new error (See Attached) :

Apparently the python file has some syntax errors thus haulting the operation.

The issue is, when I open the make python file in visual studio, there are no syntax errors (See Attached). I’m not sure why the “make” command isn’t working. Anyone have any ideas?

Good you found it. You can permamently add those export commands to the CLI so you dont have to type it each time you want to. Look here You either create a .bashrc or .bash_profile file in your home directory and just paste the export lines there, save and quit and open git bash.

As of the python, I am not sure, it looks fine but there might be a tab or some indenting before the first line which is messing up the whole script.

quick update, i found that when typing python before the command I get different errors as seen below:

Not sure what to do at this point. Anyone have any other suggestions?

@arturo I read from this article you worked on the emscripten project right? Do you know whats going on?

you can found more/some helping on this topic or in the forum ems category:

Thanks for showing me this, it pointed me into the right direction.

1 Like

Quick Update. I realized its best to install emscripten and run its commands through WSL (Windows Sub-System for Linux, lets you run Linux commands on windows). After going through the setup and configuring python environmental variables I navigate to the project folder in the WSL terminal and run the command “emmake make”. Then I get this error (See Attached). To my knowledge, for emscripten to work a MAKE file needs to be accompanied by the project. Anyone know how I can generate a Make file for an existing project? Or do I need to edit the addons.make file?

Hello All,

Huge Update: I finally was able to get the ‘emmake make’ command to work on Windows (I plan on writing an indepth guide and posting it to the forum if it hasn’t been done already). When I use emrun to run the html file I get this thought? Anyone know whats causing this issue?

At first I thought it was my code so I compiled the examples and got the same result as well. This is what the inspect element console says: