error: native library `openssl` is being linked to by more than one version of the same package

送分小仙女□ 提交于 2019-11-30 18:10:18

The way that linking works, you can only have a single version of a native library linked, otherwise you end up with duplicate symbols. Cargo's links manifest key helps prevent you from accidentally linking to the same set of symbols twice.

To solve it, you need to read through your Cargo.lock (it's not a difficult file format to understand). Find the crates that have the offending library as a dependency and note which ones have conflicting versions.

Then you have to manually resolve your dependencies so that their dependencies use the same version of the native library.


In this case, the important aspects of the dependency chain are:

server (0.0.1) => cookie (0.2.4) => openssl (0.7.13)
               => hyper (0.6.16) => cookie (0.1.21) => openssl (0.6.7)

To fix it, modify your Cargo.toml to use the same version of cookie as hyper. Then you will implicitly get the same version of openssl.

To be honest, this is one of the roughest parts of Rust at the moment. At least this version of the "multiple different versions of the same crate" strangeness provides a straight-forward Cargo error.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!