Rawtherapee build for Mac Mini M1.

I tried to build a dev version for my Mac Mini M1 running macOS Monterey 12.4

Downloading source

mkdir -p ~/programs

git clone https://github.com/Beep6581/RawTherapee ~/programs/code-rawtherapee

cd ~/programs/code-rawtherapee

git checkout dev

Compile and make

cd ~/programs/code-rawtherapee
rm -rf build
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=“release”
-DPROC_TARGET_NUMBER=“1”
-DPROC_LABEL=“generic processor”
-DCACHE_NAME_SUFFIX=“5-dev”
-DCMAKE_C_COMPILER=“clang”
-DCMAKE_CXX_COMPILER=“clang++”
-DWITH_LTO=“OFF”
-DLENSFUNDBDIR=“share/lensfun”
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
-DLOCAL_PREFIX:STRING="/opt/homebrew"
-DCMAKE_OSX_ARCHITECTURES=arm64

make -j$(sysctl -n hw.ncpu) install

sudo make macosx_bundle

Install the new build

  • open RawTherapee_macOS_10.15_arm64_.dmg at ~/programs/code-rawtherapee/build

  • copy Rawtherapee to /Applications

Codesigning

  • cd /Applications
  • sudo codesign --force --deep --timestamp --strict -v -s “Hans Nieuwenhuis” -i com.rawtherapee.RawTherapee -o runtime --entitlements /Users/hn/programs/code-rawtherapee/tools/osx/rt.entitlements RawTherapee.app

Try to start Rawtherapee

  • Start Finder window, go to /Applications and double-click RawTherapee
    Rt does not start.
    Nothing happens and no error or crash dump.

  • Start finder window, go to /Users/hn/programs/code-rawtherapee/build/release/MacOS
    double-click rawtherapee
    RawTherapee starts and seems to work fine

Crash when opening images from Rt in Photoshop

Start RT from /Users/hn/programs/code-rawtherapee/build/release/MacOS

Open image (CR3) in Rt and edit current image in external editor (Photoshop)
( open -b “com.adobe.Photoshop” )
close the image in photoshop
close the image in Rt and open another (CR3) image in Rt
open this image in photoshop
close the image in Photoshop

If you do this two to four times Rt crashes.

In the terminal window where Rt is started I see :

Last login: Wed Jun 15 20:51:28 on ttys002
/Users/hn/programs/code-rawtherapee/build/release/MacOS/rawtherapee ; exit;
hn@JhmnMac1 ~ % /Users/hn/programs/code-rawtherapee/build/release/MacOS/rawtherapee ; exit;

(rawtherapee:23045): GLib-GObject-WARNING **: 21:25:57.628: invalid cast from ‘GtkMenuBar’ to ‘GtkWindow’

(rawtherapee:23045): Gtk-CRITICAL **: 21:25:57.628: gtk_window_add_accel_group: assertion ‘GTK_IS_WINDOW (window)’ failed
OMP: Info #270: omp_get_nested routine deprecated, please use omp_get_max_active_levels instead.
OMP: Info #270: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
OMP: Info #270: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
zsh: bus error /Users/hn/programs/code-rawtherapee/build/release/MacOS/rawtherapee

Saving session…
…copying shared history…
…saving history…truncating history files…
…completed.

1 Like

Tested some more.
The crash when opening an image in Photoshop or sending to queue does only happen with certain images.
So it is not dependant on how often you open images.
If i set the processing profile to neutral for such an image, it will open in Photoshop.
If i then set Detail > Defringe to on and try to open in Photoshop or sent to queue
Rt crashes.
Here is such an image
20210608-R05_3552.CR3 (53.9 MB)

The lens is not a parameter here.
Some images from this camera and lens combination with defringe on open fine in Photoshop
others make Rt crash.
This one with opens in Photoshop without crashing Rt when defringe is on.
20210323-R05_1055.CR3 (63.8 MB)

When just double clicking on /Applications/RawTherapee, Rt crashes but gives no crashdump.
If i start rawtherapee in a terminal (/Applications/RawTherapee.app/Contents/MacOS/rawtherapee )
i get a crasdump file.

Crashdump.txt (18.1 KB)

It seems i got the code-signing fixed.
but running from /Applications still crashes.
library missing :/Applications/RawTherapee.app/Contents/Frameworks/libgtkmacintegration-gtk3.4.dylib
crasdump :
CrashDump.txt (10.5 KB)

Ok, but show all the compilation steps before mkdir -p ~/programs as your dependencies are apparently not correctly deployed. Those steps and any error are crucial.

The steps before mkdir -p ~/programs are

Install Homebrew

Install Rt dependencies

  • brew install gtk+3 gtkmm3 gtk-mac-integration adwaita-icon-theme libsigc++ little-cms2 libiptcdata fftw lensfun wget llvm cmake expat pkgconfig shared-mime-info

install the previous version (11.1.0) of libomp :

Without errors, the library is expected to be in Frameworks.
Let’s see the contents of Frameworks by issuing this command:
ls /Applications/RawTherapee.app/Contents/Frameworks

