New GitHub issue #95952 from tiran:<br>

<hr>

<pre>
# Bug report

`Makefile.pre.in` and `configure.ac` are using the `realpath` command for some targets. For example WASI `HOSTRUNNER` uses `realpath --relative-to` to get the working directory relative to the srcdir root directory. macOS seems to lack realpath, breaking WASI tests, see https://github.com/python/cpython/pull/95828#issuecomment-1213579582

For WASI HOSTRUNNER we need to replace realpath somehow. Or find a different approach to fix testing with OOT builds. The HOSTRUNNER for WASI is complicated because we have to make `srcdir` available to WASI runtime environment. `--mapdir /::$(srcdir)` maps the srcdir to root `/` inside the runtime environment. wasmtime sets cwd to `/`, so our logic to find `pybuilddir.txt` does not work. That's why the HOSTRUNNER sets `--env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell cat pybuilddir.txt):/Lib`, which resolves to `--env PYTHONPATH=/builddir/wasi/build/lib.wasi-wasm32-3.12:/Lib` on my system. The prefix depends on the OOT builddir. The suffix is read from pybuilddir.txt, which is generated at the end of the build process.
</pre>

<hr>

<a href="https://github.com/python/cpython/issues/95952">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>