AIX6.1下编译librdkafka

前置安装包

  1. 首先需要安装 g++ 环境,可参考我的上一篇博文 AIX6.1安装 g++
  2. 安装 mktemp,configure脚本需要
rpm -ivh mktemp-1.7-1.aix5.1.ppc.rpm
  1. 安装python
rpm -ivh expat-2.1.1-1.aix6.1.ppc.rpm
rpm -ivh gdbm-1.10-1.aix6.1.ppc.rpm
rpm -ivh readline-6.1-2.aix6.1.ppc.rpm
rpm -ivh python-2.7.5-1.aix6.1.ppc.rpm

修改文件

./src/snappy_compat.h

//#  include   -->
#  include 

编译

先载入环境变量

export AR_FLAGS='-X64 cru'
export CFLAGS='-maix64 -g -O2 -pthread'
export NM='nm -X64'

./configure --disable-sasl
cd src
make all

问题

  • 问题1

abmhost03:[/abmapp/abmsrc/soft/librdkafka-0.9.2/src]#make
“Makefile”, line 5: make: 1254-055 Dependency line needs colon or double colon operator.
“Makefile”, line 14: make: 1254-055 Dependency line needs colon or double colon operator.
“Makefile”, line 16: make: 1254-055 Dependency line needs colon or double colon operator.
“../mklove/Makefile.base”, line 24: make: 1254-055 Dependency line needs colon or double colon operator.
“../mklove/Makefile.base”, line 25: make: 1254-055 Dependency line needs colon or double colon operator.

由于make版本太低导致的,安装make3.81版本可以解决


  • 问题2

rdcrc32.h:30:18: fatal error: zlib.h: No such file or directory
安装gcc时只安装了zlib包,还需要安装 zlib-devel-1.2.8-1.aix6.1.ppc.rpm


  • 问题3

python: A file or directory in the path name does not exist.
安装python


如果需要调用zookeeper库,还需要编译jansson和zookeeper库

编译 jansson

gzip -dc jansson-2.7.tar.gz | tar -xvf -

export AR_FLAGS='-X64 cru'
export CFLAGS='-maix64 -g -O2 -pthread'
export NM='nm -X64'

问题

ld: 0711-317 ERROR: Undefined symbol: ._isnan

缺少数据函数
vi ./libtool
deplibs=” deplibslc">deplibs=" deplibs -lc -lm”


编译 zookeeper

export AR_FLAGS='-X64 cru'
export CFLAGS='-maix64 -g -O2 -pthread'
export NM='nm -X64'


  • 问题 1

src/zk_adaptor.h:261:9: error: conflicting types for ‘fetch_and_add’
int32_t fetch_and_add(volatile int32_t* operand, int incr);
/usr/include/sys/atomic_op.h:70:6: note: previous declaration of ‘fetch_and_add’ was here
int fetch_and_add(atomic_p,int);
vi src/zk_adaptor.h
vi src/mt_adaptor.c
注释fetch_and_add函数的声明和定义


  • 问题 2

ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_wait
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock
ld: 0711-317 ERROR: Undefined symbol: .pthread_cond_broadcast
链接时缺少pthread的库文件
vi Makefile
CFLAGS = -g -O2 -D_GNU_SOURCE –> CFLAGS = -maix64 -g -O2 -D_GNU_SOURCE -pthread

你可能感兴趣的:(KAFKA,AIX)