Compiling darktable .dmg: A bump in the tracks

Maybe this can help:

2 Likes

Parafin is back and said that the OSX package will be build next weekend. :+1:

4 Likes

Welcome back, Parafin :man_cartwheeling: :tada: :woman_cartwheeling:

Hi there,
I’m new to Mac and as I’d like to contribute to DT and be able to pull the latest dev version, compile it and use it along side 2.6.0 (is that ok?) I’m trying to follow the BUILD.TXT instructions.

I’m currently stuck with this line :cp -R "$(port dir python36)" ~/ports/lang
which is part of all the patches for python and other things just because we’ve set the deployment target to 10.7.
I’m totally unsure as to know if this is absolutely necessary… This is what I get:

$ cp -R "$(port dir python36)" ~/ports/lang
-bash: port: command not found
cp: : No such file or directory

Edit : I haven’t restarted my terminal after installing Macports hence this error… Sorry about that, just figured that out. I am still going through the build.txt and will let you know where I’m at :slight_smile:

Thanks everyone
Cheers

Hi again,

I’ve got further following the build instructions and was able to install a lot of packages and dependencies with

$ 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

However it’s stopped on GNUTLS :

—> Building gnutls

Error: gnutls cannot be built while autoconf-archive is active.

Error: Please forcibly deactivate autoconf-archive, e.g. by running:

Error:

Error: sudo port -f deactivate autoconf-archive

Error:

Error: Then try again. You can reactivate autoconf-archive again later.

Error: Failed to build gnutls: autoconf-archive is active

Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gnutls/gnutls/main.log for details.

Error: Follow MacPorts Guide to report a bug.

Error: Processing of port libsoup failed

I’ve tried what’s suggested, and also deactivate gnome-common but still failing in the middle of it :

$ sudo port install gnutls

Password:

—> Computing dependencies for gnutls

—> Building gnutls

Error: Failed to build gnutls: command execution failed

Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gnutls/gnutls/main.log for details.

Error: Follow MacPorts Guide to report a bug.

Error: Processing of port gnutls failed

Here’s the end of the log if it helps. I can’t figure out what’s wrong with it…

:info:build ld: warning: cannot export hidden symbol __gnutls_x86_cpuid_s from accelerated/.libs/libaccelerated.a(x86-common.o)
:info:build ld: weak import of symbol ‘_connectx’ not supported because of option: -no_weak_imports for architecture x86_64
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:build make[4]: *** [libgnutls.la] Error 1
:info:build make[4]: Leaving directory /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gnutls/gnutls/work/gnutls-3.6.6/lib' :info:build make[3]: *** [all-recursive] Error 1 :info:build make[3]: Leaving directory /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gnutls/gnutls/work/gnutls-3.6.6/lib’
:info:build make[2]: *** [all] Error 2
:info:build make[2]: Leaving directory /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gnutls/gnutls/work/gnutls-3.6.6/lib' :info:build make[1]: *** [all-recursive] Error 1 :info:build make[1]: Leaving directory /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gnutls/gnutls/work/gnutls-3.6.6’
:info:build make: *** [all] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gnutls/gnutls/work/gnutls-3.6.6’
:info:build Command failed: cd “/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gnutls/gnutls/work/gnutls-3.6.6” && /usr/bin/make -j8 -w all
:info:build Exit code: 2
:error:build Failed to build gnutls: command execution failed
:debug:build Error code: CHILDSTATUS 79587 2
:debug:build Backtrace: command execution failed
:debug:build while executing
:debug:build “system {}$notty {}$nice $fullcmdstring”
:debug:build invoked from within
:debug:build “command_exec build”
:debug:build (procedure “portbuild::build_main” line 8)
:debug:build invoked from within
:debug:build “$procedure $targetname”
:error:build See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gnutls/gnutls/main.log for details.

Thanks ahead of time for your support, really appreciated !

