我正在尝试在我的 MBP 上设置 nvim,除了最后一步(即安装 nvim-treesitter)之外,一切都很顺利,在短暂的安装例程之后,它会抛出此错误:
nvim-treesitter[phpdoc]: Error during `npm install` (required for parser generation of phpdoc with npm dependencies)
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm ERR! code 1
npm ERR! path /Users/anton/.local/share/nvim/tree-sitter-phpdoc/node_modules/tree-sitter-cli
npm …Run Code Online (Sandbox Code Playgroud) 我有一台配备 Apple Silicon (M1) 的 Mac,并且安装了 minikube。安装是按照https://medium.com/@seohee.sophie.kwon/how-to-run-a-minikube-on-apple-silicon-m1-8373c248d669 执行的:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-arm64
sudo install minikube-darwin-arm64 /usr/local/bin/minikube
Run Code Online (Sandbox Code Playgroud)
如何删除 minikube?
我一直在尝试映射一个既可写又可执行的页面。
mov x0, 0 // start address
mov x1, 4096 // length
mov x2, 7 // rwx
mov x3, 0x1001 // flags
mov x4, -1 // file descriptor
mov x5, 0 // offset
movl x16, 0x200005c // mmap
svc 0
Run Code Online (Sandbox Code Playgroud)
这给了我一个 0xD 错误代码(EACCESS,文档毫无帮助地将其归咎于无效的文件描述符,尽管相同的文档说使用“-1”)。我认为代码是正确的,如果我只是传递“r--”以获得权限,它会返回一个有效的 mmap。
我知道相同的代码可以在 Catalina 和 x64 架构中工作。我测试了禁用 SIP 模式时会发生相同的错误。
为了获得更多上下文,我正在尝试将 FORTH 实现移植到 MacOs/ARM64,而这个 FORTH 与许多其他实现一样,在运行时大量使用自修改代码/汇编代码。并且进行汇编/编译的代码驻留在新创建的代码的中间(事实上,编译器的一部分将作为运行 FORTH 的一部分以机器语言生成),因此分离 FORTH JIT 编译器是非常困难/不可行的(如果你这样称呼它)来自生成的代码。
现在,我真的不想最终得到这样的答案:“苹果认为他们比你更了解,不适合你!”,但这就是到目前为止的样子。谢谢你的帮助!
跑步
import logging
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
name = req.params.get('name')
if not name:
try:
req_body = req.get_json()
except ValueError:
pass
else:
name = req_body.get('name')
if name:
return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
else:
return func.HttpResponse(
"This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
status_code=200
)
Run Code Online (Sandbox Code Playgroud)
在 vscode 中
pyenv shell 3.9.12 …Run Code Online (Sandbox Code Playgroud) 是否可以安装和更新具有通用(x86_64、arm64)架构支持的 Perl(CPAN)模块?如果是,那么如何?
\n背景
\n在基于arm的macOS计算机上,可以为一个指定的架构安装Perl CPAN模块,如下所示:
\nsudo cpan -i Encode\n### equivalent since `-arm64` is the native processor in this situation:\nsudo arch -arm64 cpan -i Encode\n\nfile /Library/Perl/5.30/darwin-thread-multi-2level/auto/Encode/Encode.bundle\n# /Library/Perl/5.30/darwin-thread-multi-2level/auto/Encode/Encode.bundle:\n# Mach-O 64-bit bundle arm64\n\nsudo arch -x86_64 cpan -i Encode\n\nfile /Library/Perl/5.30/darwin-thread-multi-2level/auto/Encode/Encode.bundle\n# /Library/Perl/5.30/darwin-thread-multi-2level/auto/Encode/Encode.bundle:\n# Mach-O 64-bit bundle x86_64\nRun Code Online (Sandbox Code Playgroud)\n但请注意,Appleperl本身就是一个“通用二进制文件”:
file /usr/bin/perl\n\n# /usr/bin/perl: Mach-O universal binary with 2 architectures: \n# [x86_64:Mach-O 64-bit executable x86_64] \n# [arm64e:Mach-O 64-bit executable arm64e]\n# /usr/bin/perl (for architecture x86_64): \n# Mach-O 64-bit executable x86_64\n# /usr/bin/perl (for architecture …Run Code Online (Sandbox Code Playgroud) 在 Apple Silicon Mac 上运行以下 shell 脚本(在配备 M1 的 MacBook Air 2020 和配备 M3 Max 的 MacBook Pro 16" 上尝试;两者都运行 macOS Sonoma,配备 Apple clang 15.0):
#!/bin/bash
rm -rf NTRU
git clone https://github.com/vector-polymul-ntru-ntrup/NTRU.git
cd NTRU/ntruhps2048677/aarch64_tmvp
cat << EOF > speed_polymul.c
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include "api.h"
#include "params.h"
#include "poly.h"
#include "tmvp.h"
#include "batch_multiplication.h"
#define NTESTS 1000
uint64_t time0, time1;
uint64_t cycles[NTESTS];
#ifdef __APPLE__
#include "m1cycles.h"
#define __AVERAGE__
#define SETUP_COUNTER() {(void)cycles; setup_rdtsc();}
#define CYCLE_TYPE "%lld"
#define …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Xcode 12 beta 4 构建一个支持 Apple Silicon 和 Mac Catalyst 的框架。该项目可以在 Xcode 中以“任何 Mac”目标构建良好。\n如果我使用以下命令
\nxcodebuild -project "project.xcodeproj" -configuration "Release" -scheme "MyScheme" -destination "generic/platform=macOS,variant=Mac Catalyst,name=Any Mac"\nRun Code Online (Sandbox Code Playgroud)\n我收到错误
\nxcodebuild: error: Unable to find a destination matching the provided destination specifier:\n { generic:1, platform:macOS, variant:Mac Catalyst, name:Any Mac }\n Unsupported device specifier option.\n The device \xe2\x80\x9cMy Mac\xe2\x80\x9d does not support the following options: name\n Please supply only supported device specifier options.\n...\nIneligible destinations for the "MyScheme" scheme:\n { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, …Run Code Online (Sandbox Code Playgroud) System:
OS: macOS 11.3
CPU: (8) arm64 Apple M1
Memory: 124.86 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.0.0 - /opt/homebrew/bin/node
Yarn: Not Found
npm: 7.10.0 - /opt/homebrew/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.10.1 - /Users/chia/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 12.5/12E262 - /usr/bin/xcodebuild
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.0 …Run Code Online (Sandbox Code Playgroud) 在 Mac 应用程序中,如何以编程方式(在运行时)检测应用程序当前是否在配备 Intel 或 Apple Silicon 处理器的 Mac 上运行?
我通过 miniforge3 在 m1 AppleSilicon 上安装了 python 虚拟环境。
执行后conda -create py39 numpy matplotlib pandas python=3.9
我检查了一下conda list,numpy 包已经安装了。
但是当我这样做时,import numpy as np发生了导入错误。
像这样
ImportError Traceback (most recent call last)
~/miniforge3/lib/python3.9/site-packages/numpy/core/__init__.py in <module>
21 try:
---> 22 from . import multiarray
23 except ImportError as exc:
~/miniforge3/lib/python3.9/site-packages/numpy/core/multiarray.py in <module>
11
---> 12 from . import overrides
13 from . import _multiarray_umath
~/miniforge3/lib/python3.9/site-packages/numpy/core/overrides.py in <module>
6
----> 7 from numpy.core._multiarray_umath import (
8 add_docstring, implement_array_function, _get_implementing_args)
ImportError: …Run Code Online (Sandbox Code Playgroud) apple-silicon ×10
macos ×5
apple-m1 ×3
python ×2
xcode ×2
cpan ×1
ios ×1
kubernetes ×1
mini-forge ×1
minikube ×1
neovim ×1
numpy ×1
objective-c ×1
performance ×1
perl ×1
python-3.x ×1
react-native ×1
swift ×1
treesitter ×1
x86-64 ×1
xcodebuild ×1