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

Errors with compiling it on Linux/Windows #312

Closed
fukttt opened this issue Jan 12, 2025 · 8 comments
Closed

Errors with compiling it on Linux/Windows #312

fukttt opened this issue Jan 12, 2025 · 8 comments

Comments

@fukttt
Copy link

fukttt commented Jan 12, 2025

After adding this library to my project it takes to me about 5 hours searching the way to compile boring-ssl.
I've found the solution on windows - windowssdk. On my arch linux and Ubuntu WSL i get stucked by a problem.

x-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/jade/Documents/bit_rust/target/debug/deps/bit_rust-9951198e217d8bbc" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: rust-lld: error: undefined symbol: SSL_CTX_ctrl
          >>> referenced by ssl.rs:246 (src/./ssl.rs:246)
          >>>               openssl_sys-0ba905c6bda07f01.openssl_sys.c3003fee9cee004d-cgu.0.rcgu.o:(openssl_sys::openssl::ssl::SSL_CTX_set_mode::hb4e8eabb20f8534d) in archive /home/jade/Documents/bit_rust/target/debug/deps/libopenssl_sys-0ba905c6bda07f01.rlib
          >>> referenced by ssl.rs:384 (src/./ssl.rs:384)
          >>>               openssl_sys-0ba905c6bda07f01.openssl_sys.c3003fee9cee004d-cgu.0.rcgu.o:(openssl_sys::openssl::ssl::SSL_CTX_add_extra_chain_cert::hec4394ecb48cd332) in archive /home/jade/Documents/bit_rust/target/debug/deps/libopenssl_sys-0ba905c6bda07f01.rlib
          >>> referenced by ssl.rs:459 (src/./ssl.rs:459)
          >>>               openssl_sys-0ba905c6bda07f01.openssl_sys.c3003fee9cee004d-cgu.0.rcgu.o:(openssl_sys::openssl::ssl::SSL_CTX_set_min_proto_version::hcee43323c179caac) in archive /home/jade/Documents/bit_rust/target/debug/deps/libopenssl_sys-0ba905c6bda07f01.rlib
          >>> referenced 1 more times
          
          rust-lld: error: undefined symbol: SSL_ctrl
          >>> referenced by tls1.rs:24 (src/./tls1.rs:24)
          >>>               openssl_sys-0ba905c6bda07f01.openssl_sys.c3003fee9cee004d-cgu.0.rcgu.o:(openssl_sys::openssl::tls1::SSL_set_tlsext_host_name::h2b21b7ed952573fa) in archive /home/jade/Documents/bit_rust/target/debug/deps/libopenssl_sys-0ba905c6bda07f01.rlib
          
          rust-lld: error: undefined symbol: ERR_get_error_all
          >>> referenced by error.rs:122 (src/error.rs:122)
          >>>               openssl-43e5a7c7fb4262bd.openssl.26238b3bbdc94f34-cgu.03.rcgu.o:(openssl::error::Error::get::h565e18c1f092ea6c) in archive /home/jade/Documents/bit_rust/target/debug/deps/libopenssl-43e5a7c7fb4262bd.rlib
          
          rust-lld: error: undefined symbol: SSL_read_ex
          >>> referenced by mod.rs:3763 (/home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/openssl-0.10.68/src/ssl/mod.rs:3763)
          >>>               reqwest-830e20f3d4275a1f.reqwest.3bd2c93e72aba184-cgu.14.rcgu.o:(openssl::ssl::SslStream$LT$S$GT$::ssl_read_uninit::h0edc74e97661f6e1) in archive /home/jade/Documents/bit_rust/target/debug/deps/libreqwest-830e20f3d4275a1f.rlib
          >>> referenced by mod.rs:3763 (/home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/openssl-0.10.68/src/ssl/mod.rs:3763)
          >>>               reqwest-830e20f3d4275a1f.reqwest.3bd2c93e72aba184-cgu.14.rcgu.o:(openssl::ssl::SslStream$LT$S$GT$::ssl_read_uninit::hda2bba8af11d500e) in archive /home/jade/Documents/bit_rust/target/debug/deps/libreqwest-830e20f3d4275a1f.rlib
          
          rust-lld: error: undefined symbol: SSL_write_ex
          >>> referenced by mod.rs:3804 (/home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/openssl-0.10.68/src/ssl/mod.rs:3804)
          >>>               reqwest-830e20f3d4275a1f.reqwest.3bd2c93e72aba184-cgu.14.rcgu.o:(openssl::ssl::SslStream$LT$S$GT$::ssl_write::h17dc4f973200798e) in archive /home/jade/Documents/bit_rust/target/debug/deps/libreqwest-830e20f3d4275a1f.rlib
          >>> referenced by mod.rs:3804 (/home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/openssl-0.10.68/src/ssl/mod.rs:3804)
          >>>               reqwest-830e20f3d4275a1f.reqwest.3bd2c93e72aba184-cgu.14.rcgu.o:(openssl::ssl::SslStream$LT$S$GT$::ssl_write::hc73ca846b5bb3bb1) in archive /home/jade/Documents/bit_rust/target/debug/deps/libreqwest-830e20f3d4275a1f.rlib
          collect2: error: ld returned 1 exit status
          

warning: `bit_rust` (bin "bit_rust") generated 7 warnings
error: could not compile `bit_rust` (bin "bit_rust") due to 1 previous error; 7 warnings emitted
[16:09:16] [cost 0.572s] cargo run

it looks like specific openssl used to compile this lib.
Do u know the way or docs to make it work ?
I've looked for a ci-cd in your project, but itsn't helps

@0x676e67
Copy link
Member

0x676e67 commented Jan 12, 2025

There is indeed something to pay attention to when compiling boringsl. Boringssl is a derivative version of openssl. Their link symbols are the same, and the upstream does not intend to distinguish to solve this problem. According to your log, it should conflict with openssl compilation.

cloudflare/boring#197

@0x676e67
Copy link
Member

Are you using it with reqwest? It uses openssl by default in Linux.

@0x676e67
Copy link
Member

Are you using it with reqwest? It uses openssl by default in Linux.

Generally speaking, to do a good job is to use rustls.

@fukttt
Copy link
Author

fukttt commented Jan 12, 2025

Hi, ty for fast reply to my problem.
I'm a newbie on Rust. Just searched an alternative to curl_cffi and found your project.
I'm using rquest, for browser impersonating.

[package]
name = "bit_rust"
version = "0.1.0"
edition = "2021"


[dependencies]
openssl = { version = "0.10", features = ["vendored"] }
reqwest = { version = "0.11", features = ["rustls-tls"] }
base64 = "0.22.1"
ring = { version = "0.17.8", default-features = false }
rquest = { version = "1.5.0", default-features = false, features = ["json"] }
json = { version = "1.0.128", package = "serde_json" }
serde = { version = "1.0.210", features = ["derive"] }
fake-useragent = "0.1.3"
tokio = { version = "1.43.0", features = ["full"] }
uuid = { version = "1.3.1", features = ["v4", "fast-rng", "macro-diagnostics"] }
serde_urlencoded = "0.7.1"
deadqueue = "0.2.4"
rand = "0.8.5"
futures = "0.3.30"

[profile.release]
debug = true

Can u tell me what i must change here for switching to rustl_tls ?

@fukttt
Copy link
Author

fukttt commented Jan 12, 2025

I've tried to turn-off default feautures anywhere i can.
Tried to add reqwest, for using rquest.
Didn't helps. Too hard to make it crosscompile.

@fukttt
Copy link
Author

fukttt commented Jan 12, 2025

Do i need to fork rquest and change deps or using reqwest with impersonate functionality ?

@0x676e67
Copy link
Member

Since there is no need to add reqwest when using impersonation. It is meaningless. It will only increase the binary volume. In addition, don't compile with openssl's crate.

@0x676e67
Copy link
Member

remove openssl = { version = "0.10", features = ["vendored"] }
reqwest = { version = "0.11", features = ["rustls-tls"] }

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