google-research / dex-lang

Research language for array processing in the Haskell/ML family
BSD 3-Clause "New" or "Revised" License
1.58k stars 106 forks source link

Building on M1 Mac #1247

Open jordanrule opened 1 year ago

jordanrule commented 1 year ago

Just wanted to leave a few notes on building the project on an M1 Mac (aarch64) should you decide to support the architecture in the future:

Just posting this in case it helps someone else or I missed something, as I would like to return to the project and look for possible contributions once it is working.

dan-zheng commented 1 year ago

Thanks for the issue! I got a new Apple M1 laptop recently, ran into all the build issues mentioned above.

After a day of debugging, I'm close to getting Dex to build on Apple M1:

Current status: upgrading to GHC 9.2.7 has resulted in some dex-lang compilation errors, probably due to language changes:

``` $ make stack --stack-yaml=stack-macos.yaml build --ghc-options="-j +RTS -A256m -n2m -RTS" --extra-include-dirs=/opt/homebrew/include --extra-lib-dirs=/opt/homebrew/lib --fast ... /Users/danielzheng/dex-lang/src/lib/Name.hs:1302:44: error: Bang pattern in expression context: !v Did you mean to add a space after the '!'? | 1302 | lookupZipSubstFst v = ZipSubstReaderT $ (!v) <$> fst <$> ask | ^^ /Users/danielzheng/dex-lang/src/lib/Name.hs:1303:44: error: Bang pattern in expression context: !v Did you mean to add a space after the '!'? | 1303 | lookupZipSubstSnd v = ZipSubstReaderT $ (!v) <$> snd <$> ask | ^^ ```

I'll plan to follow-up here within a week. If the final fixes aren't too tricky, I should be able to share a pull request with instructions.

dan-zheng commented 1 year ago

In-progress fix at https://github.com/google-research/dex-lang/pull/1264. Dex builds on Apple M1 and simple examples run!

Requires LLVM 15: brew install llvm@15. Tests aren't all passing yet, working on fixing them next.