Trouble building application with rdkafka

I am trying to build a minimal application to test out using a Kafka consumer and producer. When I try to build, I get the following error, which has me a bit confused. I am new to Rust, coming from a Scala/Java background, so a lot of the stack trace is not telling me anything I can interpret as useful.

/Users/mbossert/.cargo/bin/cargo check --color=always
   Compiling rdkafka-sys v1.0.0
error: failed to run custom build command for `rdkafka-sys v1.0.0`

Caused by:
  process didn't exit successfully: `/Users/mbossert/CLionProjects/metric_regression/target/debug/build/rdkafka-sys-b161e00d0fb90b2b/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=sasl2
Configuring librdkafka
using cache file config.cache
checking for OS or distribution... ok (osx)
checking for C compiler from CC env... failed
checking for gcc (by command)... ok (cached)
checking for C++ compiler from CXX env... failed
checking for C++ compiler (g++)... ok (cached)
checking executable ld... ok (cached)
checking executable nm... ok (cached)
checking executable objdump... ok (cached)
checking executable strip... ok (cached)
checking for debug symbols compiler flag (-g...)... ok (cached)
checking for pkgconfig (by command)... ok (cached)
checking for install (by command)... failed
checking for PIC (by compile)... ok (cached)
checking for GNU-compatible linker options... failed
checking for OSX linker options... ok (cached)
checking for GNU linker-script ld flag... failed
checking for Solaris linker-script ld flag... failed (ignore)
checking for __atomic_32 (by compile)... ok (cached)
checking for __atomic_64 (by compile)... ok (cached)
checking for socket (by compile)... ok (cached)
parsing version '0x010000ff'... ok (1.0.0)
checking for librt (by pkg-config)... failed
checking for librt (by compile)... failed
checking for libpthread (by pkg-config)... failed
checking for libpthread (by compile)... ok (cached)
checking for c11threads (by pkg-config)... failed
checking for c11threads (by compile)... failed (disable)
checking for libdl (by pkg-config)... failed
checking for libdl (by compile)... ok (cached)
checking for zlib (by pkg-config)... ok
checking for zlib (by compile)... ok (cached)
checking for libcrypto (by pkg-config)... ok
checking for libcrypto (by compile)... ok (cached)
checking for libssl (by pkg-config)... ok
checking for libssl (by compile)... ok (cached)
checking for libsasl2 (by pkg-config)... failed
checking for libsasl2 (by compile)... ok (cached)
checking for zstd (by pkg-config)... failed
checking for zstd (by compile)... ok (cached)
checking for libm (by pkg-config)... failed
checking for libm (by compile)... ok (cached)
checking for rapidjson (by compile)... failed (disable)
checking for crc32chw (by compile)... ok (cached)
checking for regex (by compile)... ok (cached)
checking for strndup (by compile)... ok (cached)
checking for strerror_r (by compile)... ok (cached)
checking for pthread_setname_gnu (by compile)... failed (disable)
checking for nm (by env NM)... ok (cached)
Generated Makefile.config
Generated config.h

Configuration summary:
  prefix                   /usr/local
  MKL_DISTRO               osx
  SOLIB_EXT                .dylib
  ARCH                     x86_64
  CPU                      generic
  GEN_PKG_CONFIG           y
  ENABLE_SSL               y
  ENABLE_GSSAPI            y
  ENABLE_DEVEL             n
  ENABLE_VALGRIND          n
  ENABLE_REFCNT_DEBUG      n
  ENABLE_SHAREDPTR_DEBUG   n
  ENABLE_LZ4_EXT           n
  MKL_APP_NAME             librdkafka
  MKL_APP_DESC_ONELINE     The Apache Kafka C/C++ library
  CC                       gcc
  CXX                      g++
  LD                       ld
  NM                       nm
  OBJDUMP                  objdump
  STRIP                    strip
  CFLAGS                   -I/usr/local/Cellar/openssl/1.0.2s/include  -I/usr/local/Cellar/openssl/1.0.2s/include -I/usr/local/Cellar/openssl/1.0.2s/include
  CPPFLAGS                 -gstrict-dwarf -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align
  PKG_CONFIG               pkg-config
  INSTALL                  install
  LIB_LDFLAGS              -shared -dynamiclib -Wl,-install_name,$(DESTDIR)$(libdir)/$(LIBFILENAME)
  RDKAFKA_VERSION_STR      1.0.0
  MKL_APP_VERSION          1.0.0
  LIBS                     -lm -lzstd -lsasl2 -L/usr/local/Cellar/openssl/1.0.2s/lib -lssl -L/usr/local/Cellar/openssl/1.0.2s/lib -lcrypto -lz -ldl -lpthread
  CXXFLAGS                 -Wno-non-virtual-dtor
  SYMDUMPER                $(NM) -g
  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
  BUILT_WITH               GCC GXX PKGCONFIG OSXLD LIBDL PLUGINS ZLIB SSL SASL_CYRUS ZSTD HDRHISTOGRAM SNAPPY SOCKEM SASL_SCRAM CRC32C_HW
Generated config.cache

Now type 'make' to build

--- stderr
Building and linking librdkafka statically
Running command: "./configure --enable-sasl --enable-ssl --disable-lz4" in dir: librdkafka
thread 'main' panicked at 'Command failed with error: No such file or directory (os error 2)', /Users/mbossert/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-1.0.0/build.rs:25:21
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /Users/vsts/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /Users/vsts/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
   7: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:384
   8: std::thread::local::fast::Key<T>::try_initialize
   9: build_script_build::run_command_or_fail
             at ./build.rs:25
  10: build_script_build::build_librdkafka
             at ./build.rs:109
  11: build_script_build::main
             at ./build.rs:61
  12: std::rt::lang_start::{{closure}}
             at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
  13: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:49
  14: std::panicking::try::do_call
             at src/libstd/panicking.rs:296
  15: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:80
  16: std::panicking::try
             at src/libstd/panicking.rs:275
  17: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  18: std::rt::lang_start_internal
             at src/libstd/rt.rs:48
  19: std::rt::lang_start
             at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
  20: build_script_build::make_librdkafka


Process finished with exit code 101

and here is my Cargo.toml

[package]
name = "metric_regression"
version = "0.1.0"
authors = ["M. Aaron Bossert <mabossert@gmail.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies.rdkafka]
version = "~0.21"
features = ["ssl", "sasl"]

At a glance without knowing the crate; I would suggest trying using the git version (and -sys) There are changes in build.rs that may or may not be a fix.

Thanks for the response...how do I switch to the Git version?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.