eclipse / paho.mqtt.rust

paho.mqtt.rust
Other
511 stars 102 forks source link

Help: Getting error in github ci-cd pipeline #230

Closed krishnaTORQUE closed 1 month ago

krishnaTORQUE commented 1 month ago

Getting error in github ci-cd pipeline. Using docker alpine

Error

> [builder 9/9] RUN cargo build --release:
682.8           MQTTAsyncUtils.c:(.text.MQTTAsync_receiveThread+0x49f): undefined reference to `OPENSSL_thread_stop'
682.8           /usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/rustcYJwl73/libpaho_mqtt_sys-b0cba40a70d81679.rlib(MQTTAsyncUtils.c.o): in function `MQTTAsync_sendThread':
682.8           MQTTAsyncUtils.c:(.text.MQTTAsync_sendThread+0x539): undefined reference to `OPENSSL_thread_stop'
682.8           collect2: error: ld returned 1 exit status

Cargo.toml paho-mqtt = "^0.12.5"

Dockerfile RUN apk --update --no-cache add build-base openssl libressl-dev cmake

krishnaTORQUE commented 1 month ago

This resolves the issue.

paho-mqtt = { version = "^0.12.5", default-features = false, features = [ "bundled" ] }

fpagliughi commented 1 month ago

The way you got it to work was to turn off SSL/TLS support. If you need secure connections, you should be able to get it building.

In your Docerfile, you mixed OpenSSL (openssl) and LibreSSL (libressl-dev) libraries. I suspect that was your problem. If you follow the instructions in the README it might work. Just the OpenSSL library files. Use:

apt install libssl-dev build-essential cmake
krishnaTORQUE commented 1 month ago

@fpagliughi thanks Its true. I just switch to ssl & now ssl is require but I am getting the error again. I am using alpine & I am still unable to fix this issue. If you know how it will work on alpine, please help me. Thanks

RUN apk --update --no-cache add build-base openssl libressl-dev cmake c++ g++ gcc musl-dev mpc1-dev

fpagliughi commented 1 month ago

Please actually read what I wrote already.

krishnaTORQUE commented 1 month ago

@fpagliughi Thanks

Finally I resolved for SSL too by this in alpine.

Dockerfile RUN apk --update --no-cache add build-base openssl-dev libressl cmake perl

Cargo.toml paho-mqtt = { version = "^0.12.5", features = ["vendored-ssl"] }

fpagliughi commented 1 month ago

Great. I will mention that you are still also installing the LibreSSL library binary files (libressl). Those are not needed for Paho Rust. Do you need them for something else? If not you can remove that package.

krishnaTORQUE commented 1 month ago

Great. I will mention that you are still also installing the LibreSSL library binary files (libressl). Those are not needed for Paho Rust. Do you need them for something else? If not you can remove that package.

Thanks Its correct.