ls -1 /Applications/RawTherapee.app/Contents/Frameworks
im-am-et.so
im-cedilla.so
im-cyrillic-translit.so
im-inuktitut.so
im-ipa.so
im-multipress.so
im-quartz.so
im-thai.so
im-ti-er.so
im-ti-et.so
im-viqr.so
libX11.6.dylib
libXau.6.dylib
libXdmcp.6.dylib
libXext.6.dylib
libXrender.1.dylib
libatk-1.0.0.dylib
libatkmm-1.6.1.dylib
libcairo-gobject.2.dylib
libcairo.2.dylib
libcairomm-1.0.1.dylib
libepoxy.0.dylib
libffi.8.dylib
libfftw3f.3.dylib
libfftw3f_omp.3.dylib
libfontconfig.1.dylib
libfreetype.6.dylib
libfribidi.0.dylib
libgcc_s.1.1.dylib
libgdk-3.0.dylib
libgdk_pixbuf-2.0.0.dylib
libgdkmm-3.0.1.dylib
libgio-2.0.0.dylib
libgiomm-2.4.1.dylib
libglib-2.0.0.dylib
libglibmm-2.4.1.dylib
libgmodule-2.0.0.dylib
libgobject-2.0.0.dylib
libgomp.1.dylib
libgraphite2.3.dylib
libgthread-2.0.0.dylib
libgtk-3.0.dylib
libgtkmacintegration-gtk3.4.dylib
libgtkmm-3.0.1.dylib
libharfbuzz.0.dylib
libintl.8.dylib
libiptcdata.0.dylib
libjpeg.9.dylib
liblcms2.2.dylib
liblensfun.1.dylib
libomp.dylib
libpango-1.0.0.dylib
libpangocairo-1.0.0.dylib
libpangoft2-1.0.0.dylib
libpangomm-1.4.1.dylib
libpcre.1.dylib
libpixbufloader-ani.so
libpixbufloader-bmp.so
libpixbufloader-gif.so
libpixbufloader-icns.so
libpixbufloader-ico.so
libpixbufloader-pnm.so
libpixbufloader-qtif.so
libpixbufloader-svg.so
libpixbufloader-tga.so
libpixbufloader-tiff.so
libpixbufloader-xbm.so
libpixbufloader-xpm.so
libpixman-1.0.dylib
libpng16.16.dylib
librsvg-2.2.dylib
libsigc-2.0.0.dylib
libtiff.5.dylib
libxcb-render.0.dylib
libxcb-shm.0.dylib
libxcb.1.dylib

I get a different error now. It’s complaining about the code-siging for that library
see
Error.txt (10.9 KB)

If i check the code-siging for this library it looks ok
codesign -vvv /Applications/RawTherapee.app/Contents/Frameworks/libgtkmacintegration-gtk3.4.dylib
/Applications/RawTherapee.app/Contents/Frameworks/libgtkmacintegration-gtk3.4.dylib: valid on disk
/Applications/RawTherapee.app/Contents/Frameworks/libgtkmacintegration-gtk3.4.dylib: satisfies its Designated Requirement

Maybe i did not sign correctly.
Do you have a recipe for code-signing the build version with a self-signed root certificate ?

I’m not sure if you have setup any certificates, but if you want to use the default, sign with - instead of the -s identity flag.

I used a self signed root certificate before using the syntax

sudo codesign --force --deep --timestamp --strict -v -s "Hans Nieuwenhuis" -i com.rawtherapee.RawTherapee -o runtime --entitlements /Users/hn/programs/code-rawtherapee/tools/osx/rt.entitlements /Applications/RawTherapee.app

I tried your method now

sudo codesign --force --deep --timestamp --strict -v -s - -i com.rawtherapee.RawTherapee -o runtime --entitlements /Users/hn/programs/code-rawtherapee/tools/osx/rt.entitlements /Applications/RawTherapee.app

/Applications/RawTherapee.app: replacing existing signature
/Applications/RawTherapee.app: signed app bundle with Mach-O thin (arm64) [com.rawtherapee.RawTherapee]

Still same error

Termination Reason: Namespace DYLD, Code 1 Library missing
Library not loaded: /Applications/RawTherapee.app/Contents/Frameworks/libgtkmacintegration-gtk3.4.dylib
Referenced from: /Applications/RawTherapee.app/Contents/MacOS/rawtherapee
Reason: tried: ‘/Applications/RawTherapee.app/Contents/Frameworks/libgtkmacintegration-gtk3.4.dylib’ (code signature in <6198FF13-0B3E-3667-BC45-646DA84F1D2C> ‘/Applications/RawTherapee.app/Contents/Frameworks/libgtkmacintegration-gtk3.4.dylib’ not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), ‘/usr/lib/libgtkmacintegration-gtk3.4.dylib’ (no such file)
(terminated at launch; ignore backtrace)

--deep here is not working (too complex for codesign). The runtime is also hardened against this manner of execution (mixed signatories).

Hope that helps.

That did not help.
I will dig deeper next week…
Thanks