lord / wargo

Easy Rust to WebAssembly
MIT License
261 stars 9 forks source link

Work even if default python points to python 3 #9

Open lord opened 7 years ago

lord commented 7 years ago

Someone on reddit points out that we should work even if the system python points to 3, as long as there's a python2 or python2.7 installed.

vinc commented 7 years ago

I'm using Arch Linux:

$ python --version
Python 3.6.2
$ python2 --version 
Python 2.7.14

https://wiki.archlinux.org/index.php/Python

vinc commented 7 years ago

I think that emsdk is supposed to work with Python 3, but the version that setup.js is downloading from https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz has a bug preventing that.

There's an open issue related to this problem at https://github.com/juj/emsdk/issues/103

And indeed it works if I clone the master:

$ git clone https://github.com/juj/emsdk ~/.emsdk
$ cd ~/.emsdk
$ ./emsdk install sdk-1.37.22-64bit
Fetching all tags from Emscripten Github repository...
Done. 109 tagged releases available, latest is 1.37.22.
Fetching all tags from Binaryen Github repository...
Done. 36 tagged Binaryen releases available, latest is 1.37.22.
Fetching all precompiled Nightly versions..
...
lord commented 7 years ago

:+1: nice find, thanks! I'll update the script next chance I get.

zeta0134 commented 7 years ago

It doesn't look like this has been fixed in wargo / upstream quite yet, but a quick method to bypass the issue on Arch Linux and other distros defaulting to python3 is to override the python version using a local PATH environment variable change, detailed here:

https://wiki.archlinux.org/index.php/python#Python_2

mkdir ~/bin
ln -s /usr/bin/python2 ~/bin/python
ln -s /usr/bin/python2-config ~/bin/python-config
export PATH=~/bin:$PATH

With this workaround in place, wargo successfully builds for me on Arch Linux, and it's limited to the current shell so it doesn't hose anything else on the system.