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

Illegal hardware instruction on MacOS M4 mini with Rosetta x86-64 #653

Open
maartenJacobs opened this issue Jan 3, 2025 · 0 comments
Open

Comments

@maartenJacobs
Copy link

When I try to compile a Koka file with --optimize=2 or --optimize=3 whilst emulating x86-64 on a Mac M4, the compilation succeeds but at runtime I get [1] 11926 illegal hardware instruction.

Version numbers

Koka (x86-64)

Koka 3.1.2, 17:28:02 May 30 2024 (ghc release version)
version: 3.1.2
bin    : /Users/maarten/lib/x86_64/bin
lib    : /Users/maarten/lib/x86_64/lib/koka/v3.1.2
share  : /Users/maarten/lib/x86_64/share/koka/v3.1.2
output : .koka/v3.1.2/clang-debug-5a10c3
cc     : /usr/bin/clang
Copyright 2019-2024, Microsoft Research, Daan Leijen, and others.
This program is free software; see the source for copying conditions.
This program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty
of merchantability or fitness for a particular purpose.

Clang

Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: x86_64-apple-darwin24.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Steps to reproduce

Using the following sample script

module error

fun main()
  println("If you see this on Mac M4, the issue is fixed, maybe?")
  1. Run your shell in x86-64 mode, e.g. arch -x86_64 zsh.
  2. Install x86-64 version of Koka. For reference, this is what I did.
    1. Create a directory to store x86-64 versions of software, e.g. /Users/you/lib/x86_64
    2. Download Koka's install script, curl -o install.sh -sSL https://github.com/koka-lang/koka/releases/latest/download/install.sh.
    3. Install Koka in the x86-64 shell with the directory from step 1, ./install.sh --prefix=/Users/you/lib/x86_64 --minimal.
  3. Compile and execute the sample script, /Users/you/lib/x86_64/koka --optimize=2 --compile --output error error.kk && chmod +x error && ./error
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

1 participant