macos中安装和设置ninja

1、在安装ninja的过程中需要先安装re2c(github地址:https://github.com/skvadrik/re2c):

git clone https://github.com/skvadrik/re2c.git

(也可直接下载最新的release压缩包,并解压。下载地址:https://github.com/skvadrik/re2c/releases)

打开终端,cd到re2c目录下执行:

./autogen.sh

这一步若报错:autoreconf: command not found,说明未安装automake,执行第2步安装automark;若执行成功直接执行第3步

2、通过homebrew安装automake,若未安装homebrew,先执行以下命令安装homebrew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

已安装homebrew,安装automake:

brew install automake

安装libtool

brew install libtool

以上步骤完成之后,接着执行第1步

3、接着执行:

$ ./configure 
$ make -j4 && make install

4、以上3步之后,rec2就安装完成了,接下来安装ninja,执行以下命令:

git clone https://github.com/ninja-build/ninja.git && cd ninja

Python安装:

./configure.py --bootstrap

CMake安装:

cmake -Bbuild-cmake -H.

cmake --build build-cmake

最后,将可执行文件拷贝到/usr/bin/(或/usr/local/bin)目录下:

cp ninja /usr/bin/   #使用sudo不能复制到/usr/bin/目录下,可使用下面的方法ln -s /Users/mac/code/ninja/ninja /usr/local/bin/ninja

注:在/.zshrc或/.bash_profile文件中,设置alias=/Users/mac/code/ninja/ninja,没起作用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值