Due to gnutls updated behaviour :wink: parafin changed the build description.
You need to perform (copies from BUILD.txt)
mkdir -p ~/ports/devel/gnutls/files
cp -R “$(port dir gnutls)” ~/ports/devel
curl -Lo ~/ports/devel/gnutls/files/patch.diff https://raw.github.com/darktable-org/darktable/master/packaging/macosx/gnutls-disable-connectx.diff

then append this line:
patchfiles-append patch.diff
to ~/ports/devel/gnutls/Portfile files you just copied (except for pugixml) and run:
$ portindex ~/ports

and then wait for a rawspeed patch for openmp support, that is already implemented in the rawspeed project but not yet transfered to darktables submodule directory - or copy the changed files from rawspeed project yourself.

2 Likes

Thanks !!
I applied the patch and then everything ran smoothly from there, and was able to go through

$ 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

entirely. Indeed I see more recent commits on rawspeed dealing with openmp (like 369c170), and on DT it seems that the most recent commit in src/external/rawspeed is 5 days old (1ca1601).
The latter seems to be the one I need to consider.

Thanks again for helping :slight_smile:

Hello all,
Thanks to all the advices I’ve managed to build my very first DT .dmg file. I installed it just fine and now I can run DT 2.6.0 or current build 2b76ca3.

For those interested in the details, I’d be happy to discuss further what I did and what happened.

The only thing that remain unsolved is the very last line of the BUILD.TXT file where it says, before a new build, to uninstall DT from /usr/local assuming it is the only program installed there. This is not the case for me, so I’m not quite sure how the proceed there.

Would only remove /usr/local/share be enough?

Thanks again for helping me out :slight_smile:

Indeed, Seb; a detailed description of the steps taken, problems encountered and corrections /adjustments made to the procedure would be highly appreciated.would be much appreciated

Ok, here we go. I’ll try to make it as accurate and concise as I can.

First, since I git clone --recurse-submodules https://github.com/darktable-org/darktable.git last week, I needed to make sure I had everything updated. so I

$ cd ~/src/darktable
$ git pull

and then resume the built.txtinstructions :

 $ cd darktable
 $ mkdir build
 $ cd build
 $ cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 -DCMAKE_C_FLAGS=-I/opt/local/include/libomp -DCMAKE_CXX_FLAGS="-stdlib=libc++ -I/opt/local/include/libomp" -DCMAKE_LIBRARY_PATH=/opt/local/lib/libomp -DBINARY_PACKAGE_BUILD=ON -DRAWSPEED_ENABLE_LTO=ON
 $ make

the cmake command went through but complained that I haven’t had JDK installed and suggested a link. I went ahead and downloaded the dmg file here.
the make failed also at 7% while building src⁩ ▸ ⁨darktable⁩ ▸ ⁨src⁩ ▸ ⁨external⁩ ▸ ⁨rawspeed⁩ ▸ ⁨src⁩ ▸ ⁨librawspeed⁩ ▸ ⁨common⁩ ▸ ⁨Rawimage.cpp⁩. I opened it and realised that I was not using the latest commit which included the GnuTLS update. In fact my first git pull did update DT repo but not its submodules. So this is when I :

 $ git submodule update --remote —recursive

although I think that

$ cd ~/src⁩/darktable⁩/src⁩/external⁩/rawspeed
$ git pull

would have done the trick as well. (Can someone confirm that ?) I guess I’m not familiar enough with working with git and submodules.
Checking the hash number and Rawimage.cpp confirmed that I’ve now updated everything correctly. I then did :

$ cd ~/src⁩/darktable
$ rm -r build
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 -DCMAKE_C_FLAGS=-I/opt/local/include/libomp -DCMAKE_CXX_FLAGS="-stdlib=libc++ -I/opt/local/include/libomp" -DCMAKE_LIBRARY_PATH=/opt/local/lib/libomp -DBINARY_PACKAGE_BUILD=ON -DRAWSPEED_ENABLE_LTO=ON

The output of cmake looked better with JDK installed, and this time the make command went all the way to 100%.

I then did :

