Open ofTheo opened 1 year ago
tried with the latest mingw64 msys2 nightly now that the emscripten libs are there
In the mingw64 shell these steps worked:
# Get the emsdk repo
git clone https://github.com/emscripten-core/emsdk.git
# Enter that directory
cd emsdk
# Download and install the latest SDK tools.
./emsdk install latest
# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
./emsdk activate latest
# needed for mingw64 - NOTE: the other two env files don't work
./emsdk activate latest --permanent
Then when I try and make an example with:
emmake make
I get an error showing that the CXX
is being set to the emscripten c++ path without the forward slashes.
ie: it is showing like:
CUserstheoemsdkupstreamemscriptenem++.bat
instead of:
/C/Users/theo/emsdk/upstream/emscripten/em++.bat
Not sure if it is our make files that is passing the CXX like that or emmake. I think it will work if we can get the CXX compiler path set.
cc @oxillo
hmm looking at this issue seems to imply that on mingw64 you need to call a different make command: https://github.com/emscripten-core/emscripten/issues/2005
emmake mingw64-make
@ofTheo with make
I get the same error. with mingw32-make
i get this error:
make: C:\msys64\mingw64\bin\mingw32-make.exe
Compiling OF library for Release
mingw32-make[1]: Entering directory 'C:/Users/Jonat/Desktop/of_v20230427_vs_release/libs/openFrameworksCompiled/project'
/usr/bin/sh: -c: line 2: syntax error: unexpected end of file
mingw32-make[2]: *** [makefileCommon/compile.core.mk:233: C:/Users/Jonat/Desktop/of_v20230427_vs_release/libs/openFrameworksCompiled/lib/emscripten/obj/Release/.compiler_flags] Error 2
mingw32-make[1]: *** [makefileCommon/compile.core.mk:204: Release] Error 2
mingw32-make[1]: Leaving directory 'C:/Users/Jonat/Desktop/of_v20230427_vs_release/libs/openFrameworksCompiled/project'
mingw32-make: *** [C:/Users/Jonat/Desktop/of_v20230427_vs_release/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:125: Release] Error 2
emmake: error: 'C:\msys64\mingw64\bin\mingw32-make.exe' failed (returned 2)
@ofTheo I got Emscripten running on Windows with the wsl Linux subsystem. I followed this description: https://www.codeproject.com/Articles/5160967/Bring-Your-Cplusplus-Code-to-the-Web
@Jonathhhan did you use the mingw OF nightly to do it? is it possible to document exactly what additional steps you had to do ?
We could then add it to the setup guide.
Thanks so much! Theo
@ofTheo I used the linux64gcc6 nightly.
This is what I did (partly copied from https://www.codeproject.com/Articles/5160967/Bring-Your-Cplusplus-Code-to-the-Web):
Before we can install Ubuntu from Microsoft, we must first enable Developer's mode and WSL. To enable Developer mode, head to Settings > Update & Security > For Developers and select “Developer mode”.
Next, WSL has to be enabled on Windows Features. In the Windows searchbar, type "Turn Windows Features On or Off" and select that option. Scroll all the way down and check the "Windows Subsystem For Linux" option.
Next, launch Microsoft Store by clicking its button on the taskbar. Search for "Ubuntu" and click "Install" on the Ubuntu 22.04 in the search result. It takes about 5 minutes.
Start wsl in the terminal and add a Ubuntu user.
sudo apt update sudo apt upgrade git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
sudo apt install make
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt install ./google-chrome-stable_current_amd64.deb
sudo apt-get install pkg-config sudo apt-get install gcc cd /mnt/c/Users/Jonat/Downloads/of_v20230809_linux64gcc6_release/scripts/linux/ubuntu (your own path) sudo bash install_dependencies.sh
Thanks @Jonathhhan
Ahh I see you end up essentially using the ubuntu OF release to run emscripten.
I was hoping it would enable it via the windows OF downloads :)
I found this https://github.com/nokotan/VSExtForEmscripten worth checking out.
also note the official website says to install linux on your windows box to compile things
@danzeeeman I can confirm that it works well with windows subsystem for windows.
@ofTheo if we can configure the VS project for emscripten build it should work with that extension
On MSYS2, I've managed to go to the linker step following the instructions :
pacman -Sy mingw-w64-ucrt-x86_64-emscripten
$OF_ROOT\script\emscripten\download_libs.sh
emmake make
...Hello everyone. I just tried to to build an openframeworks app with emscripten on windows. I didn't achieved to make it work, during the emmake make
I've a bunch of errors. I'm too much beginner in Of and emscripten to understand if I did something wrong or if it's just not supported at the moment. Do you know what is the status of it ? Is compiling a openFramework app to wasm is supposed to work ? I'm using visual studio by the way
hi @guillaume-leo , Can you please post the errors you get?
I uninstall everything, I would like to make a new clean install of everything. @roymacdonald do you know which instructions I should follow to compile my oF project with emscripten (with visual studio) ?
Yeah just run a git bash in the folder and run: emake make
Need environment variables set for emscripten full path
You can basically just build your app in VS2022 editor, then build it for emscritpen via command line and look at output html5. I think there’s some scripts to help build for the template from the project generator in the PR I did with updates for libs
I had the projectGenerator concept of adding option for em make, env location set in extra options and it would call Run script. But then I tried to make the system more secure cause it was, running and executing bash scripts, and was vulnerable so, I’ll try and recover the branch and finish that next week!
On Fri, 18 Oct 2024 at 11:39 pm, guillaume-leo @.***> wrote:
I uninstall everything, I would like to make a new clean install of everything. @roymacdonald https://github.com/roymacdonald do you know which instructions I should follow to compile my oF project with emscripten (with visual studio) ?
— Reply to this email directly, view it on GitHub https://github.com/openframeworks/openFrameworks/issues/7484#issuecomment-2422382677, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGK2HDXWUCGEXWVIP2J3PDZ4D6PRAVCNFSM6AAAAABQDLFD3SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRSGM4DENRXG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>
so when I tried the command I've an error
PS C:\of_12\apps\myApps\mySketch> emmake make
make: C:\ProgramData\mingw64\mingw64\bin\mingw32-make.EXE
mingw32-make.EXE: *** No targets specified and no makefile found. Stop.
emmake: error: 'C:\ProgramData\mingw64\mingw64\bin\mingw32-make.EXE' failed (returned 2)
I suppose that it's because I'm not using oF with msys2 64bit
? But I don't want to, my setup is working correctly with visual studio 2022, I can build and run a openframeworks app like that.
I tried also this:
emcc src/main.cpp
I got an error:
'ofMain.h' file not found
I think it’s emmake make Release
No rule to make target 'release'. Stop. @ofTheo I'm going to investigate a bit more
@guillaume-leo did you try @oxillo's steps in this thread?
And did you make sure to do: source ./emsdk_env.sh
( you might need the full path to this file ) before you run the emmake commands?
Not sure if it works with Visual Studio compiler, but we should at least try it with msys2 / mingw64
relevant thread: https://forum.openframeworks.cc/t/webview-of-integration-how-to-dispatch/40464/16