rust-cross / rust-musl-cross

Docker images for compiling static Rust binaries using musl-cross
MIT License
620 stars 68 forks source link

`pkg-config` error while compiling `openssl-sys` on x86_64-musl #44

Closed Jason5Lee closed 2 years ago

Jason5Lee commented 2 years ago

I tried to cross-compile a project with openssl dependency. I searched for the solutions and many of them mentioned this project.

But I tried to use rust-musl-cross:x86_64-musl and get the error.

  run pkg_config fail: "pkg-config has not been configured to support cross-compilation.\n\nInstall a sysroot for the target platform and configure it via\nPKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\ncross-compiling wrapper for pkg-config and set it via\nPKG_CONFIG environment variable."

I saw the Remove OpenSSL issue, which states

It's better to just use the openssl-src crate.

And the openssl-src crate states

intended to be consumed by the openssl-sys

But this is the crate I have a problem with. So I'm confused and have no idea of how to fix it.

messense commented 2 years ago

Example: https://github.com/dragonflyoss/image-service/commit/81e3ce530963cc86f0ab0d1c8abbcbd6627c89d6