首先下载代码
git clone https://github.com/mongodb/mongo-tools
1.修改mongo-tools/release/platform/platform.go源码
将ArchArm64和ArchAarch64添加到Arch常量定义中:
type Arch string const ( ArchArm64 Arch = "arm64" ArchAarch64 Arch = "aarch64" // 其他架构的定义... )
2.在platforms切片中,为CentOS 7的ARM64架构添加一个新的平台配置项:
{ Name: "centos7", Arch: ArchAarch64, OS: OSLinux, Pkg: PkgRPM, Repos: []Repo{RepoEnterprise, RepoOrg}, BuildTags: defaultBuildTags, },
3.在DetectLocal函数中,根据ARM64架构的CentOS 7系统返回新添加的平台配置项:
case "Linux": if archName == ArchAarch64 { pf, ok := GetByOsAndArch("centos7", archName) if !ok { panic("centos7 platform name changed") } return pf, nil } // 其他操作系统和架构的检测...
完成上述更改后,您的代码将支持ARM64架构的CentOS 7系统。
4.运行编译所有组件:
./make build
或者指定组件编译
./make build -pkgs=bsondump,mongodump,mongoexport,mongofiles,mongoimport,mongoreplay,mongorestore,mongostat,mongotop