Apple M1 support


Questions, Explanations, Howtos

erf

Mines Malingerer

Posts: 43

Joined: Wednesday, 22nd April 2015, 19:11

Post Thursday, 19th November 2020, 09:50

Apple M1 support

Will crawl support the new Apple M1 chip?

Dungeon Master

Posts: 388

Joined: Monday, 18th August 2014, 20:04

Post Thursday, 19th November 2020, 14:57

Re: Apple M1 support

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.

erf

Mines Malingerer

Posts: 43

Joined: Wednesday, 22nd April 2015, 19:11

Post Thursday, 19th November 2020, 19:10

Re: Apple M1 support

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.

Dungeon Master

Posts: 388

Joined: Monday, 18th August 2014, 20:04

Post Thursday, 19th November 2020, 19:31

Re: Apple M1 support

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!

erf

Mines Malingerer

Posts: 43

Joined: Wednesday, 22nd April 2015, 19:11

Post Monday, 23rd November 2020, 18:44

Re: Apple M1 support

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.

Dungeon Master

Posts: 388

Joined: Monday, 18th August 2014, 20:04

Post Tuesday, 24th November 2020, 19:37

Re: Apple M1 support

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.

erf

Mines Malingerer

Posts: 43

Joined: Wednesday, 22nd April 2015, 19:11

Post Sunday, 13th December 2020, 01:07

Re: Apple M1 support

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?

erf

Mines Malingerer

Posts: 43

Joined: Wednesday, 22nd April 2015, 19:11

Post Thursday, 17th December 2020, 00:24

Re: Apple M1 support

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?

erf

Mines Malingerer

Posts: 43

Joined: Wednesday, 22nd April 2015, 19:11

Post Thursday, 17th December 2020, 00:43

Re: Apple M1 support

I posted a new issue on the Mantis tracker here:

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

Dungeon Master

Posts: 388

Joined: Monday, 18th August 2014, 20:04

Post Thursday, 17th December 2020, 03:24

Re: Apple M1 support

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

erf

Mines Malingerer

Posts: 43

Joined: Wednesday, 22nd April 2015, 19:11

Post Thursday, 17th December 2020, 03:47

Re: Apple M1 support

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!

Return to Coding

Who is online

Users browsing this forum: No registered users and 6 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.