pen icon indicating copy to clipboard operation
pen copied to clipboard

aarch64-apple-darwin: binary killed on Apple silicon due to policy violation

Open dylhunn opened this issue 4 years ago • 2 comments

I modified the hello world program, as generated by pen create, to read as follows:

import System'Context { Context }
import System'File

type redblacknode {
  red boolean
}

main = \(ctx Context) number {
  File'Write(ctx, File'StdOut(), "Hello, world!\n")

  0
}

Attempting to build and run this program results in a binary that immediately crashes:

~/code/pen-trees 〉pen build && ./app
[6/6] /Users/dylhunn/code/pen-trees/.p...ult/archives/lib7e2c4ee33a26eae0_ffi.a
zsh: killed     ./app

Removing the record type causes the program to build and run as expected, printing "Hello, world!".

I am on an Apple Silicon Macbook Pro, running MacOS 11.4. I am using pen 0.2.1 as installed via brew.

I'm unable to even load the binary in lldb (note that I'm just trying to load lldb, not even run the target):

~/code/pen-trees 〉lldb ./app 
(lldb) target create "./app"
zsh: killed     lldb ./app

dylhunn avatar Sep 24 '21 01:09 dylhunn

Thanks for your feedback! Unfortunately, Pen currently supports only x86-64 Linux and macOS as tier 1 targets, where you can build and run programs written in Pen, because I don't have any environment to test Pen on M1 chips right now.

When I build the program with pen build --target aarch64-unknown-linux-musl on my x86-64 Linux machine, it works with qemu-aarch64 ./app. So the problem is probably specific to aarch64-apple-darwin target but not aarch64 in general. That's also wierd that lldb can't load the binary at all.

Anyway, sorry for that you can't play around with Pen on M1 laptops! When I eventually get a M1 Macbook or GitHub supports Apple M1 VMs, Pen is gonna definitly support Apple Silicon too.

raviqqe avatar Sep 24 '21 02:09 raviqqe

Thanks for the quick reply. Unfortunately, this is my only machine, but feel free to bump this bug when you support aarch64-apple-darwin, as I'd love to have another look then!

dylhunn avatar Sep 24 '21 04:09 dylhunn

Binaries built with the pen build command works at least on M2 chip.

raviqqe avatar Sep 03 '22 05:09 raviqqe