Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fail to load openssl #2344

Open
nihao opened this issue Jan 3, 2025 · 0 comments
Open

fail to load openssl #2344

nihao opened this issue Jan 3, 2025 · 0 comments

Comments

@nihao
Copy link

nihao commented Jan 3, 2025

openssl already installed

zenonim@Nim-MC wizlab-server % brew --prefix openssl
/opt/homebrew/opt/openssl@3

but can't find automatically

zenonim@Nim-MC wizlab-server % cargo build --release --target=x86_64-unknown-linux-musl
Compiling openssl-sys v0.9.104
Compiling ring v0.17.8
Compiling rustls v0.23.20
The following warnings were emitted during compilation:

warning: [email protected]: 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. See stderr section below for further information.

error: failed to run custom build command for openssl-sys v0.9.104

Caused by:
process didn't exit successfully: /Users/zenonim/Documents/code/wizlab/wizlab-server/target/release/build/openssl-sys-24822adf3617b965/build-script-main (exit status: 101)
--- stdout
cargo:rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_OCB", "OPENSSL_NO_SM4", "OPENSSL_NO_SEED", "OPENSSL_NO_CHACHA", "OPENSSL_NO_CAST", "OPENSSL_NO_IDEA", "OPENSSL_NO_CAMELLIA", "OPENSSL_NO_RC4", "OPENSSL_NO_BF", "OPENSSL_NO_PSK", "OPENSSL_NO_DEPRECATED_3_0", "OPENSSL_NO_SCRYPT", "OPENSSL_NO_SM3", "OPENSSL_NO_RMD160", "OPENSSL_NO_EC2M", "OPENSSL_NO_OCSP", "OPENSSL_NO_CMS", "OPENSSL_NO_COMP", "OPENSSL_NO_SOCK", "OPENSSL_NO_STDIO", "OPENSSL_NO_EC", "OPENSSL_NO_SSL3_METHOD", "OPENSSL_NO_KRB5", "OPENSSL_NO_TLSEXT", "OPENSSL_NO_SRP", "OPENSSL_NO_RFC3779", "OPENSSL_NO_SHA", "OPENSSL_NO_NEXTPROTONEG", "OPENSSL_NO_ENGINE", "OPENSSL_NO_BUF_FREELISTS"))
cargo:rustc-check-cfg=cfg(openssl)
cargo:rustc-check-cfg=cfg(libressl)
cargo:rustc-check-cfg=cfg(boringssl)
cargo:rustc-check-cfg=cfg(libressl250)
cargo:rustc-check-cfg=cfg(libressl251)
cargo:rustc-check-cfg=cfg(libressl252)
cargo:rustc-check-cfg=cfg(libressl261)
cargo:rustc-check-cfg=cfg(libressl270)
cargo:rustc-check-cfg=cfg(libressl271)
cargo:rustc-check-cfg=cfg(libressl273)
cargo:rustc-check-cfg=cfg(libressl280)
cargo:rustc-check-cfg=cfg(libressl281)
cargo:rustc-check-cfg=cfg(libressl291)
cargo:rustc-check-cfg=cfg(libressl310)
cargo:rustc-check-cfg=cfg(libressl321)
cargo:rustc-check-cfg=cfg(libressl332)
cargo:rustc-check-cfg=cfg(libressl340)
cargo:rustc-check-cfg=cfg(libressl350)
cargo:rustc-check-cfg=cfg(libressl360)
cargo:rustc-check-cfg=cfg(libressl361)
cargo:rustc-check-cfg=cfg(libressl370)
cargo:rustc-check-cfg=cfg(libressl380)
cargo:rustc-check-cfg=cfg(libressl381)
cargo:rustc-check-cfg=cfg(libressl382)
cargo:rustc-check-cfg=cfg(libressl390)
cargo:rustc-check-cfg=cfg(libressl400)
cargo:rustc-check-cfg=cfg(ossl101)
cargo:rustc-check-cfg=cfg(ossl102)
cargo:rustc-check-cfg=cfg(ossl102f)
cargo:rustc-check-cfg=cfg(ossl102h)
cargo:rustc-check-cfg=cfg(ossl110)
cargo:rustc-check-cfg=cfg(ossl110f)
cargo:rustc-check-cfg=cfg(ossl110g)
cargo:rustc-check-cfg=cfg(ossl110h)
cargo:rustc-check-cfg=cfg(ossl111)
cargo:rustc-check-cfg=cfg(ossl111b)
cargo:rustc-check-cfg=cfg(ossl111c)
cargo:rustc-check-cfg=cfg(ossl111d)
cargo:rustc-check-cfg=cfg(ossl300)
cargo:rustc-check-cfg=cfg(ossl310)
cargo:rustc-check-cfg=cfg(ossl320)
cargo:rustc-check-cfg=cfg(ossl330)
cargo:rustc-check-cfg=cfg(ossl340)
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR
X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR
X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR
X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

Could not find openssl via pkg-config:
pkg-config has not been configured to support cross-compilation.

Install a sysroot for the target platform and configure it via
PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
cross-compiling wrapper for pkg-config and set it via
PKG_CONFIG environment variable.

cargo:warning=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. See stderr section below for further information.

--- stderr

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 = aarch64-apple-darwin
$TARGET = x86_64-unknown-linux-musl
openssl-sys = 0.9.104

warning: build failed, waiting for other jobs to finish...

after set OPENSSL_DIR, then find bellow errors

export OPENSSL_DIR=$(brew --prefix openssl)
export PKG_CONFIG_PATH=$OPENSSL_DIR/lib/pkgconfig
export CC=x86_64-linux-musl-gcc
export CXX=x86_64-linux-musl-g++
cargo build --release --target=x86_64-unknown-linux-musl

error: linking with x86_64-linux-musl-gcc failed: exit status: 1
|
= note: LC_ALL="C" PATH="/Users/zenonim/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin:/Users/zenonim/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin/self-contained:/Users/zenonim/.cargo/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/musl-cross/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/zenonim/.cargo/bin" VSLANG="1033" "x86_64-linux-musl-gcc" "-m64" "/Users/zenonim/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/rcrt1.o" "/Users/zenonim/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o" "/Users/zenonim/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtbeginS.o" "/var/folders/bt/g4b3fvgx06s4d3cs08p2s78h0000gn/T/rustcsgCPjx/symbols.o" "/Users/zenonim/Documents/code/wizlab/wizlab-server/target/x86_64-unknown-linux-musl/release/deps/wizlab_api-6bbe301482b51840.wizlab_api.cf536a429d6c0fa-cgu.09.rcgu.o" "-Wl,--as-needed" "-Wl,-Bstatic" "/var/folders/bt/g4b3fvgx06s4d3cs08p2s78h0000gn/T/rustcsgCPjx/libring-6085ea2ab545199c.rlib" "-lunwind" "-lc" "/Users/zenonim/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-61d0c8b9a9647ee6.rlib" "-Wl,-Bdynamic" "-lssl" "-lcrypto" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/Users/zenonim/Documents/code/wizlab/wizlab-server/target/x86_64-unknown-linux-musl/release/build/ring-d4665ff1a96edae9/out" "-L" "/opt/homebrew/opt/openssl@3/lib" "-L" "/Users/zenonim/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained" "-L" "/Users/zenonim/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib" "-o" "/Users/zenonim/Documents/code/wizlab/wizlab-server/target/x86_64-unknown-linux-musl/release/deps/wizlab_api-6bbe301482b51840" "-Wl,--gc-sections" "-static-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-debug" "-nodefaultlibs" "/Users/zenonim/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtendS.o" "/Users/zenonim/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o"
= note: /opt/homebrew/Cellar/musl-cross/0.9.9_2/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld: /Users/zenonim/Documents/code/wizlab/wizlab-server/target/x86_64-unknown-linux-musl/release/deps/wizlab_api-6bbe301482b51840.wizlab_api.cf536a429d6c0fa-cgu.09.rcgu.o: in function <&T as core::fmt::Debug>::fmt': wizlab_api.cf536a429d6c0fa-cgu.09:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17hb4ec8ba58da900c7E+0x6f): undefined reference to X509_verify_cert_error_string'
/opt/homebrew/Cellar/musl-cross/0.9.9_2/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld: /Users/zenonim/Documents/code/wizlab/wizlab-server/target/x86_64-unknown-linux-musl/release/deps/wizlab_api-6bbe301482b51840.wizlab_api.cf536a429d6c0fa-cgu.09.rcgu.o: in function native_tls::Certificate::to_der': wizlab_api.cf536a429d6c0fa-cgu.09:(.text._ZN10native_tls11Certificate6to_der17hf79b9e0aaa1fe62bE+0x1b): undefined reference to i2d_X509'

。。。。

= note: some extern functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the -l flag to specify native libraries to link
= note: use the cargo:rustc-link-lib directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)

warning: wizlab-api (bin "wizlab-api") generated 6 warnings
error: could not compile wizlab-api (bin "wizlab-api") due to 1 previous error; 6 warnings emitted
warning: build failed, waiting for other jobs to finish...
warning: wizlab-learn (bin "wizlab-learn") generated 58 warnings (run cargo fix --bin "wizlab-learn" to apply 12 suggestions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant