rust-cross / cargo-zigbuild

Compile Cargo project with zig as linker
MIT License
1.45k stars 52 forks source link

Cross compiling and linking OpenSSL? #127

Closed VorpalBlade closed 1 year ago

VorpalBlade commented 1 year ago

I have been using cross before, but was interested in zigbuild because it supposedly offers better build speeds.

However, it isn't clear to me how to deal with openssl-sys. For cross (which uses docker/podman containers) you can use a pre build step to install the openssl system package to link against: https://github.com/cross-rs/cross/wiki/Recipes#pre-build

How would this work with zigbuild?

messense commented 1 year ago

You can static compile openssl.

See https://docs.rs/openssl/latest/openssl/#vendored

VorpalBlade commented 1 year ago

That is rather slower than installing it as a binary as a pre-build step. Besides, I want to dynamically link OpenSSL and use the system provided library rather than link it statically into my binary.

So... No that is not a solution.

NobodyXu commented 1 year ago

That is rather slower than installing it as a binary as a pre-build step. Besides, I want to dynamically link OpenSSL and use the system provided library rather than link it statically into my binary.

So... No that is not a solution.

@VorpalBlade You can override environment variable PKG_CONFIG_PATH to provide your own pkg-config data, pointing to your openssl installation.