Skip to content
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

Apple M1: bad CPU type in executable #43

Closed
avelino opened this issue Mar 8, 2022 · 11 comments
Closed

Apple M1: bad CPU type in executable #43

avelino opened this issue Mar 8, 2022 · 11 comments
Assignees

Comments

@avelino
Copy link

avelino commented Mar 8, 2022

CPU: Apple M1
OS: macOS Monterey

...
==> Installing Cask graalvm-ce-java11
==> Moving Generic Artifact 'graalvm-ce-java11-22.0.0.2' to '/Library/Java/JavaVirtualMachines/graalvm-ce-java11-22.0.0.2'
🍺  graalvm-ce-java11 was successfully installed!
❯ ~ /opt/homebrew/Caskroom/graalvm-ce-java11/22.0.0.2/graalvm-ce-java11-22.0.0.2/Contents/Home/bin/java
zsh: bad CPU type in executable: /opt/homebrew/Caskroom/graalvm-ce-java11/22.0.0.2/graalvm-ce-java11-22.0.0.2/Contents/Home/bin/java
@fniephaus
Copy link
Member

GraalVM currently does not support Apple M1 chips yet (we are actively working on it, see: oracle/graal#2666). In the meantime, you can run GraalVM on Rosetta 2. For that, you need to run brew in a Rosetta-enabled terminal.

@fniephaus fniephaus changed the title bad CPU type in executable Apple M1: bad CPU type in executable Mar 8, 2022
@fniephaus fniephaus pinned this issue Mar 8, 2022
@avelino
Copy link
Author

avelino commented Mar 24, 2022

@fniephaus we had an update on graalvm, now it supports arm architecture (mac m1)

I'm pleased to announce that we uploaded the first snapshot containing darwin-aarch64: https://github.com/graalvm/graalvm-ce-dev-builds/releases/tag/22.1.0-dev-20220321_2332

The following components are available for this platform:

- JVM with libgraal
- native-image
- JavaScript
- Espresso

oracle/graal#2666 (comment)

@fniephaus
Copy link
Member

Hey @avelino, yes, M1 support has landed in GraalVM. However, we have to wait for the 22.1 release, which is due next month, before we can add support for M1 machines to this tap. In the meantime, you can try out dev builds: https://github.com/graalvm/graalvm-ce-dev-builds/releases/latest

@KevinRoebert
Copy link

Is it possible to create a homebrew tap for the nightly build?

@fniephaus
Copy link
Member

Technically it's possible, but I don't think it's a good idea as dev builds are volatile so we'd need to keep this repo in sync.

Do you have a good use case for dev builds beyond M1 support? Note that there is also a GitHub Action for GraalVM, which allows you to use GraalVM dev builds on macOS.

@KevinRoebert
Copy link

Do you have a good use case for dev builds beyond M1 support?

Currently, no ^^

@fniephaus
Copy link
Member

fniephaus commented Mar 24, 2022

Currently, no ^^

Fair enough! Anyway, I managed to look into this: you can now run the following to install an M1 dev build:

brew install --cask graalvm/tap/graalvm-ce-java17
# or
brew install --cask graalvm/tap/graalvm-ce-java11

@brandonstubbs
Copy link

brandonstubbs commented Mar 24, 2022

Tried installing it, failing for me

# uname -m
arm64

# brew install --cask graalvm/tap/graalvm-ce-java17
...
==> Downloading https://github.com/graalvm/graalvm-ce-dev-builds/releases/download/22.1.0-dev-20220321_2332/graalvm-ce-java17-darwin-aarch64-dev.tar.gz
...

# file /Library/Java/JavaVirtualMachines/graalvm-ce-java17-22.1.0-dev/Contents/Home/bin/java
/Library/Java/JavaVirtualMachines/graalvm-ce-java17-22.1.0-dev/Contents/Home/bin/java: Mach-O 64-bit executable arm64

image

Edit:
Note - Downloading same binary, extracting and running is working fine

Fixed:
Using xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-ce-java17-22.1.0-dev

@KevinRoebert
Copy link

Have you removed the quarantine bit? See also oracle/graal#2666 (comment)

$ sudo xattr -r -d com.apple.quarantine /path/to/GRAALVM_HOME

@brandonstubbs
Copy link

@KevinRoebert thanks that worked!

@fniephaus
Copy link
Member

Closed by 0560e96.

With the new 22.1.0 release, GraalVM has shipped experimental support Apple Silicon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants