Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: failed to run custom build command for rdkafka-sys v4.6.0+2.2.0 #1

Open
taksedo opened this issue Nov 22, 2023 · 3 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@taksedo
Copy link

taksedo commented Nov 22, 2023

Hello

After cargo build error appears:

error: failed to run custom build command for `rdkafka-sys v4.6.0+2.2.0`

Caused by:
  process didn't exit successfully: `D:\GitHub\learning\tiny_kafka\target\debug\build\rdkafka-sys-165221558fc0dc64\build-script-build` (exit code: 101)
  --- stdout
  Cloning librdkafka

  --- stderr
  Building and linking librdkafka statically
  Running command: "cp -a librdkafka/. D:\GitHub\learning\tiny_kafka\target\debug\build\rdkafka-sys-c133e4552a938a51\out" in dir: .
  thread 'main' panicked at C:\Users\xyb6qs\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rdkafka-sys-4.6.0+2.2.0\build.rs:38:19:
  Command failed with error: program not found
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

rustc --version

rustc 1.74.0 (79e9716c9 2023-11-13)

rustup --version

rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.74.0 (79e9716c9 2023-11-13)`
@cploutarchou cploutarchou self-assigned this Nov 27, 2023
@cploutarchou cploutarchou added the bug Something isn't working label Nov 27, 2023
@cploutarchou
Copy link
Owner

@taksedo can you try running using the following code?

use std::sync::Arc;
use tiny_kafka::consumer::KafkaConsumer;
use tiny_kafka::producer::{KafkaProducer, Message};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {

    let rt = tokio::runtime::Runtime::new().unwrap();
    // Assuming kafka_bootstrap_servers is of type String
    let brokers = Arc::new("localhost:9092".to_string());
    let topics = Arc::new(vec!["test".to_string()]);

    // Consumer task
    let brokers_for_task1 = brokers.clone();
    let topics_for_task1 = topics.clone();
    let task1 = async move {
        let consumer = KafkaConsumer::new(
            brokers_for_task1.as_str(),
            "kafka-to-elastic",
            topics_for_task1.get(0).unwrap(),
        );
        loop {
if let Some(msg) = consumer.poll().await {
                info!(
                    "Consumed message with key: {} and value: {}",
                    msg.key, msg.value
                );
            }
        }
    };
    rt.spawn(task1);

    // Producer task
    let brokers_for_task2 = brokers.clone();
    let topics_for_task2 = topics.clone();
    let task2 = async move {
        let producer = KafkaProducer::new(brokers_for_task2.as_str(), Option::None);

        for i in 0..100 {
let key = format!("test_key_{}", i);
let value = format!("test_value_{}", i);
            let message = Message::new(&key, &value);

            producer
                .send_message(topics_for_task2.get(0).unwrap(), message)
                .await;
            tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
        }
    };
    rt.spawn(task2);

    // Wait for a ctrl-c signal
    tokio::signal::ctrl_c().await?;
    println!("ctrl-c received!");

    Ok(())
}

On my site, I dont get any errors!

@ghajba
Copy link

ghajba commented Jun 10, 2024

I want to share my 2 cents as I encountered the same issue today.

I am developing on Windows -- and got the same error: error: failed to run custom build command for rdkafka-sys v4.7.0+2.3.0 while using not tiny-kafka but simply rdkafka. There is some issue on this OS with building:

 failed to execute command: program not found
  is `cmake` not installed?

switching to the WSL solved my issue (after installing cmake). Maybe this will help future visitors.

@cploutarchou
Copy link
Owner

I want to share my 2 cents as I encountered the same issue today.

I am developing on Windows -- and got the same error: error: failed to run custom build command for rdkafka-sys v4.7.0+2.3.0 while using not tiny-kafka but simply rdkafka. There is some issue on this OS with building:

 failed to execute command: program not found
  is `cmake` not installed?

switching to the WSL solved my issue (after installing cmake). Maybe this will help future visitors.

Hi @ghajba

Thank you for bringing this to my attention.

I wanted to let you know that I am currently working on updating the GitHub repository to match the latest version on crates.io.

You can expect the updated version to be pushed to GitHub within the next few days. There will be no need to use any other Kafka dependencies.

Thank you for your patience and contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants