etemesi254 / zune-image

A fast and memory efficient image library in Rust
Other
332 stars 30 forks source link

Remove unnecessary cdylib crate-type #187

Closed tronical closed 7 months ago

tronical commented 7 months ago

Creating a shared library seems not necessary for this crate (as opposed to say zune-capi), while at the same time cdylib as crate type may break compilation when using it in another cdylib while cross-compiling on Linux:

Typically cross-builds on Linux (against Yocto, for example) require the use of --sysroot (and potentially other linker flags). In Slint (https://github.com/slint-ui/slint/tree/master/api/cpp), we create a cdylib for use with CMake with the help of Corrosion (https://github.com/corrosion-rs/corrosion), which passes --sysroot to the final link line (corrosion_link_args). But since the cargo crate type to build is cdylib, any cdylibs on the way seem to be created as well, which would include zune-jpeg. Linking that would fail as --sysroot is not supplied.

It seems however that this isn't necessarily overall, so removing this fixes it and also speeds up the general build.

etemesi254 commented 7 months ago

Thank you for this, I wasn't familiar with the intricacies. I can't remember why I had cdylib but I see no problem with removing it.

tronical commented 7 months ago

Thanks :)

etemesi254 commented 7 months ago

will release a rc2 with this fix

ogoffart commented 4 months ago

This issue prevent us to upgrade to image 0.25 in Slint. Would it be possible to backport this fix in a 0.4.x version of zune-jpeg so it is automatically taken by the image crate?

vorporeal commented 1 month ago

@etemesi254 Bumping the request from above - could this be backported into the 0.4.x release branch (as an 0.4.14 release)? We cannot update to the latest versions of the image crate (which is preventing a number of other dependency version bumps for us) because our app will fail to compile in release mode with debugging symbols enabled.