Building Darktable on macOS Big Sur 11.1

I am brand new to the macOS. (basic familiarity with it, first time user).
I do sort of daily builds on Windows and Linux so I do understand the process.

Looking at
build instructions

Can I follow these instructions to build?

The very first line states 64 bit Intel only and the M1 is arm based.
Next is the installation of MacPorts, there is one for macOS Big Sur v11 , I assume I pick that one up.
Then there are some 10.7 references, not sure if those remain the same or change.

The reason I am asking these questions is, I don’t want get myself attempting to install something that won’t work and I will in all likelihood have a tough time undoing thing as I am not fully aware of thing on the macOS.

I am more than willing to experiment with some guidance.

TIA
-chhil

2 Likes

You’re the first one I’ve seen building on Apple M1. darktable builds on ARM on Linux, so general arm support is there.

Of course you can ditch the „macosx_deployment_target 10.7“ and „ DCMAKE_OSX_DEPLOYMENT_TARGET=10.7“ statements - these are just needed if you intend to build for the older platforms too.
It might be more challenging to get a proper macports environment with current XCode…

Following instructions on the macos build.txt

Installed xcode.
Built and installed macports. Set up path variable.
Modified the files as required in the build.txt

Ran into problem at

cp -R “$(port dir gnutls)” ~/ports/devel
I get Port gnutls not found.

What is supposed to be replaced for $(port dir gnutls)?

The path to the gnutls folder macports. Can you run port Dir gnutls in the terminal? Is gnutls installed from macports?

gnutls should be there if macports 2.6.4 is installed. I reinstalled macports a few days ago from scratch - and this was ok.
I’m not sure which path variable you set. There’s no path variable to set according to BUILD.txt

No ports are installed. I wasn’t aware one needs to install ports separately, but in hindsight it makes sense.

went ahead trying to see what can be installed.

chhil@Murtuzas-Mac-mini ~ % port variants gnutls
gnutls has the variants:
dane: Build libdane using unbound libraries
[+]doc: Build documentation
guile: Build guile bindings
universal: Build for multiple architectures

chhil@Murtuzas-Mac-mini ~ % sudo port install gnutls +universal +dane +guile

—> Computing dependencies for gnutls

Error: Cannot install gnutls for the archs ‘arm64 x86_64’ because

Error: its dependency guile only supports the arch ‘arm64’.

Error: Follow MacPorts Guide to report a bug.

Error: Processing of port gnutls failed

chhil@Murtuzas-Mac-mini ~ % port installed

No ports are installed.

I built macports from source.
Then updated the path variable based on macports documentaion 2.5. MacPorts and the Shell

I went ahead and installed the pre packaged macports for BigSur.
The macports installed the gnutls ports and I could move forward.

This line in DT build instructions gave me an error , patch could not be applied.

I proceeded further.

At line which installs the dependencies

It errored out after some building

—> Attempting to fetch libunistring-0.9.10.tar.gz from ftp://ftp.lip6.fr/pub/gnu/libunistring
—> Verifying checksums for libunistring
—> Extracting libunistring
—> Configuring libunistring
—> Building libunistring
Error: Failed to build libunistring: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_libunistring/libunistring/main.log for details.
Error: Follow MacPorts Guide to report a bug.
Error: Processing of port git failed

Any pointers to get around this would be greatly appreciated.
Thank you @paperdigits and @MStraeten for assisting.

for clarity

murtuzachhil@Murtuzas-Mac-mini ~ % sudo port install git exiv2 libgphoto2 gtk-osx-application-gtk3 lensfun librsvg libsoup openexr json-glib flickcurl GraphicsMagick openjpeg lua webp libsecret pugixml osm-gps-map adwaita-icon-theme tango-icon-theme intltool iso-codes libomp gmic

—> Computing dependencies for git

The following dependencies will be installed:

bzip2

coreutils

curl

expat

glib2

gmp

kerberos5

libcomerr

libedit

libffi

libidn

libidn2

libpsl

libunistring

lz4

openssl

p5.28-authen-sasl

p5.28-b-cow

p5.28-capture-tiny

p5.28-cgi

p5.28-clone

p5.28-cpan-meta

p5.28-cpan-meta-requirements

p5.28-cpan-meta-yaml

p5.28-devel-checkbin

p5.28-digest-hmac

p5.28-digest-sha1

p5.28-encode

p5.28-encode-locale

p5.28-error

p5.28-extutils-makemaker

p5.28-extutils-manifest

p5.28-gssapi

p5.28-html-parser

p5.28-html-tagset

p5.28-http-date

p5.28-http-message

p5.28-inc-latest

p5.28-io

p5.28-io-html

p5.28-io-socket-inet6

p5.28-io-socket-ip

p5.28-io-socket-ssl

p5.28-lwp-mediatypes

p5.28-module-build

p5.28-module-metadata

p5.28-mozilla-ca

p5.28-net-libidn

p5.28-net-smtp-ssl

p5.28-net-ssleay

p5.28-perl-ostype

p5.28-pod-escapes

p5.28-pod-simple

p5.28-podlators

p5.28-scalar-list-utils

p5.28-socket

p5.28-socket6

p5.28-sub-name

p5.28-sub-uplevel

p5.28-term-readkey

p5.28-test-deep

p5.28-test-exception

p5.28-test-fatal

p5.28-test-needs

p5.28-test-nowarnings

p5.28-test-warn

p5.28-time-local

p5.28-timedate

p5.28-try-tiny

p5.28-uri

p5.28-version

pcre

pcre2

pkgconfig

popt

python38

python3_select

python_select

rsync

sqlite3

xxhashlib

zlib

zstd

Continue? [Y/n]:

—> Building libunistring

Error: Failed to build libunistring: command execution failed

Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_libunistring/libunistring/main.log for details.

Error: Follow MacPorts Guide to report a bug.

Error: Processing of port git failed

What does the Log say?

Did you try to build just libunistring?

Currently, following it up on macports bug tracking.
The logs are attached there.

https://trac.macports.org/ticket/61858

A dev on macport went ahead and made some changes to the official darktable port for macports. Doesn’t help me, but it may help people building DT on non M1 macs without using the build instructions provided by DT. I have not tested this and I don’t why separate instructions are provided for DT.

Just doing a sudo port -v install darktable on a mac should work.

The following is quoted from a reply on the macports bug tracker:

I had a go at building darktable on Catalina.

First thing I can tell you is that it is set up to only build properly in the +quartz variant.

I fixed it to the point where the x11 variant would build (this is the default for MacPorts) and run, but there are no visible menus – otherwise it works. I’ll check that out and consider pushing it if that x11 fix is correct.

He then went ahead to install the pre built image and came to the conclusion that they (gui) were identical.

the separate build instructions in darktable/BUILD.txt at master · darktable-org/darktable · GitHub focus on building a package, that can be run on multiple osx revisions beginning with 10.7. This is actively maintained.
the macports build just runs on your box - but it’s not maintained sufficiently

I am specifically targetting a build for the M1 mac (building for older OS versions is not my aim), which the current build instructions don’t satisfy or the dt macport port. If I need to work with the master branch I need the ability to build it myself.

On Big Sur you will already have git installed, no need for that port, in case that is helpful.

I will try it out, currently trying to get the macports version of darktable to work a there are people that can help support that in the macports forums.

As stated in Help Offer: Compiling on M1 Apple computer · Issue #7564 · darktable-org/darktable · GitHub the homebrew instructions were updated, so darktable can also be built with homebrew in general (i tried this successfully in a virtual mojave installation). Just for a local use until somebody adapts the packaging instructions to deal with homebrew build environment.
But that also doesn’t help if the stuff isn’t ported for arm :wink:

I finally got it to run on Big Sur 11.1 building with Xcode 12.3 (SDK11.1) and macports. The libgcrypt was missing a #include in one of the files which resulted in build failure, and cairo required patching to prevent a runtime crash of DT.

2 Likes

Were these changes local ? Or they have been updated in their repos?