emk / rust-musl-builder

Docker images for compiling static Rust binaries using musl-libc and musl-gcc, with static versions of useful C libraries. Supports openssl and diesel crates.
Apache License 2.0
1.54k stars 193 forks source link

Building dependency rdkafka with cmake-build feature fails #138

Open JorritSalverda opened 2 years ago

JorritSalverda commented 2 years ago

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)

0xDjole commented 1 year ago

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