• Github 中文镜像
Sign inSign up
Watch966
Star102.4k
Fork61.8k
Branch: master
Switch branches/tags
Branches
Tags
  • master
  •  
K / 解决 WSL openssl not found 报错.md
移动浏览 Clone
加载中...
到移动设备上浏览
45 lines 3.86 kB
First commit on 19 May 2023

    WSL 环境编译依赖 OpenSSL 的包遇到报错。第一个报错通过 sudo apt-get install pkg-config 解决了,后面依然提示找不到 openssl,但执行 openssl version 可以看到系统里已经安装了。

    之后执行 sudo apt-get install libssl-devsudo apt-get update 遇到很多 404 Not Found 错误。

    猜想是不是版本太老了,都打开 Microsoft Store 准备重装 WSL 了,在描述里看到

    To keep your Debian environment up-to-date please use the following commands:

    $ sudo apt update $ sudo apt dist-upgrade

    依次执行:

    1. sudo apt update
    2. sudo apt-get update
    3. sudo apt-get install libssl-dev

    问题解决。

    其他问题的解决可以看这里:在 WSL 中安装 Rust 交叉编译环境和报错解决

    初始报错信息:

    run pkg_config fail: `"pkg-config" "--libs" "--cflags" "openssl"` did not exit successfully: exit status: 1
    error: could not find system library 'openssl' required by the 'openssl-sys' crate
    
    --- stderr
    Package openssl was not found in the pkg-config search path.
    Perhaps you should add the directory containing `openssl.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'openssl' found
    
    --- 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-gnu
    openssl-sys = 0.9.84