TabNine icon indicating copy to clipboard operation
TabNine copied to clipboard

Incorrect docs for Apple Silicon detection

Open alinnow opened this issue 5 years ago • 2 comments

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

alinnow avatar Jan 18 '21 17:01 alinnow

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.

amircodota avatar Jan 18 '21 20:01 amircodota

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

alinnow avatar Jan 18 '21 20:01 alinnow