ArchLinux上安装librdkafka

ArchLinux上安装librdkafka

Table of Contents

  • 1. 下载github代码
  • 2. 编译
  • 3. 安装

1 下载github代码

git clone https://github.com/edenhill/librdkafka.git

2 编译

确保在master branch中,然后运行命令

[dean@dell_xps_13 librdkafka]$ ./configure 
checking for OS or distribution... ok (Linux)
checking for C compiler from CC env... failed
checking for gcc (by command)... ok
checking for C++ compiler from CXX env... failed
checking for C++ compiler (g++)... ok
checking executable ld... ok
checking executable nm... ok
checking executable objdump... ok
checking executable strip... ok
checking for pkgconfig (by command)... ok
checking for install (by command)... ok
checking for PIC (by compile)... ok
checking for GNU-compatible linker options... ok
checking for GNU linker-script ld flag... ok
checking for __atomic_32 (by compile)... ok
checking for __atomic_64 (by compile)... ok
checking for socket (by compile)... ok
parsing version '0x00090100'... ok (0.9.1)
checking for libpthread (by pkg-config)... failed
checking for libpthread (by compile)... ok
checking for zlib (by pkg-config)... ok
checking for libcrypto (by pkg-config)... ok
checking for libssl (by pkg-config)... ok
checking for libsasl2 (by pkg-config)... failed
checking for libsasl2 (by compile)... ok
checking for regex (by compile)... ok
checking for librt (by pkg-config)... failed
checking for librt (by compile)... ok
Tchecking for strndup (by compile)... ok
checking for nm (by env NM)... ok (cached)
checking for python (by command)... ok
Generated Makefile.config
Generated config.h

Configuration summary:
  prefix                   /usr/local
  ARCH                     x86_64
  CPU                      generic
  GEN_PKG_CONFIG           y
  ENABLE_DEVEL             n
  ENABLE_VALGRIND          n
  ENABLE_REFCNT_DEBUG      n
  ENABLE_SHAREDPTR_DEBUG   n
  ENABLE_SSL               y
  ENABLE_SASL              y
  MKL_APP_NAME             librdkafka
  MKL_APP_DESC_ONELINE     The Apache Kafka C/C++ library
  MKL_DISTRO               Linux
  CC                       gcc
  CXX                      g++
  LD                       ld
  NM                       nm
  OBJDUMP                  objdump
  STRIP                    strip
  CPPFLAGS                 -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith
  PKG_CONFIG               pkg-config
  INSTALL                  install
  LIB_LDFLAGS              -shared -Wl,-soname,$(LIBFILENAME)
  LDFLAG_LINKERSCRIPT      -Wl,--version-script=
  RDKAFKA_VERSION_STR      0.9.1
  MKL_APP_VERSION          0.9.1
  LIBS                     -lpthread -lz -lcrypto -lssl -lsasl2 -lrt
  CFLAGS                   
  CXXFLAGS                 -Wno-non-virtual-dtor
  SYMDUMPER                $(NM) -D
  exec_prefix              /usr/local
  bindir                   /usr/local/bin
  sbindir                  /usr/local/sbin
  libexecdir               /usr/local/libexec
  datadir                  /usr/local/share
  sysconfdir               /usr/local/etc
  sharedstatedir           /usr/local/com
  localstatedir            /usr/local/var
  libdir                   /usr/local/lib
  includedir               /usr/local/include
  infodir                  /usr/local/info
  mandir                   /usr/local/man
Generated config.cache

Now type 'make' to build

会出现一些failed信息, 只要在最后没有大段的错误信息,这些是可以接收的,因为只是在判断哪个库可可以用。比如

checking for C compiler from CC env... failed
checking for gcc (by command)... ok

运行make编译,很快完成。

3 安装

sudo make install, 默认会安装在/usr/local/目录下的lib和include/librdkafka目录中.

[dean@dell_xps_13 librdkafka]$ sudo make install
[sudo] password for dean: 
make[1]: Entering directory '/home/dean/work/github/librdkafka/src'
Install librdkafka to /usr/local
install -d $DESTDIR/usr/local/include/librdkafka ; \
install -d $DESTDIR/usr/local/lib ; \
install rdkafka.h $DESTDIR/usr/local/include/librdkafka ; \
install librdkafka.a $DESTDIR/usr/local/lib ; \
install librdkafka.so.1 $DESTDIR/usr/local/lib ; \
[ -f "rdkafka.pc" ] && ( \
        install -d $DESTDIR/usr/local/lib/pkgconfig ; \
        install -m 0644 rdkafka.pc $DESTDIR/usr/local/lib/pkgconfig \
) ; \
(cd $DESTDIR/usr/local/lib && ln -sf librdkafka.so.1 librdkafka.so)
make[1]: Leaving directory '/home/dean/work/github/librdkafka/src'
make[1]: Entering directory '/home/dean/work/github/librdkafka/src-cpp'
Install librdkafka++ to /usr/local
install -d $DESTDIR/usr/local/include/librdkafka ; \
install -d $DESTDIR/usr/local/lib ; \
install rdkafkacpp.h $DESTDIR/usr/local/include/librdkafka ; \
install librdkafka++.a $DESTDIR/usr/local/lib ; \
install librdkafka++.so.1 $DESTDIR/usr/local/lib ; \
[ -f "rdkafka++.pc" ] && ( \
        install -d $DESTDIR/usr/local/lib/pkgconfig ; \
        install -m 0644 rdkafka++.pc $DESTDIR/usr/local/lib/pkgconfig \
) ; \
(cd $DESTDIR/usr/local/lib && ln -sf librdkafka++.so.1 librdkafka++.so)

Created: 2016-04-29 Fri 14:47

Validate

你可能感兴趣的:(linux,kafka,Arch)