rdkafka编译

1、下载源码rakafka源码

  https://github.com/confluentinc/librdkafka 

2、安装openssl,可以参考
  https://www.cnblogs.com/ho966/p/15916018.html

3、如果要支持gssapi, 需要依赖cyrus-sasl 和krb5

3.1 安装krb5
  下载源码https://kerberos.org/dist/krb5/1.15/krb5-1.15.1.tar.gz
  解压缩 tar -xzvf krb5-1.15.1.tar.gz
  进入目录 cd ./krb5-1.15.1/src
  配置安装目录 ./configure --prefix=/root/share/git/krb5/bin --disable-rpath LDFLAGS="-Wl,-rpath,./"
  编译及安装 make && make install
  编译报错yacc: Command not found, yacc(Yet Another Compiler Compiler),是Unix/Linux上一个用来生成编译器的编译器,centos安装 byacc,yum install byacc

3.2 安装cyrus-sasl
  下载源码https://github.com/cyrusimap/cyrus-sasl/tree/cyrus-sasl-2.1.27

  ./autogen.sh 生成configure,
  如果报错aclocal: command not found,执行安装 yum install automake-1.13.4-3.el7.noarch
  如果报错 error: possibly undefined macro: AC_DISABLE_STATIC 执行安装 yum install libtool-2.4.2-22.el7_3.x86_64
  执行 ./configure --prefix=/root/share/git/cyrus-sasl/bin/ --enable-gssapi=/root/share/git/krb5/bin LDFLAGS="-Wl,-rpath,./" 
执行 make && make install

4、编译rdkafka

./configure --prefix=/root/share/git/rdkafka/bin --enable-ssl --enable-gssapi --CFLAGS="-I/root/share/git/openssl/include -I/root/share/git/cyrus-sasl/bin/include" --LDFLAGS="-L/root/share/git/openssl/lib -L/root/share/git/cyrus-sasl/bin/lib -Wl,-rpath,./"

posted @ 2023-09-08 19:32  ho966  阅读(137)  评论(0编辑  收藏  举报