2

I am trying to install kafkaCat tool in windows machine. While doing a quick build by running ./bootstrap.sh, I am getting following error:

$ ./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

Does anyone know how to configure kafkaCat in windows machine?
Thanks in advance.

Praveen
  • 1,218
  • 1
  • 14
  • 25

1 Answers1

3

I've never tried building librdkafka with MinGW but it should be possible. It looks like you are missing the build toolchain (no cc, ld, nm, etc).

See the MinGW installation instructions for more info: http://www.mingw.org/wiki/howto_install_the_mingw_gcc_compiler_suite

It is also not clear from your description whether this is an attempt at native or cross compilation.

Native Win32 builds / Visual Studio

Another, probably better, alternative is to build kafkacat in Visual Studio:

  • Open the kafkacat\win32\kafkacat.sln VS solution in Visual Studio
  • On the kafkacat project, right click and select "Restore packages"
  • From the Build menu select "Rebuild solution"

This should give you a kafkacat.exe that works in native win32 (no need for mingw, cygwin, ..)

If you find any problems with this approach please file an issue directly on the kafkacat project.

Edenhill
  • 2,298
  • 17
  • 30
  • Thanks for this share... I was able to build a native binary of kafkacat on Windows with this info. However, I wasn't able to figure out how to add json and avro support to the Visual Studo project though. – Edward J Beckett Oct 21 '19 at 14:50
  • Avro will not be supported in Kafkacat on Windows any time soon due to libserdes not being available for Windows – Edenhill Oct 22 '19 at 14:56
  • Thanks @Edenhill... Any advice on adding `libyajl` to the VS project? – Edward J Beckett Oct 22 '19 at 17:31
  • The easiest approach would be to use a nuget package, there only seems to be one and it is not very up to date, but it might work: https://www.nuget.org/packages/yajl.v120.dyn-rt.static/ – Edenhill Oct 23 '19 at 06:49
  • ~ Much appreciated ... I'll spin up a build to see if works out.. Thanks again mate. – Edward J Beckett Oct 23 '19 at 12:21
  • Hi @Edenhill, i am trying to follow your better alternative, i.e the _VS Solution_, but i am having trouble, can you help? I have opened the kafkacat.sln in Visual Studio Code, and i see 28 lines of code, ending with `EndGlobal`. What's next? Thanks. – jumping_monkey Jan 07 '20 at 09:16