Skip to content

Add ONNX Runtime bundling to macOS packaging#20507

Merged
TurboGit merged 1 commit intodarktable-org:masterfrom
andriiryzhkov:ai_macos
Mar 13, 2026
Merged

Add ONNX Runtime bundling to macOS packaging#20507
TurboGit merged 1 commit intodarktable-org:masterfrom
andriiryzhkov:ai_macos

Conversation

@andriiryzhkov
Copy link
Contributor

Summary

  • Install ONNX Runtime to lib/ (not lib/darktable/) on macOS so it lands alongside other bundled dylibs in the app bundle, consistent with how install_dependencies handles homebrew libraries
  • Add fallback ONNX Runtime copy in the packaging script for direct builds where CMake install wasn't run
  • Works with both auto-downloaded and homebrew-installed ONNX Runtime

##Changes

  • src/ai/CMakeLists.txt: macOS install destination changed from LIBDIR/darktable to LIBDIR (Linux/Windows unchanged)
  • packaging/macosx/3_make_hb_darktable_package.sh: fallback section to copy ONNX Runtime dylib if not already present from CMake install or homebrew

Fixes: #20503

@zisoft
Copy link
Collaborator

zisoft commented Mar 13, 2026

works for me, the downloaded onnxruntime library is now in the bundle.

Should I see any models for download in the settings?

Bildschirmfoto 2026-03-13 um 16 23 27

@andriiryzhkov
Copy link
Contributor Author

Should I see any models for download in the settings?

Not yet, as this PR does not introduce any AI consumer-feature. That would be in next AI PR.

@TurboGit TurboGit added the scope: macos support macos related issues and PR label Mar 13, 2026
@TurboGit TurboGit added this to the 5.6 milestone Mar 13, 2026
Copy link
Member

@TurboGit TurboGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@TurboGit TurboGit merged commit c1847d4 into darktable-org:master Mar 13, 2026
5 checks passed
@TurboGit
Copy link
Member

TurboGit commented Mar 14, 2026

@zisoft @andriiryzhkov

During GtLab-CI we still have issue:

https://github.com/darktable-org/darktable/actions/runs/23081801495/job/67052281650?pr=20506

The ONNX runtime is downloaded. Fine. But probably not installed with Darktable.

And so, at the end, the test for the binary crash with:

dyld[41466]: Library not loaded: @rpath/libonnxruntime.1.23.2.dylib
  Referenced from: <306E7A41-5987-370A-9569-BDF9BF447EC2> /Users/runner/work/darktable/darktable/install/bin/darktable
  Reason: tried: '/Users/runner/work/darktable/darktable/install/bin/../lib/darktable/libonnxruntime.1.23.2.dylib' (no such file), '/Users/runner/work/darktable/darktable/install/bin/../lib/darktable/libonnxruntime.1.23.2.dylib' (no such file)

Maybe this is because my PR (#20504) is still not merged.

@zisoft
Copy link
Collaborator

zisoft commented Mar 14, 2026

The lib is expected to be in ../lib/darktable but is installed in ../lib

So the change in src/ai/CMakeLists.txt is wrong

@TurboGit
Copy link
Member

So we need to just revert this, I let you propose the PR?

@zisoft
Copy link
Collaborator

zisoft commented Mar 14, 2026

Made some more analysis:

This is a real mess. The darktable binaries expect the libs to be either in the system library paths or in <install_dir>/lib/darktable. This can be inspected by running otool on one of the darktable binaries:

otool -l ./darktable

At the very end of the output we get the RPATH:

Load command 77
          cmd LC_RPATH
      cmdsize 48
         path @loader_path/../lib/darktable (offset 12)

onnxruntime.dylib is installed in <install_dir>/lib (where it really should be), not in <install_dir>/lib/darktable, so the runtime load of the library fails.

During package building the load pathes are corrected, this is why running darktable from the application bundle now works fine, but all CLI executables fail.

@TurboGit
Copy link
Member

@zisoft : Hope you'll find a way to fix the mess. Maybe @andriiryzhkov can help sorting this out?

@andriiryzhkov andriiryzhkov deleted the ai_macos branch March 14, 2026 15:42
@MStraeten
Copy link
Collaborator

I built a port file for macports and there were several sdk related issues and also an RPath issue. Maybe check the comments in https://github.com/macports/macports-ports/pull/31567/changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: macos support macos related issues and PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Latest nightly build Marketable crashes straight away on start

4 participants