Unable to build Crystal on x86_64-darwin

Hey everyone!

On the Crystal update PR we are stuck on x86_64-darwin. All other archs (including aarch64-darwin) build successfully except that.

There’s 3 issues:

  1. It wouldn’t use clang 13 until CC was set manually

  2. It fails with:

Undefined symbols for architecture x86_64:
  "___darwin_check_fd_set_overflow", referenced from:
      _select_add in libevent.a(select.o)
      _select_del in libevent.a(select.o)
      _select_dispatch in libevent.a(select.o)
ld: symbol(s) not found for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
  1. (not critical (?)) Multiple ... was built for newer macOS version (10.12) than being linked (10.11) logs on both darwin archs, even though MACOSX_DEPLOYMENT_TARGET was set (and supposed to fix that)

I don’t have a darwin machine so it’ll probably be better to post any suggested fixes on the issue for the other participants to test or review.

See GitHub - manveru/crystal-flake: Flake to build Crystal

Unfortunately that flake seems to have other issues with x86_64-darwin and aarch64-darwin. :frowning:

Details at Add Crystal Language by bcardiff · Pull Request #82 · cachix/devenv · GitHub