rust-musl-builder icon indicating copy to clipboard operation
rust-musl-builder copied to clipboard

Building dependency rdkafka with cmake-build feature fails

Open JorritSalverda opened this issue 3 years ago • 1 comments

What did you try to do?

I'm trying to build a Lambda function in Rust to write to Kafka using the rdkafka crate as follows:

[dependencies]
rdkafka = { version = "0.28.0", features = ["ssl-vendored", "gssapi-vendored", "libz-static", "cmake-build"] }

I'm building it using ekidd/rust-musl-builder:1.57.0 with apt-get package libsasl2-dev installed before running cargo build --release --target x86_64-unknown-linux-musl.

What happened?

However that fails with the following error:

running: "cmake" "--build" "." "--target" "install" "--config" "Release" "--parallel" "4"

  --- stderr
  Building and linking librdkafka statically
  CMake Warning:
    Manually-specified variables were not used by the project:

      CMAKE_ASM_COMPILER
      CMAKE_ASM_FLAGS


  Unknown argument --parallel
  Unknown argument 4
  Usage: cmake --build <dir> [options] [-- [native-options]]
  Options:
    <dir>          = Project binary directory to be built.
    --target <tgt> = Build <tgt> instead of default targets.
                     May only be specified once.
    --config <cfg> = For multi-configuration tools, choose <cfg>.
    --clean-first  = Build target 'clean' first, then build.
                     (To clean only, use --target 'clean'.)
    --use-stderr   = Ignored.  Behavior is default in CMake >= 3.0.
    --             = Pass remaining options to the native tool.
  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 1

  build script failed, must exit now', /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.48/src/lib.rs:975:5

The cmake-build feature makes it include the cmake crate version 0.1.48, which then apparently issues this unsupported flag.

What did you hope to happen?

Build a statically linked binary with security.protocol=SASL_SSL used to connect to Kafka (on confluent.io)

JorritSalverda avatar Feb 18 '22 21:02 JorritSalverda

@JorritSalverda Were you able to fix this? I have the same issue. Im thinking of switching libraries.

0xDjole avatar Dec 14 '22 19:12 0xDjole