Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update image to 0.25 #1903

Merged
merged 14 commits into from
May 7, 2024
Merged

feat: Update image to 0.25 #1903

merged 14 commits into from
May 7, 2024

Conversation

foresterre
Copy link
Owner

@foresterre foresterre commented Mar 13, 2024

Original plan

Status

  • image 0.25 feature avif-native (with native dav1d lib) will be ported separately, to reduce delays.

@foresterre
Copy link
Owner Author

for linux:

SYSTEM_DEPS_DAV1D_BUILD_INTERNAL: always works

@foresterre
Copy link
Owner Author

foresterre commented Mar 18, 2024

for windows, these instructions work:

https://docs.rs/crate/dav1d/latest

to consider:

dont forget

To speed up the computation, you can build your packages only in Release mode adding the set(VCPKG_BUILD_TYPE release) line to the $VCPKG_INSTALLATION_ROOT\triplets\x64-windows.cmake file.

@foresterre foresterre force-pushed the image-0.25 branch 3 times, most recently from f8184db to 62a55b6 Compare March 21, 2024 02:46
@foresterre
Copy link
Owner Author

foresterre commented Mar 21, 2024

Porting impl: done, next: remaining tests, ci, imageproc

@foresterre foresterre force-pushed the image-0.25 branch 2 times, most recently from c69738a to 04dbe63 Compare March 22, 2024 01:22
@foresterre
Copy link
Owner Author

open issues:

  • building dav1d with vcpkg on Windows results in a dll instead of static linking

  • building dav1d manually by cloning dav1d 1.3.0 like dav1d-rs ci does results in a failure during the first meson build step, which states `C:\a\dav1d\meson.build:25:0: ERROR: Compiler cl cannot compile programs" (I wonder if cl can't compile programs, what cl is for 🤔🤔)

    • I've cl 19.29.30154 for x64 and have setup the linker paths using vswhere (see sic CI)
  • when copying the dav1d.dll to debug build window:

running cargo run --no-default-features -- --input .\resources\palette_4x4.png --output example.avif succeeds

but then running cargo run --no-default-features -- --input .\example.avif --output example.png fails with this monstrosity (i.e. our decoder can't read the output of our encoder???):

   Finished dev [unoptimized + debuginfo] target(s) in 0.22s
     Running `target\debug\sic.exe --input .\example.avif --output example.png`
Error: With: .\example.avif

Caused by:
    Format error

Stack backtrace:
   0: std::backtrace_rs::backtrace::dbghelp::trace
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:131
   1: std::backtrace_rs::backtrace::trace_unsynchronized
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2: std::backtrace::Backtrace::create
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\std\src\backtrace.rs:331
   3: std::backtrace::Backtrace::capture
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\std\src\backtrace.rs:297
   4: anyhow::error::impl$1::from<enum2$<sic_io::errors::SicIoError> >
             at C:\Users\al\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.81\src\error.rs:565
   5: core::result::impl$27::from_residual<tuple$<>,enum2$<sic_io::errors::SicIoError>,anyhow::Error>
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112\library\core\src\result.rs:1963
   6: sic::cli::pipeline::run<sic::cli::pipeline::run_with_devices::closure_env$0,sic::cli::pipeline::run_with_devices::closure_env$1,sic::cli::pipeline::Output>
             at .\src\cli\pipeline.rs:81
   7: sic::cli::pipeline::run_with_devices
             at .\src\cli\pipeline.rs:27
   8: sic::main
             at .\src\main.rs:28
   9: core::ops::function::FnOnce::call_once<enum2$<core::result::Result<tuple$<>,anyhow::Error> > (*)(),tuple$<> >
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112\library\core\src\ops\function.rs:250
  10: std::sys_common::backtrace::__rust_begin_short_backtrace<enum2$<core::result::Result<tuple$<>,anyhow::Error> > (*)(),enum2$<core::result::Result<tuple$<>,anyhow::Error> > >
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112\library\std\src\sys_common\backtrace.rs:154
  11: std::rt::lang_start::closure$0<enum2$<core::result::Result<tuple$<>,anyhow::Error> > >
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112\library\std\src\rt.rs:167
  12: std::rt::lang_start_internal::closure$2
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\std\src\rt.rs:148
  13: std::panicking::try::do_call
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\std\src\panicking.rs:552
  14: std::panicking::try
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\std\src\panicking.rs:516
  15: std::panic::catch_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\std\src\panic.rs:142
  16: std::rt::lang_start_internal
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\std\src\rt.rs:148
  17: std::rt::lang_start<enum2$<core::result::Result<tuple$<>,anyhow::Error> > >
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112\library\std\src\rt.rs:166
  18: main
  19: invoke_main
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  20: __scrt_common_main_seh
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  21: BaseThreadInitThunk
  22: RtlUserThreadStart
error: process didn't exit successfully: `target\debug\sic.exe --input .\example.avif --output example.png` (exit code: 1)

@foresterre
Copy link
Owner Author

To link statically, we should be able to use

SYSTEM_DEPS_DAV1D_LINK=static
SYSTEM_DEPS_DAV1D_BUILD_INTERNAL=auto

@foresterre foresterre changed the title chore: Update image to 0.25 feat: Update image to 0.25 Mar 25, 2024
So far, it's been difficult to get it to compile consistently cross-platform. Linux works out of the box. Mac is hard to test properly without owning a device (can test with GitHub actions runner, but is suboptimal), so deferred until getting Windows working smoothly. Windows I got working with a dynamic library approach, but statically linking gives all sorts of problems. It's also hard to get consistent results accross Windows instances such as the github runners, and local compiles.
Now zune-jpeg is used, it doesn't do it for us anymore.
@foresterre foresterre marked this pull request as ready for review May 7, 2024 20:31
@foresterre foresterre merged commit 941dcd7 into main May 7, 2024
10 checks passed
@foresterre foresterre deleted the image-0.25 branch May 7, 2024 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant