lichao
2021-06-07 2c73aac1fe62495d8c863a92a34d191cf8e87fc0
add readme.
1个文件已添加
1个文件已修改
64 ■■■■■ 已修改文件
README.md 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utest/api_test.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
README.md
New file
@@ -0,0 +1,60 @@
# 简介
bhshmq 基于共享内存的消息通讯库,支持 请求-应答,发布-订阅 两种通讯方式。
客户端/节点 需要先向管理中心注册成功后才能正常收发消息。
# 开发环境:
    ubuntu 18.04, g++-7.5, cmake, ninja, vscode
# 依赖库:
## boost-1.75.0
### 准备
下载并解压 boost 库, 编译前需要先修改默认编译选项:打开 tools/build/src/tools/gcc.jam, 找到如下一行:
    compile-link-flags <link>shared/<target-os>$(non-windows) : -fPIC ;
在下面增加如下一行:
    compile-link-flags <link>static/<target-os>$(non-windows) : -fPIC ;
### 编译:
```shell
    ./bootstrap.sh
    ./b2 --with-timer --with-test --with-log link=static runtime-link=static threading=multi
```
### 安装:
    可以直接把代码和库连接到 /usr/local/include 和 /usr/local/lib
```shell
    cd /usr/local/include
    sudo ln <path_to_boost>/boost ./ -s
    cd /usr/local/lib
    sudo ln <path_to_boost>/stage/lib/lib*.a ./ -s
```
## protobuf-3.17.0
### 准备
下载并解压 protobuf 库.
### 编译:
```shell
    ./configure CFLAGS=-fPIC CXXFLAGS="-g -std=c++14 -DNDEBUG -fPIC -ffunction-sections -fdata-sections" LDFLAGS="-fPIC -static-libstdc++"
    make
    sudo make install
```
# bhshmq 编译
```shell
    mkdir build; cd build
    cmake -G Ninja -DCMAKE_BUILD_TYPE=RELEASE ..
    ninja
```
utest/api_test.cpp
@@ -293,8 +293,8 @@
        host.set_ip("127.0.0.1");
        host.set_port(kBHCenterPort);
        // center topic node address.
        host.set_mq_id(201);
        host.set_abs_addr(10072);
        // host.set_mq_id(201);
        // host.set_abs_addr(10072);
        std::string dest(host.SerializeAsString());
        void *proc_id = 0;