RocketMQ C++ SDK编译记录

1、下载源码

 git clone --depth=1 https://github.com/apache/rocketmq-client-cpp

2、编译

cd rocketmq-client-cpp
# 漫长等待下载编译各种依赖库
./build.sh

3、安装bzip库

  • 在编译boost时,发现iostreams已经开启编译:

    - 32-bit                   : no  (cached)
    - 64-bit                   : yes (cached)
    - arm                      : no  (cached)
    - mips1                    : no  (cached)
    - power                    : no  (cached)
    - sparc                    : no  (cached)
    - x86                      : yes (cached)
    - zlib                     : yes (cached)
    - iconv (libc)             : yes (cached)
    - icu                      : no  (cached)
    - icu (lib64)              : no  (cached)
    - compiler-supports-ssse3  : yes (cached)
    - has_icu builds           : no  (cached)
    - lockfree boost::atomic_flag : yes (cached)
    - compiler-supports-avx2   : yes (cached)

Component configuration:

    - atomic                   : building
    - chrono                   : building
    - container                : not building
    - context                  : not building
    - coroutine                : not building
    - date_time                : building
    - exception                : not building
    - filesystem               : building
    - graph                    : not building
    - graph_parallel           : not building
    - iostreams                : building
    - locale                   : building
    - log                      : building
    - math                     : not building
    - mpi                      : not building
    - program_options          : not building
    - python                   : not building
    - random                   : not building
    - regex                    : building
    - serialization            : building
    - signals                  : not building
    - system                   : building
    - test                     : not building
    - thread                   : building
    - timer                    : not building
    - wave                     : not building
  • 但是编译过程中,发现编译iostreams 失败:
gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.8.5/release/link-static/threading-multi/bzip2.o
libs/iostreams/src/bzip2.cpp:20:56: fatal error: bzlib.h: No such file or directory
 #include "bzlib.h"  // Julian Seward's "bzip.h" header.
                                                        ^
compilation terminated.

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pthread -m64 -fPIC -fPIC -DBOOST_ALL_NO_LIB=1 -DBOOST_IOSTREAMS_USE_DEPRECATED -DNDEBUG  -I"." -c -o "bin.v2/libs/iostreams/build/gcc-4.8.5/release/link-static/threading-multi/bzip2.o" "libs/iostreams/src/bzip2.cpp"

...failed gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.8.5/release/link-static/threading-multi/bzip2.o...
...skipped libboost_iostreams.a(clean) for lack of bzip2.o...
...skipped libboost_iostreams.a for lack of bzip2.o...
...skipped 

libboost_iostreams.a for lack of libboost_iostreams.a... ...failed updating 1 target... ...skipped 3 targets...

  • 但是rocketmq-cpp编译时发现,它依赖boost.iostreams, 解决办法:
sudo yum install  bzip2-devel.x86_64
  • 重新编译
./build.sh

4、路径

 /home/user/rocketmq-client-cpp/include
 /home/user/rocketmq-client-cpp/bin/include
 /home/user/rocketmq-client-cpp/bin/librocketmq.so

你可能感兴趣的:(RocketMQ C++ SDK编译记录)