This is an automated email from the ASF dual-hosted git repository.
jamesge pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git
The following commit(s) were added to refs/heads/master by this push:
new 9556320a Elaborate how-to-build steps for MacOS
9556320a is described below
commit 9556320afc049419e0021ba404d106a72de5d215
Author: James Ge <[email protected]>
AuthorDate: Wed Jun 8 20:11:08 2022 +0800
Elaborate how-to-build steps for MacOS
---
docs/cn/getting_started.md | 28 +++++++++++++++++-----------
docs/en/getting_started.md | 31 ++++++++++++++++++-------------
2 files changed, 35 insertions(+), 24 deletions(-)
diff --git a/docs/cn/getting_started.md b/docs/cn/getting_started.md
index b4af85a5..2602f5b4 100644
--- a/docs/cn/getting_started.md
+++ b/docs/cn/getting_started.md
@@ -213,6 +213,10 @@ $ make
注意:在相同硬件条件下,MacOS版brpc的性能可能明显差于Linux版。如果你的服务是性能敏感的,请不要使用MacOS作为你的生产环境。
+### Apple Silicon
+
+master HEAD已支持M1系列芯片,M2未测试过。欢迎通过issues向我们报告遗留的warning/error。
+
### 依赖准备
安装依赖:
@@ -225,22 +229,17 @@ brew install openssl git gnu-getopt coreutils gflags
protobuf leveldb
brew install gperftools
```
-如果你要运行测试,那么要安装并编译googletest(它没有被默认编译):
+如果你要运行测试,需安装gtest。先运行`brew install
googletest`看看homebrew是否支持(老版本没有),没有的话请下载和编译googletest:
```shell
git clone https://github.com/google/googletest -b release-1.10.0 && cd
googletest/googletest && mkdir build && cd build && cmake
-DCMAKE_CXX_FLAGS="-std=c++11" .. && make
```
-在编译完成后,复制include/和lib/目录到/usr/local/include和/usr/local/lib目录中,以便于让所有应用都能使用gtest。
-
-### Monterey
-Monterey中openssl的安装位置可能不再位于`/usr/local/opt/openssl`,很可能会在`/opt/homebrew/Cellar`目录下,如果编译时报告找不到openssl,可考虑设置软链如下:
-```shell
-sudo ln -s /opt/homebrew/Cellar/openssl@3/3.0.3 /usr/local/opt/openssl
-```
-请注意上述命令中openssl的目录可能随环境变化而变化,你可以通过`brew info openssl`查看。
+在编译完成后,复制`include/`和`lib/`目录到`/usr/local/include`和`/usr/local/lib`目录中,以便于让所有应用都能使用gtest。
-### Apple Silicon
+### OpenSSL
+Monterey中openssl的安装位置可能不再位于`/usr/local/opt/openssl`,很可能会在`/opt/homebrew/Cellar`目录下,如果编译时报告找不到openssl:
-master HEAD已支持M1系列芯片,M2未测试过。欢迎通过issues向我们报告遗留的warning/error。
+* 先运行`brew link openssl --force`看看`/user/local/opt/openssl`是否出现了
+* 没有的话可以自行设置软链:`sudo ln -s /opt/homebrew/Cellar/openssl@3/3.0.3
/usr/local/opt/openssl`。请注意此命令中openssl的目录可能随环境变化而变化,可通过`brew info openssl`查看。
### 使用config_brpc.sh编译brpc
git克隆brpc,进入到项目目录然后运行:
@@ -248,6 +247,13 @@ git克隆brpc,进入到项目目录然后运行:
$ sh config_brpc.sh --headers=/usr/local/include --libs=/usr/local/lib
--cc=clang --cxx=clang++
$ make
```
+MacOS Monterey下的brew安装路径可能改变,如有路径相关的错误,可考虑设置如下:
+
+```shell
+$ sh config_brpc.sh --headers=/opt/homebrew/include --libs=/opt/homebrew/lib
--cc=clang --cxx=clang++
+$ make
+```
+
不想链接调试符号,添加选项`--nodebugsymbols`,然后编译将会得到更轻量的二进制文件。
使用glog版的brpc,添加选项`--with-glog`。
diff --git a/docs/en/getting_started.md b/docs/en/getting_started.md
index 03e34cf6..c500f580 100644
--- a/docs/en/getting_started.md
+++ b/docs/en/getting_started.md
@@ -217,6 +217,10 @@ Same with [here](#compile-brpc-with-cmake)
Note: With same environment, the performance of the MacOS version is worse
than the Linux version. If your service is performance-critical, do not use
MacOS as your production environment.
+### Apple Silicon
+
+The code at master HEAD already supports M1 series chips. M2 series are not
tested yet. Please feel free to report remaining warnings/errors to us by
issues.
+
### Prepare deps
Install dependencies:
@@ -229,25 +233,18 @@ If you need to enable cpu/heap profilers in examples:
brew install gperftools
```
-If you need to run tests, download and compile googletest (which is not
compiled yet):
+If you need to run tests, googletest is required. Run `brew install
googletest` first to see if it works. If not (old homebrew does not have
googletest), you can download and compile googletest by your own:
```shell
git clone https://github.com/google/googletest -b release-1.10.0 && cd
googletest/googletest && mkdir build && cd build && cmake
-DCMAKE_CXX_FLAGS="-std=c++11" .. && make
```
-After the compilation, copy include/ and lib/ into /usr/local/include and
/usr/local/lib respectively to expose gtest to all apps
+After the compilation, copy `include/` and `lib/` into `/usr/local/include`
and `/usr/local/lib` respectively to expose gtest to all apps
-### Monterey
+### OpenSSL
-openssl installed in Monterey may not be found at `/usr/local/opt/openssl`,
instead it's probably put under `/opt/homebrew/Cellar`. If the compiler cannot
find openssl, consider making a soft link like below:
+openssl installed in Monterey may not be found at `/usr/local/opt/openssl`,
instead it's probably put under `/opt/homebrew/Cellar`. If the compiler cannot
find openssl:
-```shell
-sudo ln -s /opt/homebrew/Cellar/openssl@3/3.0.3 /usr/local/opt/openssl
-```
-
-Please note that the directory of installed openssl in above command may be
different in different environments, you could check it out by running `brew
info openssl`.
-
-### Apple Silicon
-
-The code at master HEAD already supports M1 series chips. M2 series are not
tested yet. Please feel free to report remaining warnings/errors to us by
issues.
+* Run `brew link openssl --force` first and check if `/user/local/opt/openssl`
appears.
+* If above command does not work, consider making a soft link using `sudo ln
-s /opt/homebrew/Cellar/openssl@3/3.0.3 /usr/local/opt/openssl`. Note that the
installed openssl in above command may be put in different places in different
environments, which could be revealed by running `brew info openssl`.
### Compile brpc with config_brpc.sh
git clone brpc, cd into the repo and run
@@ -255,6 +252,14 @@ git clone brpc, cd into the repo and run
$ sh config_brpc.sh --headers=/usr/local/include --libs=/usr/local/lib
--cc=clang --cxx=clang++
$ make
```
+
+The homebrew in Monterey may install software at different directories from
before. If path related errors are reported, try setting headers/libs like
below:
+
+```shell
+$ sh config_brpc.sh --headers=/opt/homebrew/include --libs=/opt/homebrew/lib
--cc=clang --cxx=clang++
+$ make
+```
+
To not link debugging symbols, add `--nodebugsymbols` and compiled binaries
will be much smaller.
To use brpc with glog, add `--with-glog`.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]