简体   繁体   English

无法在 Apple Silicon M1 上启动 solana-test-validator

[英]Failed to start solana-test-validator on Apple Silicon M1

When I try to run solana-test-validator, I get the following terminal output with error:当我尝试运行 solana-test-validator 时,我得到以下终端 output 错误:

--faucet-sol argument ignored, ledger already exists
Ledger location: test-ledger
Log: test-ledger/validator.log
Error: failed to start validator: TestValidator startup failed: Custom { kind: Other, error: "Discover failed" }

My solana config get :我的solana config get

Config File: /Users/wojciech/.config/solana/cli/config.yml
RPC URL: http://localhost:8899
WebSocket URL: ws://localhost:8900/ (computed)
Keypair Path: /Users/wojciech/.config/solana/id.json
Commitment: confirmed

rustc versionL rustc 1.58.0 (02072b482 2022-01-11) rustc 版本L rustc 1.58.0 (02072b482 2022-01-11)

I've tried with both installation ways: recommended- via curl and I have also built and installed from source (both ver 1.9.4).我尝试了两种安装方式:推荐-通过 curl 并且我也从源代码构建和安装(均为 1.9.4 版)。 No errors or warnings during both installations.两次安装期间都没有错误或警告。

Build from source allows you functionality for both solana-test-validator and allows one to utilize the anchor environment to build and test.从源代码构建允许您使用solana-test-validator功能,并允许使用锚环境来构建和测试。 You can use cargo build and cargo test but that will not populate the target/idl with the proper artifacts needed.您可以使用cargo buildcargo test ,但这不会使用所需的适当工件填充target/idl

Note: You will need to run the command solana-test-validator from within your project directory once the symlink to the path is set.注意:一旦设置了路径的符号链接,您将需要从项目目录中运行命令solana-test-validator So if you're project is hello-world, you run the test-validator from there, not the Solana source files.因此,如果您的项目是 hello-world,则从那里运行测试验证器,而不是 Solana 源文件。

In the below instructions, build-source refers to the Source code (tar.gz) file you download to follow the instructions to build from source in order to install the Solana CLI tools found here: https://docs.solana.com/cli/install-solana-cli-tools#build-from-source在以下说明中,build-source 是指您下载的源代码 (tar.gz) 文件,以按照说明从源代码构建以安装此处找到的 Solana CLI 工具: https://docs.solana.com/ cli/install-solana-cli-tools#build-from-source

Go to sdk/cargo-build-bpf from the build-source project root. Go 从 build-source 项目根目录到sdk/cargo-build-bpf From there, run the following:从那里,运行以下命令:

cargo install --path .

Verify the path created by opening a separate terminal and navigating to ~/.cargo/bin .通过打开一个单独的终端并导航到~/.cargo/bin来验证创建的路径。 List the contents of bin with:列出 bin 的内容:

ln -l .

You will either see SDK or cargo-build-bpf.您将看到 SDK 或 cargo-build-bpf。 On my Mac M1 chip running Monterey, I found the path to end with the latter.在运行 Monterey 的 Mac M1 芯片上,我找到了以后者结束的路径。

So, On an apple M1 chip the cargo-build-bpf program is installed to the path ~/.cargo/bin/cargo-build-bpf .因此,在苹果 M1 芯片上,cargo-build-bpf 程序安装到路径~/.cargo/bin/cargo-build-bpf This will allow you to run commands like anchor build successfully in your local project root once you create a symlink from it to the path in your Solana source code/bin/sdk folder.这将允许您在本地项目根目录中成功运行诸如anchor build之类的命令,一旦您从它创建一个符号链接到您的 Solana 源code/bin/sdk文件夹中的路径。

In a separate terminal navigate to ~/.cargo/bin and create a symlink to the sdk folder in the build-source project's bin folder, like this:在一个单独的终端中导航到~/.cargo/bin并在 build-source 项目的 bin 文件夹中创建一个指向 sdk 文件夹的符号链接,如下所示:

ln -s solana-1.9.2/bin/sdk ~/.cargo/bin/cargo-build-bpf

Replace solana-1.9.2 with the build-source code you downloaded earlier.solana-1.9.2替换为您之前下载的构建源代码。

You can try checking the logs at test-ledger/validator.log .您可以尝试在test-ledger/validator.log检查日志。 Usually it will be some ERROR message like通常它会是一些错误消息,如

re^[[0m^[[38;5;8m]^[[0m On mac OS you may need to run |sudo launchctl limit maxfiles 500000 500000| first

Running sudo launchctl limit maxfiles 500000 500000 fixes it in many cases.在许多情况下,运行sudo launchctl limit maxfiles 500000 500000可以修复它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM