Emsdk must be set up by
$ source ../emsdk/emsdk_env.sh --build=Release
When trying to use SDL ala
$ emcc hello_sdl.c --emrun --preload-file font -s USE_SDL=2 -s USE_SDL_TTF=2 -o hello_sdl.html
Got python error
system_libs:INFO: retrieving port: sdl2 from https://github.com/emscripten-ports/SDL2/archive/version_21.zip
Traceback (most recent call last):
File "/Users/nathan/Downloads/emsdk/upstream/emscripten/tools/system_libs.py", line 1845, in retrieve
import requests
ModuleNotFoundError: No module named 'requests'
So… need to install requests module for python. How to do that?
$ pip install requests
Wrong! emcc is really running Python 3.7 which you already had installed (or was installed on this version of macOS) with its own version of pip available as pip3. So
$ pip3 install requests
Worked.
Ignore the following:
But need pip, so first (via https://ahmadawais.com/install-pip-macos-os-x-python/)
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.py
And we need to add our local python bin to $PATH in our zsh profile:
export PATH=$PATH:/Users/nathan/Library/Python/2.7/bin
end ignore