dicom-rs
dicom-rs copied to clipboard
dicom-transfer-syntax-registry does not build on Windows by default
It has come to my attention that the openjp2 crate is not Windows-ready, meaning that the openjp2 Cargo feature in dicom-transfer-syntax-registry should not have been selected by default, and that JPEG 2000 support on Windows currently requires linking with the reference OpenJPEG implementation.
The known mitigation for the time being is to disable default features and selectively add the other ones. To build all the project's binaries, for example:
cargo build --release --bins --no-default-features --features=cli,rle,jpeg,backtraces,rayon,simd
Or with OpenJPEG reference software:
cargo build --release --bins --no-default-features --features=cli,rle,jpeg,backtraces,openjpeg-sys,openjpeg-sys-threads,rayon,simd
(It is a bit more complicated when selecting a specific package via -p)
Moving forward:
- There are no plans in sight for the
openjp2crate to support Windows, because the port is based on C2Rust, which only guarantees support for Linux and Mac OS. - It is not possible to change Cargo feature listings based on the target platform (https://github.com/rust-lang/cargo/issues/1197). It would be possible to change the dependencies' features depending on the target operating system, but with the Cargo features already laid out, I don't see a way to resolve both situations, especially without introducing some complexity in the
pixeldatacrate. - Removing
openjp2as a feature depended by the default featurenativewould be cleaner, but if this is done in a patch release, it would break expectations of existing Linux users depending on this. On the other hand, a bump to version 0.7.0 would feel over the top, as it has so far been reserved for a bigger bundle of breaking changes. - I wonder if it is possible to monkey-patch the
openjp2crate based on the target platform. Then one would be able to replace it with a stub on Windows and feature-gate the rest. Alternatively, one may have to maintain separateopenjp2andjpeg2kpackages just for DICOM-rs.