Closed bbigras closed 3 years ago
The generated bindings can be quite troublesome, I have to admit. I don't have a Windows system to test this, but that may not be the issue. If I can get a Windows VM to test with, I'll give it a try. In the mean time, look for the bindings.rs
file and see how QuantumRange
is namespaced. Maybe it's getting some additional prefix, as bindgen has a tendency to do different things depending on flags and versions.
There's no QuantumRange "whole word" in bindings.rs, The only matches are:
extern "C" {
pub fn GetMagickQuantumRange(arg1: *mut usize) -> *const libc::c_char;
}
extern "C" {
pub fn MagickGetQuantumRange(arg1: *mut usize) -> *const libc::c_char;
}
I'm seeing the same issue on my Gentoo system.
Seing the same error with magick_rust-0.10.0
.
Gentoo Linux,
rustc 1.32.0-nightly (14997d56a 2018-12-05)
,
imagemagick-7.0.8.11
,
clang-6.0.1
,
bindgen-0.29.1
Still happens as of v0.11.0. I'm on Gentoo as well.
Sorry to exhume this but maybe it'll be helpful: I've come across this error now using Ubuntu 18.04. What happened was I was using a quantum depth of 16 before and the build worked, everything was happy, but I was having some performance issues so I tried re-building ImageMagick with a quantum depth of 8 and hdri disabled, and now I'm getting the "QuantumRange not found in bindings
" error when I try to clean/build my application.
This is with ImageMagick 7.0.10-16 and magick_rust 0.14.0, rust 0.45.0-nightly
I see, that would certainly explain why some people see it and others do not. I wish I knew how to deal with this in better way.
After a little digging I think the problem with this is to do with this issue: https://github.com/rust-lang/rust-bindgen/issues/1585 https://github.com/rust-lang/rust-bindgen/issues/316
You can see a similar cast/define being performed where HDRI is disabled in magick-type.h when defining the QuantumRange type (indentation editorialised somewhat here)
#if (MAGICKCORE_QUANTUM_DEPTH == 8)
#define MaxColormapSize 256UL
#define MaxMap 255UL
#if defined(MAGICKCORE_HDRI_SUPPORT)
typedef MagickFloatType Quantum;
#define QuantumRange 255.0
#define QuantumFormat "%g"
#else
typedef unsigned char Quantum;
#define QuantumRange ((Quantum) 255)
#define QuantumFormat "%u"
#endif
So I'm just recompiling with quantum size=8 and hdri enabled which, if I'm correct, should give me the QuantumRange type in this library. I'll update here when I've tested it.
Edit: it works
Had this issue randomly, the patch giving features = ["disable-hdri"]
did allow it to compile for me (so thanks for that). Could this be added to the main page for documentation purposes?
Also, MAGICKCORE_HDRI_ENABLE
is set accordingly in the bindings. Perhaps it is possible to check and set things according to the value of this.
Sorry it took me a long time to respond to this. I've updated the README file so that this issue is easier resolve, at least with this temporary work-around. Eventually the issue in rust-bindgen will be fixed, and setting the feature flag in your application won't be necessary any more.
I think for now this issue can be closed, since there is a work-around and finally some guidance in the README file.
I have this error with magick-rust 0.9. 0.8 seems fine.
Windows ImageMagick-7.0.7-31 nightly-x86_64-pc-windows-msvc (default) rustc 1.27.0-nightly (428ea5f6b 2018-05-06)