Building Pulsar C++ client
Supported platforms
The Pulsar C++ client has been successfully tested on MacOS and Linux.
系统要求
您需要安装以下内容才能使用C ++客户端:
编译
There are separate compilation instructions for MacOS and Linux. For both systems, start by cloning the Pulsar repository:
$ git clone https://github.com/apache/pulsar
Linux
首先,安装所有必需的依赖项:
$ apt-get install cmake libssl-dev libcurl4-openssl-dev liblog4cxx-dev \
libprotobuf-dev protobuf-compiler libboost-all-dev google-mock libgtest-dev libjsoncpp-dev
Then compile and install Google Test:
# libgtest-dev version is 1.18.0 or above
$ cd /usr/src/googletest
$ sudo cmake .
$ sudo make
$ sudo cp ./googlemock/libgmock.a ./googlemock/gtest/libgtest.a /usr/lib/
# less than 1.18.0
$ cd /usr/src/gtest
$ sudo cmake .
$ sudo make
$ sudo cp libgtest.a /usr/lib
$ cd /usr/src/gmock
$ sudo cmake .
$ sudo make
$ sudo cp libgmock.a /usr/lib
最后,在Pulsar repo中编译C ++的Pulsar客户端库:
$ cd pulsar-client-cpp
$ cmake .
$ make
首先,安装所有必需的依赖项:
MacOS
首先,安装所有必需的依赖项:
# OpenSSL installation
$ brew install openssl
$ export OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include/
$ export OPENSSL_ROOT_DIR=/usr/local/opt/openssl/
# Protocol Buffers installation
$ brew tap homebrew/versions
$ brew install protobuf260
$ brew install boost
$ brew install log4cxx
# Google Test installation
$ git clone https://github.com/google/googletest.git
$ cd googletest
$ cmake .
$ make install
然后在您克隆的repo中编译Pulsar客户端库:
$ cd pulsar-client-cpp
$ cmake .
$ make