Compiling the sources on macOS Monterey

Hi all,

having watched the latest video posted by @anon41087856 on darktable optimization, I tried to compile the github sources for dt 3.8.0 on my mac laptop (Monterey).

I followed all the steps on the github pages, but when I tried to run the build script (which the instructions say would work also for mac):

./build.sh --prefix /opt/darktable --build-type Release --install --sudo

the build process stopped very quickly with the following error:

darktable build script

Building directory: /Users/gp/darktable/build
Installation prefix: /opt/darktable
Build type: Release
Build generator: Unix Makefiles
Build tasks: 4
CPU Architecture: Intel

CMake Error at /opt/local/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
(Required is at least version “4.5”)
Call Stack (most recent call first):
/opt/local/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/opt/local/share/cmake-3.22/Modules/FindOpenMP.cmake:544 (find_package_handle_standard_args)
CMakeLists.txt:89 (find_package)

– Configuring incomplete, errors occurred!
See also “/Users/gp/darktable/build/CMakeFiles/CMakeOutput.log”.
See also “/Users/gp/darktable/build/CMakeFiles/CMakeError.log”.

Note that I have macports installed and also:

  • libomp @13.0.0_1 (active)
  • llvm-9.0 @9.0.1_2 (active)
  • llvm-13 @13.0.0_0 (active)
  • llvm_select @2_0 (active)

Searching the web I understood that the clang compiler in xcode has removed the openmp option. Does anybody (perhaps @MStraeten?) know a workaround for this?

thanks in advance!
giuseppe

have a look at https://github.com/darktable-org/darktable/blob/master/packaging/macosx/BUILD.txt
thats the way I build my stuff and it works fine.

1 Like

Hi @MStraeten, thanks for the quick reply. I am trying it right now. A couple of questions though:

  1. I have a working installation of macports that I use for many ports I need for work: I am assuming that after having successfully built darktable, I should revert the modified macports.conf, variants.conf and sources.conf files to their original version (in order to continue using macports for other software). Is this correct?

  2. Going through the steps by changing configuration files, getting patches, etc. is pretty time consuming, especially if you had to redo everything every time you want to get a fresh build. Do you follow the same process yourself, or do you have devised a script to make it a more streamlined process? (If yes, would you be able to share it?)

thanks
giuseppe

I did the patches once and sometimes if there are major changes in the affected libraries. If your build toolchain is properly setup you don’t need to touch it again.
But I can’t tell you if the settings in macports.conf or variants.conf might be set different - I never tested that. Even not if changes might affect other stuff.
Not all patches are mandatory since their purpose ist to get rid of unneeded stuff (e.g. in gmic) or support 10.7 as deployment target. I’d didn’t check, if these can be ditched even i replaced 10.7 compatibility by 10.15 (so i can provide development builds here to support not just the latest OS X version)

Thanks @MStraeten, that’s useful. I did build dt successfully, both the 3.8.0 stable version and the master 3.9 one. I have a couple of other questions, though, if I may:

  1. I am not sure I understood the last sentence in your message. MacOS 10.7 is quite old now, and I am currently on 12.2 on this machine. Should I set macosx_deployment_target to 12.2 in macports.conf? Would there be any benefit/drawback?

  2. In building dt, I saw some message in the terminal saying that llvm was not found. However, I have both llvm-9.0 and llvm-13 installed and active from macports. Is that a concern? (dt seems to work fine so far).

thanks again
giuseppe

  1. if you just build for your osx version you don’t need to set a deployment target.
  2. dt is build using Xcode tools - so missing macports llvm message seems to be not relevant

I see, but should I rebuild without setting the deployment target, or that would not bring any benefit?

thanks!

In that case then, should I also remove the flag -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 from the following command?

$ cmake … -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_OBJCXX_FLAGS=-stdlib=libc++ -DOpenMP_C_INCLUDE_DIR=/opt/local/include/libomp -DOpenMP_CXX_INCLUDE_DIR=/opt/local/include/libomp -DCMAKE_LIBRARY_PATH=/opt/local/lib/libomp -DBINARY_PACKAGE_BUILD=ON -DRAWSPEED_ENABLE_LTO=ON -DBUILD_CURVE_TOOLS=ON -DBUILD_NOISE_TOOLS=ON -DDONT_USE_INTERNAL_LUA=OFF