Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use the compiled WASI artifacts? #85

Open
AlmogBaku opened this issue Jun 29, 2022 · 4 comments
Open

How to use the compiled WASI artifacts? #85

AlmogBaku opened this issue Jun 29, 2022 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@AlmogBaku
Copy link
Contributor

AlmogBaku commented Jun 29, 2022

Hi,
I'm trying to figure out how can I use the compiled WASI artifact, I tried the following but it threw me an exception;

$ wasmtime run --env PYTHONPATH=/builddir/wasi/$(cat pybuilddir.txt) --mapdir /::../../ --  python.wasm 
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = '/builddir/wasi/build/lib.wasi-wasm32-3.11'
  program name = 'python.wasm'
  isolated = 0
  environment = 1
  user site = 1
  safe_path = 0
  import site = 1
  is in build tree = 0
  stdlib dir = '/usr/local/lib/python3.11'
  sys._base_executable = ''
  sys.base_prefix = '/usr/local'
  sys.base_exec_prefix = '/usr/local'
  sys.platlibdir = 'lib'
  sys.executable = ''
  sys.prefix = '/usr/local'
  sys.exec_prefix = '/usr/local'
  sys.path = [
    '/builddir/wasi/build/lib.wasi-wasm32-3.11',
    '/usr/local/lib/python311.zip',
    '/usr/local/lib/python3.11',
    '/usr/local/lib/python3.11/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00000001 (most recent call first):
$ wasmtime run --env PYTHONPATH=/builddir/wasi/$(cat pybuilddir.txt) --mapdir /builddir/wasi/::. --  python.wasm
Exception ignored error evaluating path:
Traceback (most recent call last):
  File "<frozen getpath>", line 353, in <module>
OSError: [Errno 76] Capabilities insufficient
Fatal Python error: error evaluating path
Python runtime state: core initialized

Current thread 0x00000001 (most recent call first):
  1. I also tried to put the "build" files in the same dir
@AlmogBaku
Copy link
Contributor Author

AlmogBaku commented Jun 29, 2022

cc @tiran
#83 (comment)

@tiran
Copy link
Collaborator

tiran commented Jun 29, 2022

  1. Start with a clean checkout or clean your checkout with git clean -xdf
  2. unzip wasm-main.zip into the top directory of your checkout
  3. run wasmtime run --dir . -- python.wasm

The additional env var and mappings are only needed for out-of-tree builds.

@tiran tiran added the documentation Improvements or additions to documentation label Jun 29, 2022
@brettcannon
Copy link
Collaborator

Should we consider building a self-contained WASI binary for people to play with? I had someone at work run into the situation where they initially didn't expect to need the repo checkout. Otherwise should we record the git commit that the WASI binary was built against so people can get a matching checkout?

@AlmogBaku
Copy link
Contributor Author

Self contained make a lot of sense, especially since its intended to be embedded as part of some program

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants