shadowsocks-rust: windows 7 build failed
toolchain: nightly-x86_64-pc-windows-msvc (default) rustc 1.27.0-nightly (7360d6dd6 2018-04-15)
cargo build --release
…
error: failed to run custom build command for openssl-sys v0.9.28
process didn’t exit successfully: C:\Users\xxx\Documents\vscode\shadowsocks-rust\target\release\build\openssl-sys-58fb47c380c62ab0\build-script-build (exit code: 101)
— stdout
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR
cargo:rerun-if-env-changed=OPENSSL_DIR
note: vcpkg did not find openssl as libcrypto and libssl : VcpkgNotFound(“No vcpkg.user.targets found. Set the VCPKG_ROOT environment variable or run 'vcpkg integrate install'”)
note: vcpkg did not find openssl as ssleay32 and libeay32: VcpkgNotFound(“No vcpkg.user.targets found. Set the VCPKG_ROOT environment variable or run 'vcpkg integrate install'”)
— 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.
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-pc-windows-msvc
$TARGET = x86_64-pc-windows-msvc
openssl-sys = 0.9.28
It looks like you’re compiling for MSVC but we couldn’t detect an OpenSSL installation. If there isn’t one installed then you can try the rust-openssl README for more information about how to download precompiled binaries of OpenSSL:
https://github.com/sfackler/rust-openssl#windows
', C:\Users\xxx.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-sys-0.9.28\build.rs:213:5
note: Run with RUST_BACKTRACE=1 for a backtrace.
warning: build failed, waiting for other jobs to finish… error: build failed
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 34 (1 by maintainers)
Commits related to this issue
- Add #102 link in README — committed to shadowsocks/shadowsocks-rust by zonyitoo 6 years ago
- Migrate tokio and uses new features (#108) * Add #102 link in README * Migrating to tokio, #100 * Migrated to tokio-signal v0.2, reformatted * Should not call tokio::spawn before tokio::run ... — committed to shadowsocks/shadowsocks-rust by zonyitoo 6 years ago
"官方"可以给出一个标准windows环境下的编译步骤,比如win10 x64 + MSVC 2019 + vcpkg这种具体的环境。
至于其它环境下,让编译者自己搞定。
https://github.com/shadowsocks/shadowsocks-rust/issues/163
@testcaoy7
我稍微总结一下吧,因为我用的是win7,可能在win10系统中不会出现类似的问题。
msvc abi编译环境:vs 2015+powershell 5.1+openssl 1.1.0h shell用msys2或cmd都可以,只需要注意%HOMEPATH%\.cargo\bin在环境变量里就可以。 ps5.1下载地址:https://www.microsoft.com/en-us/download/details.aspx?id=54616 msys2编译命令:
OPENSSL_DIR=C:\\OpenSSL-Win64 OPENSSL_STATIC=yes SODIUM_BUILD_STATIC=yes cargo build --releaseOPENSSL_LIB_DIR=C:\\OpenSSL-Win64\lib\\VC\\static OPENSSL_LIBS=libcrypto64MT:libssl64MT OPENSSL_INCLUDE_DIR=C:\\OpenSSL-Win64\\include OPENSSL_STATIC=yes SODIUM_BUILD_STATIC=yes cargo build --release (cmd需要使用set) 遇到的错误和解决办法:gnu abi编译环境:msys2+mingw-w64-x86_64-gcc+mingw-w64-x86_64-pkg-config openssl可以使用mingw64的,也可以用手动安装的。 mingw64版本openssl:pacman -S mingw-w64-x86_64-openssl
虽然也有mingw64的libsodium,但是不用SODIUM_BUILD_STATIC=yes仍然会报错,可能是版本太低?版本号1.0.12(重试了一遍,可以编译过,之前的错误可能是msys pkg-config的问题) shell用mingw64,添加%HOMEPATH%\.cargo\bin到环境变量 使用mingw64的openssl库编译: SODIUM_BUILD_STATIC=yes cargo build --release 或者 pacman -S mingw-w64-x86_64-libsodium SODIUM_STATIC=yes cargo build --release 但是静态化openssl编译不过(OPENSSL_STATIC=yes) https://github.com/rust-lang/rust/issues/47048 https://stackoverflow.com/questions/48454201/statically-linking-curl-using-openssl-in-windows 使用手动安装openssl编译命令(可静态化openssl): OPENSSL_DIR=C:\\OpenSSL-Win64 OPENSSL_STATIC=yes SODIUM_BUILD_STATIC=yes cargo build --release 遇到的错误和解决办法:冏,最后发现其实是我的msys2没有升级到最新的版本,msys2的gcc和pkg-config版本都太低了。 需要反复pacman -Syu,不过msys repo里面没有libsodium