-
-
Notifications
You must be signed in to change notification settings - Fork 484
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
Configure: Enable FULLY static builds #368
Comments
Ok, finally noticed that the patch at the SO link above used To ensure a fully static build, you need only follow the existing directions in INSTALL: download
|
Ugh, zlib vs libz name seems to vary between platforms. |
Does 9d8f968 work for you? |
I don’t think so—it doesn’t look like anything has actually changed in that commit? It’s still missing “libz.a” in the list of names to search for.
…-Bryan
On Nov 21, 2020, at 09:53, Kornel ***@***.***> wrote:
Does 9d8f968 work for you?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
It searches for libz.* first, and then searches for zlib.* |
The latest version on the main branch: cargo build --release --features=lcms2-static,png-static,z-static or 100% static: rustup target add x86_64-unknown-linux-musl
# install musl build utils if needed
cargo build --release --features=lcms2-static,png-static,z-static --target=x86_64-unknown-linux-musl |
Amazing. Thank you! Will this work for target Darwin and Windows as well? And is latest 3.x stable enough for usage? I saw on your website that stable is 2.x branch. |
MUSL target is specifically for the Linux kernel only. Darwin does not support 100% static executables — you're required to use libSystem. I don't know what Windows supports in theory, but in practice Rust just has msvc and gnu targets that require some runtime libraries. In all cases you can have static 3rd party deps like zlib/png/lcms2. |
I've updated the site. The current status is:
|
Thank you for clarification! |
I am waiting for v4 than. I am using statically built for Linux v2. And v2 for Windows and MacOS which I downloaded from your website. I am developing desktop app which is multi OS, and it's written in Go Lang. I know that it would be better to create Go Lang bindings for libpngquant, but I don't have time now for that. I am willing to pay "price" for fork-exec :-) |
https://github.com/kornelski/pngquant/blob/3.0.3/CHANGELOG Since 3.0.0, pngquant uses libimagequant 4.x, which is a Rust rewrite, and and switches the build system from make to Cargo. The `pngquant` executable is now a Rust wrapper around `pngquant.c`, which in turn interfaces with libimagequant via the `imagequant_sys` crate, which exports a C API.[1] The CLI seems unchanged. Upstream lacks a Cargo.lock[2], so I generated one and patched it in. Set `doCheck = false;` as there are no Rust-based tests. `test/` was previously part of the make-based workflow (which is gone with pngquant 3.x) and looks like it isn't meant for pngquant 3.x anyway (as `test.sh` executes `$BIN --version 2>&1 | fgrep 2.`). `$ nix build .#pkgsCross.raspberryPi.pngquant` succeeds[3]; remove the workaround originally introduced in [4]. Notes on dependencies: - While nixpkgs package libimagequant on its own, pngquant depends on a specific vendored version - pngquant 3.x depends on the libpng-sys and lcms2-sys crates, which provide bindings to the respective C libraries. If those are not provided by the system at build time, vendored versions of them will be built and statically linked; libpng 1.6.37 and LCMS 2.15, respectively [1] See also: kornelski/pngquant#368 (comment) [2] See also: kornelski/pngquant#347 [3] New SSE flag decision logic: https://github.com/kornelski/pngquant/blob/3.0.3/rust/build.rs#L31 [4] NixOS#145672
The
INSTALL
documentation lists a procedure for ensuring that pngquant statically links tolibpng
(put the source for libpng as subfolder of pngquant's source,configure
it with the static flag, thenmake
it.)However,
zlib
is still linked dynamically, no matter what the hell I try to do to change that. It would be very handy to have baked-in support for statically linking zlib as well.I tried this, but had no luck: https://stackoverflow.com/questions/35582138/compile-a-static-version-of-pngquant
The text was updated successfully, but these errors were encountered: