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

Incorrect docs for Apple Silicon detection #326

Closed
alanpearce opened this issue Jan 18, 2021 · 2 comments
Closed

Incorrect docs for Apple Silicon detection #326

alanpearce opened this issue Jan 18, 2021 · 2 comments

Comments

@alanpearce
Copy link

https://github.com/codota/TabNine/blob/master/HowToWriteAClient.md#about-apple-m1-processor-support

Specifically, the sentence

It usually requires calling some form of uname or similar

This doesn't work when the callee is an x86_64 binary.

% arch -x86_64 zsh -c 'uname -pm'
x86_64 i386

One should request execution of the ARM binary instead by calling arch -arm64 uname -p (or -m). This will cause an error on Intel, but it's harmless.

% arch -x86_64 zsh -c 'arch -arm64 uname -pm'
arm64 arm
@amircodota
Copy link
Contributor

Really appreciate this feedback.

You can still get away with using uname without the specific arch flag.

arch -x86_64 zsh -c 'uname -v'

=> Darwin Kernel Version 20.2.0: Wed Dec 2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101

This is pretty much what we do in sublime, using python

import platofrm
if sublime.platform() == "osx":
    if "ARM64" in platform.version().upper():
        return "arm64"

I'll add a link to this issue from the docs. Anyone that runs into trouble detecting m1 using uname is welcome to comment here.

@alanpearce
Copy link
Author

To me, the uname -v output doesn't look like something that can be relied upon, but it does indeed work right now.

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

3 participants