nlfiedler / magick-rust

Rust bindings for ImageMagick
https://crates.io/crates/magick_rust
Apache License 2.0
251 stars 67 forks source link

Embed image magick ? #58

Open abour opened 4 years ago

abour commented 4 years ago

Is it possible to embed image magick ? (I mean having all the lib statically linked in the binary)

nlfiedler commented 4 years ago

Despite working with Rust for a while, I admit that there are some things I don't know yet. I presume that it is very possible that the library can be statically linked into the binary, I just don't know how that is done exactly.

See also issue #57 which seeks to incorporate ImageMagick into a "sys" crate that would make the build easier. I suspect, as with the Rust wrapper for RocksDB, that the library would then easily be statically linked into the resulting binary.

abour commented 4 years ago

Ok thank you. I took a look on rocksdb crate. It seems rocksdb was designed to be embedded. Concerning ImageMagick, I think it will require more work because it has some dynamic dependencies. I did a quick check with otool -L (mac equivalent of ldd):

`/usr/local/opt/libomp/lib/libomp.dylib (compatibility version 5.0.0, current version 5.0.0)

/usr/local/opt/little-cms2/lib/liblcms2.2.dylib (compatibility version 3.0.0, current version 3.8.0)
/usr/local/opt/freetype/lib/libfreetype.6.dylib (compatibility version 24.0.0, current version 24.1.0)
/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
/usr/local/opt/xz/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.4.0)
/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
/usr/local/opt/libtool/lib/libltdl.7.dylib (compatibility version 11.0.0, current version 11.1.0)`