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 openssl-sys v0.9.103 #1434

Open
VasilijeMaric opened this issue Sep 19, 2024 · 0 comments
Open

Comments

@VasilijeMaric
Copy link

🐛 Bug description

I am building a wasm project on Ubuntu system. This project uses kafka consumer.
This is Cargo.toml

[package]
name = "wds-sterling-emulator"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["cdylib"]

[dependencies]
wasm-bindgen = { version = "0.2", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
serde-wasm-bindgen = "0.6.5"
serde_json = "1.0"
js-sys = "0.3"
web-sys = "0.3"
kafka = "0.10.0"
getrandom = { version = "0.2", features = ["js"] }
openssl = { version = "0.10.64", features = ["vendored"] } 
openssl-sys = { version = "0.9.99", features = ["vendored"] }

This is lib.rs

use wasm_bindgen::prelude::*;
use serde::{Deserialize, Serialize};
use serde_wasm_bindgen::to_value;

use kafka::consumer::{Consumer, FetchOffset, GroupOffsetStorage};

#[wasm_bindgen]
pub fn consume_symbollist() -> String {
    let hosts = vec!["localhost:9092".to_owned()];
    let topic = "my-topic";
    let group_id = "my-group";

    let mut consumer = Consumer::from_hosts(hosts)
        .with_topic(topic.to_owned())
        .with_group(group_id.to_owned())
        .with_fallback_offset(FetchOffset::Earliest)
        .with_offset_storage(Some(GroupOffsetStorage::Kafka))
        .create()
        .expect("Failed to create Kafka consumer");

    let mut message_count = 0;
    let mut result = String::new();

    for ms in consumer.poll().unwrap().iter().take(10) {
        for m in ms.messages() {
            let message = String::from_utf8_lossy(m.value);
            result.push_str(&format!("Received message: {}\n", message));
            message_count += 1;
        }
        consumer.consume_messageset(ms).expect("Failed to commit offset");
    }

    result.push_str(&format!("Consumed {} messages", message_count));
    result
}

🤔 Expected Behavior

There should be no issue when compiling

👟 Steps to reproduce

When I run "wasm-pack build", I get "error: failed to run custom build command for openssl-sys v0.9.103"
I already installed pkg-config, libssl-dev

🌍 Your environment

wasm-pack version: 0.13.0
rustc version: 1.81.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@VasilijeMaric and others