-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Can't install on Apple M1 Silicon #10237
Comments
Duplicate of #10066? |
Duplicate of #10066 |
while #10066 addressed the technical issue, this issue could be reopened until the end user can use |
brew isn't the scope of this issue tracker, that's at https://github.com/homebrew/brew. After #10348 the next step is probably to set up CI for arm64-apple-darwin and then provide binaries. |
If somebody working on CI wants a temporary playground on our ARM build server, I think we can arrange for that :) |
I'm probably being dumb, but I can't get it to compile after #10348; probably as the instructions are for cross compiling, which I don't need on an M1. Anyone managed to get this to compile? If so, how? |
You still do need to cross compile because there is no official binary to bootstrap from. It's just that you can do it with a single machine due to rosetta. So you cross compile the ARM compiler using the x86 compiler under rosetta and then link the result outside. I guess the instructions might use the ARM linker directly, I didn't take a close look. |
when I try this with brew for intel, I still get stuck on the first step - any ideas? % LLVM_CONFIG="$INTEL_LLVM_CONFIG" \
LDFLAGS="-L$INTEL_LLVM_ROOT/lib" \
CPPFLAGS="-I$INTEL_LLVM_ROOT/include" \
CC="$INTEL_LLVM_ROOT/bin/clang" \
AR="$INTEL_LLVM_ROOT/bin/llvm-ar" \
arch -x86_64 make
Using /usr/local/opt/llvm/bin/llvm-config [version=11.1.0]
c++ -c -o src/llvm/ext/llvm_ext.o src/llvm/ext/llvm_ext.cc -I/usr/local/Cellar/llvm/11.1.0/include -std=c++14 -stdlib=libc++ -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
/usr/local/opt/llvm/bin/clang -fPIC -I/usr/local/opt/llvm/include -c -o src/ext/sigfault.o src/ext/sigfault.c
/usr/local/opt/llvm/bin/llvm-ar -rcs src/ext/libcrystal.a src/ext/sigfault.o
CRYSTAL_CONFIG_LIBRARY_PATH="" CRYSTAL_CONFIG_BUILD_COMMIT="171cfbe6c" SOURCE_DATE_EPOCH="1614257218" ./bin/crystal build --link-flags="-L/usr/local/opt/llvm/lib" -o .build/crystal src/compiler/crystal.cr -D without_openssl -D without_zlib
./bin/crystal: line 156: crystal: command not found
You need to have a crystal executable in your path! or set CRYSTAL env variable
make: *** [.build/crystal] Error 1 |
@ukd1 You'll need to make sure crystal is installed and linked for Intel Homebrew. If you have the ( Let me know if that unblocks you. I think I provided enough of the environment variables needed for getting the cross-compilation to work fairly smoothly, but it's possible I missed some things. This will hopefully become a little easier once there's an official release w/ the M1 Support merged in, because at least then it shouldn't require Intel Homebrew at all, just an |
Is there any update on this? Just bought a new M1 Mac and I'm hitting the same issue 😢 |
I tried cross-compiling with the official x86_64 build of Crystal 1.0.0 to aarch64/arm64 and unfortunately it seems maybe the release build didn't ship with an llvm that can target aarch64/arm64 on macOS (I think it requires LLVM 11 and the release build probably used 9) so we may need to wait for the LLVM 11 issues to be sorted and for official builds to use LLVM 11. Cross-compiling from source via the instructions in the darwin/aarch64 PR should still work, but is somewhat difficult. EDIT: cross-compiling from source with an x86_64 compiler via Rosetta 2 is documented here: https://maxfierke.com/blog/posts/so-you-want-to-compile-crystal-on-arm64-macos |
@sdogruyol tbh I gave up for now. Until it works with brew natively, I don't want to maintain a hand-rolled setup. Try installing it x86? |
Listing the steps that helped me: My arm/M1 brew is installed here:
Step 1. Install x86_64 brew under /usr/local/bin/brew
Step 2. Create an alias for the x86_64 brew I added this to my ~/.zshrc
Step 3. Step 4. Yay!
|
@valbaca whilst I'm sure this works, it's not really solving the issue of native arm64 installation - which is possible, but a pain. |
I suppose we should be able to publish a distribution package for aarch64 macos now. There's no CI infrastructure for Apple Silicon, yet. So it would need to be manually built. Once a package is available, it can serve as boot release for homebrew. |
Attached a test universal distribution build here: crystal-lang/distribution-scripts#104 (comment) if folks want to try it out on their M1 hardware Only issue I've noticed is an LLVM assertion failing in debug mode for the program I tested it on, but release mode seems to work fine. the LLVM assertion failure seems maybe specific to my program or the version of LLVM, because I can reproduce it on x86_64 too |
@maxfierke can you please repost the build you have? |
@pouyakary official universal builds are now provided, see here for the latest: https://github.com/crystal-lang/crystal/releases/download/1.2.2/crystal-1.2.2-1-darwin-universal.tar.gz You can also install via Homebrew on macOS ARM64 now. |
@maxfierke thanks a lot! |
os: BigSur 11.0.1
cpu: Apple M1
expected result; be able to install Crystal
result:
The text was updated successfully, but these errors were encountered: