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

chore: add ARM Mac installation instructions #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
$ npm install --save objc
```

*Note: on ARM Macs, you may need to prepend `npm_config_build_from_source=true` to this command as the subdependency [ref-napi](https://github.com/node-ffi-napi/ref-napi) (as of version 3.0.3) does not include a prebuilt bindary for `darwin-arm64`. See "troubleshooting" below for more information.*

## Usage

Expand Down Expand Up @@ -247,6 +248,23 @@ LKGreeter.new().greet('Lukas'); // => 'Hello, Lukas!'
```
**Note**: You might have to specify individual offsets in the type encoding, see [this example](/examples/delegate.js).

## Troubleshooting

### "No native build was found"

If, at runtime (e.g. when running `npm run test`), you encounter this error:

> Error: No native build was found for `platform=darwin arch=arm64 runtime=node abi=93 uv=1 armv=8 libc=glibc node=16.19.0`
> loaded from: `/Users/some_user/objc/node_modules/ref-napi`

... it's because the [ref-napi](https://github.com/node-ffi-napi/ref-napi) release (as of version 3.0.3) includes [prebuilt binaries for various processors, but not for `darwin-arm64` as used on ARM Macs](https://github.com/node-ffi-napi/ref-napi/issues/51#issuecomment-991746870).

To work around this, either switch your terminal to Rosetta mode (not recommended), or (probably best to remove `node_modules`, then) reinstall with this environment arg:

```sh
npm_config_build_from_source=true npm install --save objc
```

## Roadmap
In the future, I'd like to add support for:
- improved support for inout parameters (`id*`)
Expand Down