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

Compiling on windows #686

Open
davidbelius opened this issue Oct 27, 2023 · 2 comments
Open

Compiling on windows #686

davidbelius opened this issue Oct 27, 2023 · 2 comments

Comments

@davidbelius
Copy link

Have their been any attempts to compile and install on windows? Any pointers?

@davidbelius
Copy link
Author

davidbelius commented Oct 29, 2023

Recording my findings here for the benefit of others with the same question:

  • After removing the unix dependency from examples/examples.cabal, "cabal build hasktorch" runs for a pretty long time, but eventually fails with ld complaining about among others -ltorch.
  • One may hope that pointing cabal to libtorch windows binaries using --extra-lib-dirs will fix this, but it did not, as far as I understand because:
  • libtorch binaries are compiled using MSVC and are not "ABI-compatible", which means GHC's c compiler mingw can not link to them (see the "tip" on https://pytorch.org/cppdocs/installing.html).
  • One may hope to compile libtorch from source on windows using mingw, but libtorch does not provide makefiles for mingw. I did not attempt to figure it out myself after reading https://discuss.pytorch.org/t/can-i-build-libtorch-from-source-with-mingw/52632.

So getting hasktorch to compile on windows unfortunately seems like a major undertaking, even with just cpu and without cuda support.

@junjihashimoto
Copy link
Member

Hi @davidbelius,
I think that when we use MSVC's libtorch, we need to use ghc of MSVC(https://www.reddit.com/r/haskell/comments/n0xcoy/announce_experimental_windows_ghc_8105_binary/), and some patches for some packages.
This repository(https://github.com/awson/ghc-nw) provides the paches.
However, both of them are not maintained.
I recommend to use WSL on windows, although the performance will be worse than native linux. GPU also works.

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

2 participants