Closed nui closed 1 year ago
Weird thing about this issue is that it works fine when not specify build target.
If you don't specify build target, it's not cross compiling so it's gonna link with system zlib which generally works.
For cross compiling, you should static link zlib. See https://github.com/rust-lang/libz-sys/blob/0bb7bd4dbc31c7125a72fce3dcfa266658b7078f/Cargo.toml#L39-L66.
Oh thanks for pointing me to correct direction.
This comment is for future rust people if you get hit by this problem.
Add this line to you Cargo.toml
to enable static link zlib
libz-sys = { version = "1.1.12", features = ["static"] }
Got error while building with
cargo zigbuild --release --target x86_64-unknown-linux-gnu
in docker, but it works fine when usecargo zigbuild --release
(not specify target)It seems like this is a problem when host system is
x86_64-unknown-linux-gnu
and you build for this system. Building from apple m1 tox86_64-unknown-linux-gnu
work fine.I have included minimal reproducable example with dockerfile here, https://github.com/nui/cross-libgit2-issue
You can run
docker build https://github.com/nui/cross-libgit2-issue.git
to see full log.