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

Missing Windows ARM64 support #247

Open
ben-zen opened this issue Jul 16, 2024 · 12 comments
Open

Missing Windows ARM64 support #247

ben-zen opened this issue Jul 16, 2024 · 12 comments

Comments

@ben-zen
Copy link

ben-zen commented Jul 16, 2024

I was setting up my new Glasgow, and as I went to build the demo, I discovered that this package doesn't have a Windows AARCH64 build.

Looking deeper, I found a few upstream issues that are blocking forward motion. Unfortunately, I'm not familiar with unwinding in Rust to be able to help. Once wasmtime has Windows on ARM64 support, it'd be swell to get wasmtime-py support for the platform.

@alexcrichton
Copy link
Member

Thanks for the report! Support upstream is indeed required first, so this'll be blocked on the issues you linked.

@billti
Copy link

billti commented Feb 6, 2025

I see there is a binary neutral wheel at https://pypi.org/project/wasmtime/#files . This is what I got when I tried to 'pip install wasmtime' in Python on Windows ARM64. I thought maybe it would do a source install, however it just seems to install the x64 library and fails with "unsupported architecture" when imported. (See screen shots below)

Image Image

I see the above 'upstream issue' mentioned was resovled a while back. Cloning the repo and doing a 'cargo build --release' works fine. Should this be resolved now? Any specific validation would need to be done? Any way I can help get Windows on ARM64 binaries/wheels supported? Thanks.

@cfallin
Copy link
Member

cfallin commented Feb 6, 2025

Reading the code that throws the error, I see

if machine == 'AMD64':
    machine = 'x86_64'
if machine == 'arm64':
    machine = 'aarch64'
if machine != 'x86_64' and machine != 'aarch64':
    raise RuntimeError("unsupported architecture for wasmtime: {}".format(machine))

so we accept arm64 (macOS gives this) and aarch64 (Linux) but not ARM64 as seen in the exception's error message. It may be as simple as adding a case here -- Alex above is the main maintainer but I imagine PRs are welcome for this?

@billti
Copy link

billti commented Feb 6, 2025

But as per my File Explorer screen shot, in includes one binary in a folder named win32-x86_64. If I examine it, it is indeed a Windows x64 binary, not ARM64. So not sure if that check could be improved, but there is no Windows ARM64 wheel, and the wheel without a platform specifier only has Windows x64 binaries in it.

Image

@alexcrichton
Copy link
Member

Yes in addition to the change @cfallin we'd need to include precompiled binaries for arm64 windows. I don't know the python naming of the target for arm64 windows myself, though, so I don't know what to fill in here for arm64 windows.

@billti
Copy link

billti commented Feb 6, 2025

Looks like the 'wasmtime' repo does already pushing the Windows aarch64 binaries, and I can see in the latest run (https://github.com/bytecodealliance/wasmtime/actions/runs/13182238438/job/36795668898#step:11:481) the download URI of "browser_download_url": "https://github.com/bytecodealliance/wasmtime/releases/download/dev/wasmtime-dev-aarch64-windows-c-api.zip"

If I download that and crack it open the binaries show as:

Image

I'm happy to have a crack and making the necessary changes in this repo if you like. I'm not that familiar and may need a little assistance, so happy to leave it to you too if you know what's needed.

And just to check...

$ llvm-objdump --headers /Users/billti/Downloads/wasmtime-dev-aarch64-windows-c-api/lib/wasmtime.dll

/Users/billti/Downloads/wasmtime-dev-aarch64-windows-c-api/lib/wasmtime.dll:    file format coff-arm64

@alexcrichton
Copy link
Member

If you're able to help out here that would be much appreciated! Even being able to test things would be great because I don't have an aarch64 windows machine

@billti
Copy link

billti commented Feb 7, 2025

Making good progress, but the build is failing on my machine due to some error with componentize-py. Looking at that package, maybe as that doesn't have wheels for Window on ARM64 either 😢 (https://pypi.org/project/componentize-py/#files). Investigating that now...

@billti
Copy link

billti commented Feb 7, 2025

(To be clear, it's the command pip install -e ".[testing]" that's failing, due to this dependency: https://github.com/bytecodealliance/wasmtime-py/blob/main/setup.py#L45

@billti
Copy link

billti commented Feb 7, 2025

Looks like getting a local build of componentize-py working requires wasi-sdk locally, which... you guessed it - doesn't have release binaries for Windows on ARM64 ! 😢

Looking at the build steps for wasi-sdk and it seems like quite the effort to set up locally, and honestly it looks like a long chain of stuff to get working upstream before I can get this repo building and testing for Windows on ARM64 in a CI. Unless you can think of any shortcuts here or things I can avoid, I'm not sure there's a viable path at this point.

@alexcrichton
Copy link
Member

Is it possible to skip the componentize-py dep on windows arm64? It's definitely true that getting a build of wasi-sdk will take some significant work, so best avoided if possible.

@billti
Copy link

billti commented Feb 7, 2025

Yeah, that occurred to me at dinner too. I just put up #268 to get early feedback before I start in on the main workflow. Thx!

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

No branches or pull requests

4 participants