2). Download, patch and install gtk-mac-bundler (assuming darktable was cloned into ~/src directory):
     $ cd ~/src
     $ curl -O https://ftp.gnome.org/pub/gnome/sources/gtk-mac-bundler/0.7/gtk-mac-bundler-0.7.4.tar.xz
     $ tar -xf gtk-mac-bundler-0.7.4.tar.xz
     $ cd gtk-mac-bundler-0.7.4
     $ patch -p1 < ../darktable/packaging/macosx/gtk-mac-bundler-0.7.4.patch
     $ make install

which ran ok, followed by

3). Now preparation is done, run image creating script, it should create darktable-<VERSION>.dmg in current (packaging/macosx) directory:
     $ cd ~/src/darktable/packaging/macosx
     $ ./make-app-bundle

which failed at $ ./make-app-bundle because I’ve had skip (intentionally) the $ sudo make installon purpose. I realised that I needed it installed so the DMG can be generated. At that point I ran :

$ cd ~/src/darktable/build
$ sudo make install

This went well. So I tried again to :

     $ cd ~/src/darktable/packaging/macosx
     $ ./make-app-bundle

At that point in time it asks me if Terminal could take over Finder. I was not sure and clicked “no” or something meaning no anyway. The DMG was created but size was ridiculously small and output showed some error like “Not authorized to send Apple events to System Events.”. I knew this has to do with the authorisation I had just denied so I googled a bit and then went to setings/Security and privacy/Privacy and selected Automation on the right hand side. I could there see Terminal and just below indented Finder unchecked. Checked it, restarted Terminal and that was it for the authorisation.

Restarting Terminal and

     $ cd ~/src/darktable/packaging/macosx
     $ ./make-app-bundle

did not do the trick. The DMG file has to be deleted first. Once I’ve done that and tried once more

$ ./make-app-bundle

