[Cargo] Remove Optional Dependencies for Builds (debug, release)?


#1

Hello, I try to remove optional dependencies (openssl) from compilation, however that won’t work.

This is my Cargo.toml

[package]
name = "web_backup"
version = "0.1.0"
authors = ["schmitch"]

[dependencies]
iron = { version = "*", default-features = false }
router = { version = "*", default-features = false }
hyper = { version = "0.6", default-features = false }
persistent = { version = "*", default-features = false }
rustc-serialize = { version = "*", default-features = false }
bodyparser = { version = "*", default-features = false }

Now openssl-devel shouldn’t be needed on compilation, however it is still needed even if no library has openssl as a direct dependency (only as a feature).
What could I do now?

Here is my output of cargo build --release:

[schmitch@centos-linux-6 rust-web-backup]$ cargo build --release
Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling libc v0.1.12
   Compiling libc v0.2.2
   Compiling httparse v1.0.0
   Compiling matches v0.1.2
   Compiling language-tags v0.0.7
   Compiling modifier v0.1.0
   Compiling route-recognizer v0.1.11
   Compiling winapi v0.2.5
   Compiling traitobject v0.0.1
   Compiling unicase v1.0.1
   Compiling typeable v0.1.2
   Compiling bitflags v0.3.3
   Compiling rustc-serialize v0.3.16
   Compiling winapi-build v0.1.1
   Compiling pkg-config v0.3.6
   Compiling traitobject v0.0.3
   Compiling lazy_static v0.1.15
   Compiling log v0.3.3
   Compiling kernel32-sys v0.2.1
   Compiling advapi32-sys v0.1.2
   Compiling error v0.1.7
   Compiling unsafe-any v0.4.1
   Compiling hpack v0.2.0
   Compiling mime v0.1.0
   Compiling typemap v0.3.3
   Compiling num_cpus v0.2.9
   Compiling time v0.1.34
   Compiling gcc v0.3.19
   Compiling rand v0.3.12
   Compiling plugin v0.2.6
   Compiling solicit v0.4.4
   Compiling openssl-sys v0.6.7
Build failed, waiting for other jobs to finish...
failed to run custom build command for `openssl-sys v0.6.7`

#2

It could also be an indirect dependency. Say, for example (I haven’t checked), that router would depend on iron and not have openssl disabled. You can look in your Cargo.lock file and see which library depends on what, if you don’t want to traverse crates.io for the info.