cykooz / libheif-sys Goto Github PK
View Code? Open in Web Editor NEWRust bindings to libheif-dev
License: MIT License
Rust bindings to libheif-dev
License: MIT License
heif_context_read_from_reader
calls triggers
unsafe precondition(s) violated: slice::from_raw_parts_mut requires the pointer to be aligned and non-null, and the total size of the slice not to exceed
isize::MAX
I did not call it directly but used HeifContext::read_from_reader
. But I guess the issue here is the design of the slice types used?
I recently upload libheif-sys to debian experimental and noticed that most of the tests fail on 32-bit arches (arm(el,hf), i386, mipsel, powerpc, x32).
Log:
running 9 tests
test bindings::bindgen_test_layout_heif_color_profile_nclx ... ok
test bindings::bindgen_test_layout_heif_decoding_options ... FAILED
test bindings::bindgen_test_layout_heif_init_params ... ok
test bindings::bindgen_test_layout_heif_encoding_options ... FAILED
test bindings::bindgen_test_layout_heif_error ... FAILED
test bindings::bindgen_test_layout_heif_depth_representation_info ... FAILED
test bindings::bindgen_test_layout_heif_plugin_info ... FAILED
test bindings::bindgen_test_layout_heif_writer ... FAILED
test bindings::bindgen_test_layout_heif_reader ... FAILED
failures:
---- bindings::bindgen_test_layout_heif_decoding_options stdout ----
thread 'bindings::bindgen_test_layout_heif_decoding_options' panicked at 'assertion failed: `(left == right)`
left: `24`,
right: `48`: Size of: heif_decoding_options', src/bindings.rs:1231:5
stack backtrace:
0: rust_begin_unwind
at /usr/src/rustc-1.66.0/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:65:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:203:5
4: libheif_sys::bindings::bindgen_test_layout_heif_decoding_options
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:1231:5
5: libheif_sys::bindings::bindgen_test_layout_heif_decoding_options::{{closure}}
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:1227:1
6: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
7: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- bindings::bindgen_test_layout_heif_encoding_options stdout ----
thread 'bindings::bindgen_test_layout_heif_encoding_options' panicked at 'assertion failed: `(left == right)`
left: `16`,
right: `24`: Size of: heif_encoding_options', src/bindings.rs:1751:5
stack backtrace:
0: rust_begin_unwind
at /usr/src/rustc-1.66.0/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:65:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:203:5
4: libheif_sys::bindings::bindgen_test_layout_heif_encoding_options
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:1751:5
5: libheif_sys::bindings::bindgen_test_layout_heif_encoding_options::{{closure}}
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:1747:1
6: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
7: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- bindings::bindgen_test_layout_heif_error stdout ----
thread 'bindings::bindgen_test_layout_heif_error' panicked at 'assertion failed: `(left == right)`
left: `12`,
right: `16`: Size of: heif_error', src/bindings.rs:122:5
stack backtrace:
0: rust_begin_unwind
at /usr/src/rustc-1.66.0/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:65:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:203:5
4: libheif_sys::bindings::bindgen_test_layout_heif_error
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:122:5
5: libheif_sys::bindings::bindgen_test_layout_heif_error::{{closure}}
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:119:1
6: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
7: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- bindings::bindgen_test_layout_heif_depth_representation_info stdout ----
thread 'bindings::bindgen_test_layout_heif_depth_representation_info' panicked at 'assertion failed: `(left == right)`
left: `56`,
right: `64`: Size of: heif_depth_representation_info', src/bindings.rs:610:5
stack backtrace:
0: rust_begin_unwind
at /usr/src/rustc-1.66.0/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:65:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:203:5
4: libheif_sys::bindings::bindgen_test_layout_heif_depth_representation_info
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:610:5
5: libheif_sys::bindings::bindgen_test_layout_heif_depth_representation_info::{{closure}}
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:606:1
6: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
7: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- bindings::bindgen_test_layout_heif_plugin_info stdout ----
thread 'bindings::bindgen_test_layout_heif_plugin_info' panicked at 'assertion failed: `(left == right)`
left: `16`,
right: `24`: Size of: heif_plugin_info', src/bindings.rs:215:5
stack backtrace:
0: rust_begin_unwind
at /usr/src/rustc-1.66.0/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:65:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:203:5
4: libheif_sys::bindings::bindgen_test_layout_heif_plugin_info
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:215:5
5: libheif_sys::bindings::bindgen_test_layout_heif_plugin_info::{{closure}}
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:212:1
6: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
7: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- bindings::bindgen_test_layout_heif_writer stdout ----
thread 'bindings::bindgen_test_layout_heif_writer' panicked at 'assertion failed: `(left == right)`
left: `8`,
right: `16`: Size of: heif_writer', src/bindings.rs:1458:5
stack backtrace:
0: rust_begin_unwind
at /usr/src/rustc-1.66.0/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:65:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:203:5
4: libheif_sys::bindings::bindgen_test_layout_heif_writer
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:1458:5
5: libheif_sys::bindings::bindgen_test_layout_heif_writer::{{closure}}
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:1455:1
6: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
7: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- bindings::bindgen_test_layout_heif_reader stdout ----
thread 'bindings::bindgen_test_layout_heif_reader' panicked at 'assertion failed: `(left == right)`
left: `20`,
right: `40`: Size of: heif_reader', src/bindings.rs:385:5
stack backtrace:
0: rust_begin_unwind
at /usr/src/rustc-1.66.0/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:65:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /usr/src/rustc-1.66.0/library/core/src/panicking.rs:203:5
4: libheif_sys::bindings::bindgen_test_layout_heif_reader
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:385:5
5: libheif_sys::bindings::bindgen_test_layout_heif_reader::{{closure}}
at /usr/share/cargo/registry/libheif-sys-1.14.2/src/bindings.rs:382:1
6: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
7: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.66.0/library/core/src/ops/function.rs:251:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
failures:
bindings::bindgen_test_layout_heif_decoding_options
bindings::bindgen_test_layout_heif_depth_representation_info
bindings::bindgen_test_layout_heif_encoding_options
bindings::bindgen_test_layout_heif_error
bindings::bindgen_test_layout_heif_plugin_info
bindings::bindgen_test_layout_heif_reader
bindings::bindgen_test_layout_heif_writer
test result: FAILED. 2 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
error: test failed, to rerun pass `--lib`
dh_auto_test: error: /usr/share/cargo/bin/cargo test --all returned exit code 101
It looks like the mismatch is just off by the factor 2. I can patch around it for now, just letting you know that it fails on 32bit arches.
1.14.2
version of this crate supported 1.12.0 libheif version available on Ubuntu 22.04, but commit 32945e7 changed this and now I got this error
The following warnings were emitted during compilation:
warning: `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" PKG_CONFIG_ALLOW_SYSTEM_LIBS="1" "pkg-config" "--libs" "--cflags" "libheif" "libheif >= 1.14"` did not exit successfully: exit status: 1
error: failed to run custom build command for `libheif-sys v1.14.3`
Caused by:
process didn't exit successfully: `/home/runner/work/czkawka/czkawka/target/debug/build/libheif-sys-8ce37a5972be52d4/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=LIBHEIF_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=LIBHEIF_STATIC
cargo:rerun-if-env-changed=LIBHEIF_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:warning=`PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" PKG_CONFIG_ALLOW_SYSTEM_LIBS="1" "pkg-config" "--libs" "--cflags" "libheif" "libheif >= 1.14"` did not exit successfully: exit status: 1
error: could not find system library 'libheif' required by the 'libheif-sys' crate
--- stderr
Requested 'libheif >= 1.14' but version of libheif is 1.12.0
You may find new versions of libheif at https://github.com/strukturag/libheif
warning: build failed, waiting for other jobs to finish...
I know that in readme there is minimal version 1.14.0, but can "real" minimal version be restored at least for 1.14 version of libheif-sys?
I think fcfba4e broke the build on Windows:
The following warnings were emitted during compilation:
warning: `"pkg-config" "--libs" "--cflags" "libheif" "libheif >= 1.14"` did not exit successfully: exit code: 1
error: failed to run custom build command for `libheif-sys v1.14.3`
Caused by:
process didn't exit successfully: `D:\HOME\vault\projects\imagehash\target\debug\build\libheif-sys-5ea8e5c56504397d\build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-env-changed=LIBHEIF_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=LIBHEIF_STATIC
cargo:rerun-if-env-changed=LIBHEIF_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=LIBHEIF_STATIC
cargo:rerun-if-env-changed=LIBHEIF_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:warning=`"pkg-config" "--libs" "--cflags" "libheif" "libheif >= 1.14"` did not exit successfully: exit code: 1
error: could not find system library 'libheif' required by the 'libheif-sys' crate
--- stderr
Package libheif was not found in the pkg-config search path.
Perhaps you should add the directory containing `libheif.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libheif', required by 'virtual:world', not found
Package 'libheif', required by 'virtual:world', not found
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.