It works just fine and the DMG file was finally created with an approx size of 70mb. Double clicked on it (renamed the former Darktable in app as Darktable_26, and then dragged over the new Darktable.

Firing up one or the other just start the correct version of the software, and all the settings and styles that I had set up in 2.6 were in the built version also, which is great.

So to summarise I’d say that the main takeaways of this are:

  • delete the build directory if you’re unsure, and restart the process from there
  • do not forget do update the dependencies
  • Install JDK as it’s surely needed
  • Allow Terminal to take over Finder when prompted (first time only)

Yet to try :

  • update Darktable to the latest changes and redo the whole process
  • finding out how to uninstall ONLY Darktable in usr/local as it is suggested to do so before attempting another building process.

Hope this clarifies things up and helps.

Cheers

2 Likes

Thanks, Seb :+1:

./make-app-bundle only requires to delete the *.dmg if no new version flag was received via git pull … because the version is part of the dmg filename

Hello again.
With one recent commits I’m having trouble to compile the libraries needed for openCL
(reported as issue_2568 on Github).

I was wondering is the last instructions of the BUILD.txt file could be the cause : assuming DT is the only program installed in /usr/local/ you should remove it before the next build.
I didn’t do that (because I have other things installed there).
Does someone know if this could be linked ?

Thanks

sometimes after installing experimental stuff from pull request not working properly some libraries needs to be deleted to avoid side effects with the current master.
It’s sufficient to do
sudo rm -rf /usr/local/share/darktable
sudo rm -rf /usr/local/lib/darktable
to get rid of experimental stuff

1 Like

Thanks for the quick reply !
I’m currently fiddling around with a PR for a particular issue, but before that I pulled the head of master and I couldn’t get it to compile lut3d.cl. All the others went through, and as a result I can’t get openCL working. This is why I thought that maybe it could be.
With previous version I was doing just that, and after a few restarts it went through, not sure why it does not today.
I’ll make sure I clean these folders next time I try. Thanks for the tip !

Hi there,
Because I’m stuck with the compilation of lut3d.cl and can’t get openCL working, I was thinking that maybe I could sudo port selfupdate and then sudo port upgrade outdated to update everything and maybe that would solve my problem.

I did just that and ran into the same issue as before with gnutls. Right now I’m thinking I’ll follow again the instructions in BUILD.txt to make sure everything is in order but still I4m wondering how do you guys do to update your libraries ?

Thanks for the feedback :slight_smile:

for me - i reinstalled macport enviroment yesterday after cleaning up to much stuff :wink:
sudo port -f deactivate autoconf-archive
helped gnutls to build.
after that use
sudo port -f activate autoconf-archive to revert the setting

Indeed it worked for gnutls.
I’ve pulled the latest master and it keeps throwing me seg fault now. I’m pretty sure this is just me since I updated my whole port system, but I don’t know what’s happening.

Have you ever seen this ?

2019-05-20 23:31:40.707 darktable-bin[73737:4142555] -[_CFXNotificationObjectRegistration visibleFrame]: unrecognized selector sent to instance 0x7f7f71433f30

2019-05-20 23:31:40.718 darktable-bin[73737:4142555] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_CFXNotificationObjectRegistration visibleFrame]: unrecognized selector sent to instance 0x7f7f71433f30'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff531f0cf9 __exceptionPreprocess + 256
	1   libobjc.A.dylib                     0x00007fff7dd80a17 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff5326ab06 -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x00007fff531930ef ___forwarding___ + 1485
	4   CoreFoundation                      0x00007fff53214d18 __forwarding_prep_1___ + 120
	5   libgdk-3.0.dylib                    0x000000010d82e77a gdk_quartz_monitor_get_workarea + 101
	6   libgtk-3.0.dylib                    0x000000010d3ba05b gtk_window_guess_default_size + 83
	7   libgtk-3.0.dylib                    0x000000010d3af427 gtk_window_compute_configure_request + 305
	8   libgtk-3.0.dylib                    0x000000010d3b68c5 gtk_window_realize + 573
	9   libgobject-2.0.0.dylib              0x000000010dc0f2a1 _g_closure_invoke_va + 208
	10  libgobject-2.0.0.dylib              0x000000010dc22d20 g_signal_emit_valist + 1125
	11  libgobject-2.0.0.dylib              0x000000010dc236a8 g_signal_emit + 120
	12  libgtk-3.0.dylib                    0x000000010d39a35c gtk_widget_realize + 279
	13  libgtk-3.0.dylib                    0x000000010d35f525 gtk_tooltip_show_tooltip + 440
	14  libgtk-3.0.dylib                    0x000000010d360244 tooltip_popup_timeout + 44
	15  libgdk-3.0.dylib                    0x000000010d7ffc60 gdk_threads_dispatch + 50
	16  libglib-2.0.0.dylib                 0x000000010d013ea8 g_timeout_dispatch + 20
	17  libglib-2.0.0.dylib                 0x000000010d0169ad g_main_context_dispatch + 258
	18  libglib-2.0.0.dylib                 0x000000010d016ca8 g_main_context_iterate + 426
	19  libglib-2.0.0.dylib                 0x000000010d016ede g_main_loop_run + 191
	20  libgtk-3.0.dylib                    0x000000010d273989 gtk_main + 74
	21  libdarktable.dylib                  0x000000010cce8156 dt_gui_gtk_run + 198
	22  darktable-bin                       0x000000010cb95f1a main + 42
	23  darktable-bin                       0x000000010cb95ee4 start + 52
	24  ???                                 0x0000000000000003 0x0 + 3
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

I had several segfaults some time ago due to opencl settings, but mostly without such console output.
After disabling opencl (darktable —disable-opencl ) darktable became stable.
Finally i found changing opencl_number_event_handles to a higher or lower value than 25 solved or at least suppressed most issues with opencl. But i don’t have an idea, why :wink:

well, since I can’t compile lut3d.cl, openCL is always disable for me… That’s pretty much the reason why I tried to update my ports in the first place, but it did make any difference (made things worse actually…)

So I’m not too sure whether or not it’s openCL related. I’d think not.

For the seg fault I have this : Magick: abort due to signal 11 (SIGSEGV) "Segmentation Fault"... Abort trap: 6