Page 1 of 1

Apple M1 support

PostPosted: Thursday, 19th November 2020, 09:50
by erf
Will crawl support the new Apple M1 chip?

Re: Apple M1 support

PostPosted: Thursday, 19th November 2020, 14:57
by advil
Good question! I hope the answer is sooner or later yes, but this will basically depend on someone getting their hands on one and figuring out what it takes to build on it, either a dev or a contributor who is willing to submit a PR. I expect that eventually I'll get one of these myself, they seem very cool, but I don't know if I'll get a gen 1. It's possible that the build will already more or less work; we don't currently support arm but actually the debian folks do build on several arm architectures in an automated test and I believe the former dev who still maintains that process uses linux on arm. Raspberry Pi arm builds also are known to work I think. One major factor will be whether/how our dependencies (SDL, lua, etc) need to be updated, since not all arms are the same.

I can unfortunately almost certainly promise that seeds won't be stable across this architecture without a bunch of effort though.

Re: Apple M1 support

PostPosted: Thursday, 19th November 2020, 19:10
by erf
Thanks for your answer!

I will have my machine in a week. I can do some experimentation and report back. If we can't build a native version, i think it still can be converted using Rosetta 2.

Re: Apple M1 support

PostPosted: Thursday, 19th November 2020, 19:31
by advil
Oh, yeah I should add that from everything I've read I expect that the current builds will work without problems on Rosetta 2 (unless there are weird gatekeeper issues). I've even seen benchmark descriptions where some (higher-end than dcss) games apparently ran better on M1 under rosetta, so I don't expect speed problems.

Please do report back if you can!

Re: Apple M1 support

PostPosted: Monday, 23rd November 2020, 18:44
by erf
Hi again,

I was able to build crawl when I opened a terminal using Rosetta, but I was not able to run it.

When trying to build using a terminal without Rosetta I got the following error:

```
src/atomic/SDL_spinlock.c:103:12: error: implicit declaration of function
'OSAtomicCompareAndSwap32Barrier' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
```

I was able to download and run a pre-built macOS version from the website. All the non-M1 apps are automatically translated using Rosetta.

The new M1 MacBook Air is super fast!

Later.

Re: Apple M1 support

PostPosted: Tuesday, 24th November 2020, 19:37
by advil
Thanks for the report. For the build error I suspect that that could be fixed if the 64 bit version is used in the relevant file in the SDL2 contrib -- it looks like before the following commit, SDL2 didn't properly handle 64 bit mac builds:

http://lists.libsdl.org/pipermail/commi ... 01497.html

Updating the contrib in dcss would probably fix this as well.

Re: Apple M1 support

PostPosted: Sunday, 13th December 2020, 01:07
by erf
I tried to go to contrib/sdl2, select the master branch and do a git pull, but the build failed with the same problem. Do you have an idea what do do? Is this issue in the backlog?

Re: Apple M1 support

PostPosted: Thursday, 17th December 2020, 00:24
by erf
I changed:
vis +103 contrib/sdl2/src/atomic/SDL_spinlock.c

to just:
return SDL_FALSE;

Now SDL2 seem to build, but now i got an error with libpng:

HOSTLINK tool/tilegen.elf
Undefined symbols for architecture arm64:
"_png_init_filter_functions_neon", referenced from:
_png_read_filter_row in libpng.a(pngrutil.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [tool/tilegen.elf] Error 1
make: *** [build-rltiles] Error 2
~

Maybe i should make an github issue on this?

Re: Apple M1 support

PostPosted: Thursday, 17th December 2020, 00:43
by erf
I posted a new issue on the Mantis tracker here:

https://crawl.develz.org/mantis/view.php?id=12407

Re: Apple M1 support

PostPosted: Thursday, 17th December 2020, 03:24
by advil
erf wrote:I tried to go to contrib/sdl2, select the master branch and do a git pull, but the build failed with the same problem. Do you have an idea what do do? Is this issue in the backlog?


The crawl contribs are from custom repositories that we maintain, so updating them involves updating those from the upstream version; it's not very easy to do. I think the approach you are taking involving hacking the existing contribs will be the quickest approach. Libpng also may need some updates, but looking around I did find a potential solution here: https://github.com/fakhirsh/FEngine/issues/44

Re: Apple M1 support

PostPosted: Thursday, 17th December 2020, 03:47
by erf
Yes! I have an M1 build now :D

I made a note on Mantis with patches here:
https://crawl.develz.org/mantis/view.php?id=12407

Thanks for your help!