-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
[bug] - Zigbuilds fails - when static linking pkg-config #89
Comments
It seems like zigbuild cannot use the openssl since it's cross compiling, which makes sense for me. You need to turn out the "vendored" feature of openssl so that it would build openssl instead of using system-wide dep. |
That makes sense that it cannot use the system-wide deps. For export OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu
export OPENSSL_INCLUDE_DIR=/usr/include Is there a way I can specify the paths manually for |
For zmq, I checked libzmq-sys and zmq-sts, both will vendor zmq if it cannot find it on the system. I would expect the same for libsodium. |
Thanks for the help! @NobodyXu |
Thanks for the help. I did not know that there was Now I got another error. There is a workaround for this in the README file. But I cannot follow what the solution is. Are you able to help?
|
It's a bit odd that the error is coming from
|
I'm running in a docker. Here are the details. OS - Docker Ubuntu 22.04 (aarm64 CPU) (host machine M1 Mac aarch64 )
|
Docker isn't required for |
Interesting... I got a different error on M1 - Looks like it not able to resolve
output:
|
Maybe you should switch to https://github.com/jedisct1/libsodium-sys-stable, |
Yeah I tried that as well. Nothing seems to work. Looks like I can't use zigbuild for this specific project.
I really appreciate all your suggestions. |
$ cargo new hello
Created binary (application) `hello` package
$ cargo add libsodium-sys-stable
Updating crates.io index
Adding libsodium-sys-stable v1.19.27 to dependencies.
Features:
- fetch-latest
- minimal
- optimized
- ureq
- use-pkg-config
$ cat src/main.rs
use libsodium_sys::*;
fn main() {
assert_eq!(
unsafe { crypto_verify_16_bytes() },
crypto_verify_16_BYTES as usize
);
}
$ cargo zigbuild --target aarch64-unknown-linux-gnu -vv
Fresh cfg-if v1.0.0
Fresh rle-decode-fast v1.0.3
Fresh adler32 v1.2.0
Fresh minisign-verify v0.2.1
Fresh cc v1.0.79
Fresh libflate_lz77 v1.1.0
Fresh pkg-config v0.3.26
Compiling libc v0.2.139
Fresh xattr v0.2.3
Fresh filetime v0.2.20
Fresh crc32fast v1.3.2
Running `/private/tmp/hello/target/debug/build/libc-da11048515868f5e/build-script-build`
Fresh tar v0.4.38
Fresh libflate v1.2.0
Compiling libsodium-sys-stable v1.19.27
Running `/private/tmp/hello/target/debug/build/libsodium-sys-stable-a86757b1bb28c9d6/build-script-build`
[libc 0.2.139] cargo:rerun-if-changed=build.rs
[libsodium-sys-stable 1.19.27] cargo:rerun-if-env-changed=SODIUM_LIB_DIR
[libsodium-sys-stable 1.19.27] cargo:rerun-if-env-changed=SODIUM_SHARED
[libsodium-sys-stable 1.19.27] cargo:rerun-if-env-changed=SODIUM_USE_PKG_CONFIG
[libsodium-sys-stable 1.19.27] cargo:rerun-if-env-changed=SODIUM_DISABLE_PIE
[libc 0.2.139] cargo:rustc-cfg=freebsd11
[libc 0.2.139] cargo:rustc-cfg=libc_priv_mod_use
[libc 0.2.139] cargo:rustc-cfg=libc_union
[libc 0.2.139] cargo:rustc-cfg=libc_const_size_of
[libc 0.2.139] cargo:rustc-cfg=libc_align
[libc 0.2.139] cargo:rustc-cfg=libc_int128
[libc 0.2.139] cargo:rustc-cfg=libc_core_cvoid
[libc 0.2.139] cargo:rustc-cfg=libc_packedN
[libc 0.2.139] cargo:rustc-cfg=libc_cfg_target_vendor
[libc 0.2.139] cargo:rustc-cfg=libc_non_exhaustive
[libc 0.2.139] cargo:rustc-cfg=libc_ptr_addr_of
[libc 0.2.139] cargo:rustc-cfg=libc_underscore_const_names
[libc 0.2.139] cargo:rustc-cfg=libc_const_extern_fn
Running `CARGO=/Users/messense/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo CARGO_CRATE_NAME=libc CARGO_MANIFEST_DIR=/Users/messense/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/libc-0.2.139 CARGO_PKG_AUTHORS='The Rust Project Developers' CARGO_PKG_DESCRIPTION='Raw FFI bindings to platform libraries like libc.
' CARGO_PKG_HOMEPAGE='https://github.com/rust-lang/libc' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=libc CARGO_PKG_REPOSITORY='https://github.com/rust-lang/libc' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.2.139 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_PATCH=139 CARGO_PKG_VERSION_PRE='' DYLD_FALLBACK_LIBRARY_PATH='/private/tmp/hello/target/debug/deps:/Users/messense/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/messense/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/messense/lib:/usr/local/lib:/usr/lib' OUT_DIR=/private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/build/libc-64e84bd569a491f1/out rustc --crate-name libc /Users/messense/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/libc-0.2.139/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=f8dfbc19102eb84d -C extra-filename=-f8dfbc19102eb84d --out-dir /private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/deps --target aarch64-unknown-linux-gnu -C linker=aarch64-unknown-linux-gnu-gcc -L dependency=/private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/deps -L dependency=/private/tmp/hello/target/debug/deps --cap-lints warn --cfg freebsd11 --cfg libc_priv_mod_use --cfg libc_union --cfg libc_const_size_of --cfg libc_align --cfg libc_int128 --cfg libc_core_cvoid --cfg libc_packedN --cfg libc_cfg_target_vendor --cfg libc_non_exhaustive --cfg libc_ptr_addr_of --cfg libc_underscore_const_names --cfg libc_const_extern_fn`
[libsodium-sys-stable 1.19.27] OPT_LEVEL = Some("0")
[libsodium-sys-stable 1.19.27] TARGET = Some("aarch64-unknown-linux-gnu")
[libsodium-sys-stable 1.19.27] HOST = Some("aarch64-apple-darwin")
[libsodium-sys-stable 1.19.27] cargo:rerun-if-env-changed=CC_aarch64-unknown-linux-gnu
[libsodium-sys-stable 1.19.27] CC_aarch64-unknown-linux-gnu = None
[libsodium-sys-stable 1.19.27] cargo:rerun-if-env-changed=CC_aarch64_unknown_linux_gnu
[libsodium-sys-stable 1.19.27] CC_aarch64_unknown_linux_gnu = Some("aarch64-unknown-linux-gnu-gcc")
[libsodium-sys-stable 1.19.27] cargo:rerun-if-env-changed=CFLAGS_aarch64-unknown-linux-gnu
[libsodium-sys-stable 1.19.27] CFLAGS_aarch64-unknown-linux-gnu = None
[libsodium-sys-stable 1.19.27] cargo:rerun-if-env-changed=CFLAGS_aarch64_unknown_linux_gnu
[libsodium-sys-stable 1.19.27] CFLAGS_aarch64_unknown_linux_gnu = None
[libsodium-sys-stable 1.19.27] cargo:rerun-if-env-changed=TARGET_CFLAGS
[libsodium-sys-stable 1.19.27] TARGET_CFLAGS = None
[libsodium-sys-stable 1.19.27] cargo:rerun-if-env-changed=CFLAGS
[libsodium-sys-stable 1.19.27] CFLAGS = None
[libsodium-sys-stable 1.19.27] cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
[libsodium-sys-stable 1.19.27] CRATE_CC_NO_DEFAULTS = None
[libsodium-sys-stable 1.19.27] DEBUG = Some("true")
[libsodium-sys-stable 1.19.27] CARGO_CFG_TARGET_FEATURE = Some("neon")
[libsodium-sys-stable 1.19.27] cargo:rustc-link-lib=static=sodium
[libsodium-sys-stable 1.19.27] cargo:rustc-link-search=native=/private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/build/libsodium-sys-stable-89142f0be5ca3d78/out/installed/lib
[libsodium-sys-stable 1.19.27] cargo:include=/private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/build/libsodium-sys-stable-89142f0be5ca3d78/out/source/libsodium-stable/src/libsodium/include
[libsodium-sys-stable 1.19.27] cargo:lib=/private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/build/libsodium-sys-stable-89142f0be5ca3d78/out/installed/lib
Running `CARGO=/Users/messense/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo CARGO_CRATE_NAME=libsodium_sys CARGO_MANIFEST_DIR=/Users/messense/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/libsodium-sys-stable-1.19.27 CARGO_PKG_AUTHORS='dnaq:jedisct1' CARGO_PKG_DESCRIPTION='Maintained FFI bindings for libsodium stable' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=libsodium-sys-stable CARGO_PKG_REPOSITORY='https://github.com/jedisct1/libsodium-sys-stable' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=1.19.27 CARGO_PKG_VERSION_MAJOR=1 CARGO_PKG_VERSION_MINOR=19 CARGO_PKG_VERSION_PATCH=27 CARGO_PKG_VERSION_PRE='' DYLD_FALLBACK_LIBRARY_PATH='/private/tmp/hello/target/debug/deps:/Users/messense/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/messense/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/messense/lib:/usr/local/lib:/usr/lib' OUT_DIR=/private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/build/libsodium-sys-stable-89142f0be5ca3d78/out rustc --crate-name libsodium_sys /Users/messense/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/libsodium-sys-stable-1.19.27/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' -C metadata=82ec504b9e478e9d -C extra-filename=-82ec504b9e478e9d --out-dir /private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/deps --target aarch64-unknown-linux-gnu -C linker=aarch64-unknown-linux-gnu-gcc -L dependency=/private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/deps -L dependency=/private/tmp/hello/target/debug/deps --extern libc=/private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/deps/liblibc-f8dfbc19102eb84d.rmeta --cap-lints warn -L native=/private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/build/libsodium-sys-stable-89142f0be5ca3d78/out/installed/lib -l static=sodium`
Compiling hello v0.1.0 (/private/tmp/hello)
Running `CARGO=/Users/messense/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo CARGO_BIN_NAME=hello CARGO_CRATE_NAME=hello CARGO_MANIFEST_DIR=/private/tmp/hello CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=hello CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 DYLD_FALLBACK_LIBRARY_PATH='/private/tmp/hello/target/debug/deps:/Users/messense/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/messense/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/messense/lib:/usr/local/lib:/usr/lib' rustc --crate-name hello --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=1654636f1b3efdd7 -C extra-filename=-1654636f1b3efdd7 --out-dir /private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/deps --target aarch64-unknown-linux-gnu -C linker=aarch64-unknown-linux-gnu-gcc -C incremental=/private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/incremental -L dependency=/private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/deps -L dependency=/private/tmp/hello/target/debug/deps --extern libsodium_sys=/private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/deps/liblibsodium_sys-82ec504b9e478e9d.rlib -L native=/private/tmp/hello/target/aarch64-unknown-linux-gnu/debug/build/libsodium-sys-stable-89142f0be5ca3d78/out/installed/lib`
Finished dev [unoptimized + debuginfo] target(s) in 9.13s Make sure you didn't enable the |
Let me check on the |
It requires |
Ahh ok, that makes sense! Thank you so much for all the help. I massively appreciate that. 🙏🙏🙏 |
Description
cargo build --target aarch64-unknown-linux-gnu -r
works fine ✅but
cargo zigbuild --target aarch64-unknown-linux-gnu -r
❌Steps to reproduce
Command
Error
The text was updated successfully, but these errors were encountered: