M4 lotus 源码编译安装

查看系统版本

sw_vers
ProductName:		macOS
ProductVersion:		15.1

安装依赖

xcode-select -p
/Library/Developer/CommandLineTools
brew install go jq pkg-config hwloc coreutils
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

设置环境变量

export LIBRARY_PATH=/opt/homebrew/lib
export FFI_BUILD_FROM_SOURCE=1
export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH"

源码编译

lotus/extern/filecoin-ffi/libfilcrypto.a[255](2e40c9e35e9506f4-helpers.o)) was built for newer 'macOS' version (15.1) than being linked (15.0)
make clean
CGO_CFLAGS="-mmacosx-version-min=15.1" CGO_LDFLAGS="-mmacosx-version-min=15.1" make all

忽略 重复库的警告

# github.com/filecoin-project/lotus/cmd/lotus
ld: warning: ignoring duplicate libraries: '-lSystem', '-lc', '-lhwloc', '-liconv', '-lm', '-lproc',

查看当前链接的库

otool -L lotus

查看版本

./lotus --version
lotus version 1.28.3+mainnet+git.3c4334071
./lotus-miner --version
lotus-miner version 1.28.3+mainnet+git.3c4334071
./lotus-worker --version
lotus-worker version 1.28.3+mainnet+git.3c4334071

参考

  1. m1-based-cpus
上一篇:三 Spring的入门程序


下一篇:A. Verify Password