Compile basecurve tool in darktable... Windows

I was interested in playing with the basecurve generating tool but I can’t seem to compile it… I seem to be able to get through writing the build files without error but it won’t complete the compiling.

I get this :slight_smile:

cmake --build . – install

[1/2] Linking CXX executable darktable-curve-tool.exe
FAILED: darktable-curve-tool.exe
C:\WINDOWS\system32\cmd.exe /C “cd . && C:\msys64\ucrt64\bin\c++.exe -O3 -DNDEBUG CMakeFiles/darktable-curve-tool.dir/darktable-curve-tool.obj CMakeFiles/darktable-curve-tool.dir/exif-wrapper.obj -o darktable-curve-tool.exe -Wl,–out-implib,libdarktable-curve-tool.dll.a -Wl,–major-image-version,0,–minor-image-version,0 -lexiv2 -lexpat -liconv -lm -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd .”
C:/msys64/ucrt64/bin/…/lib/gcc/x86_64-w64-mingw32/13.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/darktable-curve-tool.dir/darktable-curve-tool.obj:darktable-curve-tool.c:(.text+0x1d32): undefined reference to drand48' C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/darktable-curve-tool.dir/darktable-curve-tool.obj:darktable-curve-tool.c:(.text+0x1d6a): undefined reference to drand48’
C:/msys64/ucrt64/bin/…/lib/gcc/x86_64-w64-mingw32/13.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/darktable-curve-tool.dir/darktable-curve-tool.obj:darktable-curve-tool.c:(.text+0x1de0): undefined reference to `drand48’
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

I am not sure this output will provide any info but if it does could you set me strait… TIA

IIRC, the basecurve code has never been adapted for Windows… Specifically, drand48 is not portable.

Okay thanks…I thought I tried it in wsl with ubuntu and got something similar but I will go back and check…

WIP (within MSYS2 installation only)

1 Like

Wow I just saw this…

I really appreciate you doing that… Thank you…

Well, it might build now, but not sure how well it’ll work… In any case, you’d need to build w/ that special MSYS2 install flag (you’ll only be able to run this from e.g. UCRT64 or whatever terminal), add required packages via pacman (dcraw, gnuplot, ImageMagick), and manually add exiftool somewhere on the path. I’m not toying w/ it further, so good luck!

I’ll let you know…if not I will just use it in Linux…

Thanks again…

Thanks for trying to help out…it may work and I may have done something wrong but when I go to build it I get this output…

cmake -DCMAKE_INSTALL_PREFIX=“@CMAKE_INSTALL_PREFIX@” -DCMAKE_INSTALL_LIBEXECDIR=“@CMAKE_INSTALL_LIBEXECDIR@” -DCMAKE_BUILD_TYPE=Release …
– Building for: Ninja
CMake Warning (dev) in CMakeLists.txt:
No project() command is present. The top-level CMakeLists.txt file must
contain a literal, direct call to the project() command. Add a line of
code such as

project(ProjectName)

near the top of the file, but after cmake_minimum_required().

CMake is pretending there is a “project(Project)” command on the first
line.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
cmake_minimum_required() should be called prior to this top-level project()
call. Please see the cmake-commands(7) manual for usage documentation of
both commands.
This warning is for project developers. Use -Wno-dev to suppress it.

– The C compiler identification is GNU 13.2.0
– The CXX compiler identification is GNU 13.2.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: C:/msys64/ucrt64/bin/cc.exe - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: C:/msys64/ucrt64/bin/c++.exe - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 3.29)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run “cmake --help-policy CMP0000”.
This warning is for project developers. Use -Wno-dev to suppress it.

– Configuring done (1.0s)
– Generating done (0.0s)
CMake Warning:
Manually-specified variables were not used by the project:

CMAKE_INSTALL_LIBEXECDIR

– Build files have been written to: C:/msys64/home/xxxxxxxx/darktable/tools/basecurve/build

It’s not meant to be built standalone.

Ya I am likely missing something but I get roughly the same error on ubuntu trying to use it…I am just following the instructions provided in the readme in the basecurve directory….

I think I followed this tutorial to generate a base curve, but the curve was not good for my 7D. I must have done something wrong.

That’s where I started and I thought it would be easy…

Then I read this and tried to follow it…

https://github.com/darktable-org/darktable/blob/master/tools/basecurve/README.cmake.md

Seems like the name of the tool changed??

Anyway I might have another go at it…

You have to realize noone invested in the basecurve tool or its documentation since the switch to scene-referred workflow.

Oh I do and that’s why I thanked you. For fun on many recent playraw files I tried it and surprisingly it gave very nice results… Picking one of the color preservation modes and using the fusion option with the tone eq I found was often very pleasing. Now that it has been moved from its old position in the pipeline I think it does behave better than the legacy configuration.

I tried it recently on one of the sunset images shared with banding around the sun and to me I found it actually gave a more pleasing result than either filmic or sigmoid.

I also will many times edit without either of these modules and use the tone eq , local contrast and diffuse or sharpen to manage tone and contrast.

I wanted to try and create a basecurve for my Pixel phone just for fun to see what it might offer but its not the end of the world… I tried a few more times last night and never got the darktable-curve-tool… so I will just abandon the idea.

It would be nice to know if the code does work or is broken or maybe more likely I am just the weak link. In any case there might be some people that would still like to use it