[英]Error building openssl-sys crate on Windows
我正在嘗試在Windows上編譯Rust程序,但出現以下錯誤消息:
Compiling openssl-sys v0.6.4
failed to run custom build command for `openssl-sys v0.6.4`
[...]
failed to execute command: The system couldn't find the specified file. (os error 2)
Is `gcc` not installed? (see https://github.com/alexcrichton/gcc-rs#windows-notes for help)
--- stderr
thread '<main>' panicked at 'explicit panic', C:\Users\User\.cargo\registry\src\github.com-0a35038f75765ae4\gcc-0.3.12\src\lib.rs:510
Cargo可以毫無問題地編譯其他所有程序包,但不能編譯openssl程序包。
我搜索了有關此特定錯誤的幫助,並發現了hyperium的github問題 。 第一個答案參考Windows的openssl構建指南 。
我不完全了解如何在Windows中構建openssl。 我安裝了MinGW,並將bin路徑添加到了全局PATH
變量中,因此gcc是可訪問的,但這不能解決錯誤。
我使用Rust 1.2和Cargo 0.4.0。 我的項目是Telegram API包裝器的示例。
1)下載ssl
安裝Win32 OpenSSL v1.0.2d
在這里安裝:C:\\ OpenSSL-Win32,C:\\ OpenSSL-Win32 \\ include,C:\\ OpenSSL-Win32 \\ lib
2)安裝MinGW,並添加系統環境路徑,C:\\ MinGW \\ bin,important,MinGW的安裝路徑包含char'MinGW'
3) cmd run env OPENSSLLIBDIR=C:/OpenSSL-Win32/lib OPENSSLINCLUDEDIR=C:/OpenSSL-Win32/include cargo build
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.