您好,登錄后才能下訂單哦!
本篇內容主要講解“cargo編譯musl報錯openssl怎么辦”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“cargo編譯musl報錯openssl怎么辦”吧!
生產環境和編譯環境的glibc
版本不同出現來如下報錯
/lib64/libc.so.6: version `GLIBC_x.xx' not found
所以需要使用cargo 跨平臺編譯x86_64-unknown-linux-musl
,而后就報出來openssl相關的錯誤:
--- stderr thread 'main' panicked at ' Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set the `OPENSSL_DIR` environment variable for the compilation process. Make sure you also have the development packages of openssl installed. For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora. If you're in a situation where you think the directory *should* be found automatically, please open a bug at https://github.com/sfackler/rust-openssl and include information about your system as well as this message. $HOST = x86_64-unknown-linux-gnu $TARGET = x86_64-unknown-linux-musl openssl-sys = 0.9.48
上文總結一句話:編譯器沒找到ssl的dev包,并給出來debian和red-hat的解決方法。但很可惜,我的編譯環境是manjaro,沒有libssl_dev類似的包
對于debian/ubuntu就是
apt-get install libssl-dev
對于centos/fedora就是
yum install -y openssl-devel
對于Arch/manjaro,在確保安裝openssl情況下
export OPENSSL_DIR=/usr
具體過程通過命令找到libssl.so
文件路徑(這里是/usr/lib/libsso.so)。編譯時會連接OPENSSL_DIR/lib/libssl.so
。因此這里的OPENSSL_DIR
就是/usr
了。
到此,相信大家對“cargo編譯musl報錯openssl怎么辦”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。