Before you use the SDK for C++ of the Community Edition to connect to ApsaraMQ for RocketMQ to send and receive messages, you must follow the steps provided in this topic to install the C++ dynamic library.
Prerequisites
Before making preparations, ensure that your operating system meets the following requirements:
- Linux: CentOS 6.8, CentOS 7.2, RHEL 6.x, or RHEL 7.x
- Darwin: macOS Mojave 10.14.x
- Debian:Ubuntu 18.04
Installing the CPP Dynamic Library
At present, the dynamic library of CPP has provided binary release, which can directly obtain open source code. For more information, see Release Notes. To facilitate installation, this article takes community version 2.0.1 as an example to explain different operating systems:
- CentOS 7.2 and RHEL 7.x
By default, CentOS supports RPM management. The RPM package is named rocketmq-client-cpp-2.0.1. You can run the following
rpmcommands to install the package.rpm -ivh https://github.com/apache/rocketmq-client-cpp/releases/download/2.0.1/rocketmq-client-cpp-2.0.1-centos7.x86_64.rpm - CentOS 6.8 and RHEL 6.x
Compared with CentOS 7, CentOS 6.8 has the same installation steps and only uses different RPM packages. Refer to the following command.
rpm -ivh https://github.com/apache/rocketmq-client-cpp/releases/download/2.0.1/rocketmq-client-cpp-2.0.1-centos6.x86_64.rpm - macOS Mojave 10.14
macOS does not provide package management tools. You can run the following command to manually install the dynamic library:
mkdir cppsdk cd cppsdk wget https://github.com/apache/rocketmq-client-cpp/releases/download/2.0.1/rocketmq-client-cpp-2.0.1-bin-release-darwin.tar.gz tar -xzf rocketmq-client-cpp-2.0.1-bin-release-darwin.tar.gz cp rocketmq-client-cpp/lib/* /usr/local/lib/ mkdir -p /usr/local/include/rocketmq/ cp rocketmq-client-cpp/include/* /usr/local/include/rocketmq/ install_name_tool -id "@rpath/librocketmq.dylib" /usr/local/lib/librocketmq.dylib - Ubuntu 18.04
The Ubuntu 18.04 operating system kernel is the Debain system. The default package management tool used is dpkg, and the package name is rocketmq_2.0.1_amd64.deb. You can run the following command to install the instance:
wget https://github.com/apache/rocketmq-client-cpp/releases/download/2.0.1/rocketmq-client-cpp-2.0.1.amd64.deb dpkg -i rocketmq-client-cpp-2.0.1.amd64.deb
At this point, you have completed the installation of the CPP dynamic library.