编译安装 rocketmq-client-cpp

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

cd rocketmq-client-cpp

# 赋予执行权限
chmod +x build.sh

# 执行编译脚本
./build.sh


mkdir -p /root/rocketmq-client-cpp/doc

# 安装 rocketmq-client-cpp 到系统目录

cd /root/rocketmq-client-cpp/tmp_build_dir

# 安装库文件和头文件到系统目录
make install

# 刷新动态链接库缓存
ldconfig

编译安装 rocketmq-client-php

git clone https://github.com/lpflpf/rocketmq-client-php.git

cd rocketmq-client-php


# 1. 清理之前的配置(如果有)
make clean 2>/dev/null
/usr/local/php/bin/phpize --clean 2>/dev/null

# 2. 生成配置脚本(使用你的 PHP)
/usr/local/php/bin/phpize

# 配置编译选项 -- 指定rocketmq-client-cpp的方式
CFLAGS="-fcommon" \
CPPFLAGS="-I/root/rocketmq-client-cpp/include" \
LDFLAGS="-L/root/rocketmq-client-cpp/bin -L/root/rocketmq-client-cpp/tmp_build_dir" \
./configure --with-php-config=/usr/local/php/bin/php-config \
  --enable-rocketmq_client_php

# 配置编译选项 -- rocketmq-client-cpp已安装到系统目录的方式
# 使用 -fcommon 编译选项
CFLAGS="-fcommon" \
./configure --with-php-config=/usr/local/php/bin/php-config \
  --enable-rocketmq_client_php

make

make install


cd /usr/local/php/lib/php/extensions/no-debug-non-zts-20190902/


# 后续增加增加扩展即可
作者:admin  创建时间:2025-12-07 14:39
最后编辑:admin  更新时间:2025-12-07 22:00