如何在Windows机器上安装和配置KafkaCat?

时间:2017-02-23 14:17:15

标签: apache-kafka kafkacat

我正在尝试在Windows机器上安装kafkaCat工具。 在通过运行./bootstrap.sh进行快速构建时,我收到以下错误:

$ ./bootstrap.sh
Directory librdkafka already exists, not downloading https://github.com/edenhill/librdkafka/archive/master.tar.gz
Directory libyajl already exists, not downloading https://github.com/lloyd/yajl/archive/master.tar.gz
Building librdkafka
checking for OS or distribution... ok (MINGW64_NT-6.1)
checking for C compiler from CC env... failed
checking for gcc (by command)... failed
checking for clang (by command)... failed
checking for cc (by command)... failed (fail)
checking for C++ compiler from CXX env... failed
checking for C++ compiler (g++)... failed
checking for C++ compiler (clang++)... failed
checking for C++ compiler (c++)... failed (fail)
checking executable ld... failed (disable)
checking executable nm... failed (disable)
checking executable objdump... failed (disable)
checking executable strip... failed (disable)
checking for pkgconfig (by command)... failed
checking for install (by command)... ok
checking for PIC (by compile)... failed (disable)
checking for GNU-compatible linker options... failed
checking for OSX linker options... failed
checking for GNU linker-script ld flag... failed
checking for Solaris linker-script ld flag... failed (ignore)
checking for __atomic_32 (by compile)... failed
checking for __atomic_32_lib (by compile)... failed
checking for __sync_32 (by compile)... failed (disable)
checking for __atomic_64 (by compile)... failed
checking for __atomic_64_lib (by compile)... failed
checking for __sync_64 (by compile)... failed (disable)
checking for socket (by compile)... failed
checking for socket_nsl (by compile)... failed (fail)
parsing version '0x00090401'... ok (0.9.4)
checking for libpthread (by compile)... failed (fail)
checking for zlib (by compile)... failed (disable)
checking for libcrypto (by compile)... failed (disable)
checking for liblz4 (by compile)... failed (disable)
checking for libssl (by compile)... failed (disable)
checking for libsasl2 (by compile)... failed (disable)
checking for libsasl (by compile)... failed (disable)
checking for regex (by compile)... failed (disable)
checking for librt (by compile)... failed
checking for strndup (by compile)... failed (disable)
checking for nm (by env NM)... failed



###########################################################
###                  Configure failed                   ###
###########################################################
### Accumulated failures:                               ###
###########################################################
 cc (WITH_CC)
module: cc
action: fail
reason:
command 'cc --version' failed:
mklove/modules/configure.base: line 1110: cc: command not found

 cxx (WITH_CXX) C++ compiler (c++)
module: cc
action: fail
reason:
command 'c++ --version' failed:
mklove/modules/configure.base: line 1110: c++: command not found

 socket_nsl ()
module: socket
action: fail
reason:
compile check failed:
CC: CC
flags:
  -g -O2 -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wall -Werror  _mkltmpc57mad.c -o _mkltmpc57mad.c.o -lsocket -lnsl :
mklove/modules/configure.base: line 917: -g: command not found
source:
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
void foo (void) {
   int s = socket(0, 0, 0);
   close(s);
}

 libpthread ()
module: librdkafka
action: fail
reason:
compile check failed:
CC: CC
flags: -lpthread
  -g -O2 -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wall -Werror -lpthread _mkltmp0Vm7ew.c -o _mkltmp0Vm7ew.c.o  :
mklove/modules/configure.base: line 917: -g: command not found
source: #include <pthread.h>

Build of librdkafka FAILED!
Failed to build librdkafka: bootstrap failed

有谁知道如何在Windows机器中配置kafkaCat?
提前致谢。

1 个答案:

答案 0 :(得分:0)

我从未尝试过使用MinGW构建librdkafka,但它应该是可能的。看起来你错过了构建工具链(没有cc,ld,nm等)。

有关详细信息,请参阅MinGW安装说明: http://www.mingw.org/wiki/howto_install_the_mingw_gcc_compiler_suite

从您的描述中还不清楚这是尝试原生还是交叉编译。

Native Win32 build / Visual Studio

另一种可能更好的替代方法是在Visual Studio中构建kafkacat:

  • 在Visual Studio中打开kafkacat \ win32 \ kafkacat.sln VS解决方案
  • 在kafkacat项目上,右键单击并选择&#34;恢复包&#34;
  • 从构建菜单中选择&#34;重建解决方案&#34;

这应该会给你一个kafkacat.exe在本机win32中工作(不需要mingw,cygwin,..)

如果您发现此方法有任何问题,请直接在kafkacat project上提交问题。

相关问题