inre / rust-mq

RustMQ is the MQTT client written on pure Rust.
MIT License
190 stars 28 forks source link

Consider replacing openssl with rust-native-tls #21

Closed et1975 closed 3 years ago

et1975 commented 7 years ago

I'm new to rust, and trying to build this on OSX fails and none of the workarounds with brew and INCLIDE/LIB path exports work. I might be able to figure it out eventually, but it seems like this unnecessary hurdle could be avoided.

sinitcin commented 7 years ago

I too have fail on linux. After make

...
   Compiling openssl v0.7.14
error: failed to run custom build command for `openssl v0.7.14`
process didn't exit successfully: `/home/anton/rust-mq/target/release/build/openssl-2b2208aefb0df6b8/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("i686-unknown-linux-gnu")
OPT_LEVEL = Some("3")
TARGET = Some("i686-unknown-linux-gnu")
HOST = Some("i686-unknown-linux-gnu")
TARGET = Some("i686-unknown-linux-gnu")
TARGET = Some("i686-unknown-linux-gnu")
HOST = Some("i686-unknown-linux-gnu")
CC_i686-unknown-linux-gnu = None
CC_i686_unknown_linux_gnu = None
HOST_CC = None
CC = None
HOST = Some("i686-unknown-linux-gnu")
TARGET = Some("i686-unknown-linux-gnu")
HOST = Some("i686-unknown-linux-gnu")
CFLAGS_i686-unknown-linux-gnu = None
CFLAGS_i686_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
PROFILE = Some("release")
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-march=i686" "-o" "/home/anton/rust-mq/target/release/build/openssl-bd508a400916ea3f/out/src/c_helpers.o" "-c" "src/c_helpers.c"
cargo:warning=src/c_helpers.c: In function ‘rust_SSL_clone’:
cargo:warning=src/c_helpers.c:4:5: warning: implicit declaration of function ‘CRYPTO_add’ [-Wimplicit-function-declaration]
cargo:warning=     CRYPTO_add(&ssl->references, 1, CRYPTO_LOCK_SSL);
cargo:warning=     ^~~~~~~~~~
cargo:warning=src/c_helpers.c:4:20: error: dereferencing pointer to incomplete type ‘SSL {aka struct ssl_st}’
cargo:warning=     CRYPTO_add(&ssl->references, 1, CRYPTO_LOCK_SSL);
cargo:warning=                    ^~
cargo:warning=src/c_helpers.c:4:37: error: ‘CRYPTO_LOCK_SSL’ undeclared (first use in this function)
cargo:warning=     CRYPTO_add(&ssl->references, 1, CRYPTO_LOCK_SSL);
cargo:warning=                                     ^~~~~~~~~~~~~~~
cargo:warning=src/c_helpers.c:4:37: note: each undeclared identifier is reported only once for each function it appears in
cargo:warning=src/c_helpers.c: In function ‘rust_SSL_CTX_clone’:
cargo:warning=src/c_helpers.c:8:20: error: dereferencing pointer to incomplete type ‘SSL_CTX {aka struct ssl_ctx_st}’
cargo:warning=     CRYPTO_add(&ctx->references,1,CRYPTO_LOCK_SSL_CTX);
cargo:warning=                    ^~
cargo:warning=src/c_helpers.c:8:35: error: ‘CRYPTO_LOCK_SSL_CTX’ undeclared (first use in this function)
cargo:warning=     CRYPTO_add(&ctx->references,1,CRYPTO_LOCK_SSL_CTX);
cargo:warning=                                   ^~~~~~~~~~~~~~~~~~~
cargo:warning=src/c_helpers.c: In function ‘rust_X509_clone’:
cargo:warning=src/c_helpers.c:12:21: error: dereferencing pointer to incomplete type ‘X509 {aka struct x509_st}’
cargo:warning=     CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509);
cargo:warning=                     ^~
cargo:warning=src/c_helpers.c:12:36: error: ‘CRYPTO_LOCK_X509’ undeclared (first use in this function)
cargo:warning=     CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509);
cargo:warning=                                    ^~~~~~~~~~~~~~~~
exit code: 1

command did not execute successfully, got: exit code: 1

--- stderr
thread 'main' panicked at 'explicit panic', /home/anton/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.50/src/lib.rs:1210
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Build failed, waiting for other jobs to finish...
error: build failed
Makefile:6: ошибка выполнения рецепта для цели «build»
make: *** [build] Ошибка 101
sinitcin commented 7 years ago

In OpenSSL has removed function CRYPTO_add. My actual version:

OpenSSL> version
OpenSSL 1.1.0e  16 Feb 2017 (Library: OpenSSL 1.1.0f  25 May 2017)

The function CRYPTO_add exists in openssl-1.0.2l.

sinitcin commented 7 years ago

My OS is debian 9.0, for fix this problem i call

sudo apt-get install libssl1.0-dev

and check for remove libssl-dev

sinitcin commented 7 years ago

Please add this dependency to README.md Thanks

sanpii commented 7 years ago

Same problem on archlinux. Do you have a plan to fixed this issue? I can’t fix a bug in my application because the build fails.

download13 commented 6 years ago

This is a blocking issue for me as well.

In the mean time, could the openssl dependency also be an optional feature through mqttc?

I mean, add an ssl feature to mqttc that ties to the ssl feature in netopt.

toulouse commented 6 years ago

Ack, just hit this, myself. New to rust as well.