darktable: Incomplete photo export in darktable-cli without OpenCL
Nixpkgs version
- Unstable (25.05)
Describe the bug
Disabling OpenCL when using darktable-cli or running darktable-cli without OpenCL available causes parts of the output images to be missing. The missing part of the image will just contain black pixels, forming a black bar at the bottom of the image.
Exporting through the UI is not affected by this bug.
I have found two workarounds so far:
- Disabling OpenMP using
-DUSE_OPENMP=OFFin package.nix - Switching to the clang stdenv and building darktable with clang
It seems like something related to OpenMP and gcc is different on NixOS compared to other distributions.
Steps to reproduce
- Install darktable or create a shell with darktable
- Run
darktable-cli <IMAGE> export.jpg --core --disable-opencl, replacing<IMAGE>with a path to some image - Check if
export.jpgmatches the input image, it will have a black bar at the bottom.
Expected behaviour
export.jpg should visually match the input image, no black bar should be present at the bottom
Screenshots
Relevant log output
Additional context
This issue was first raised on the darktable repository: https://github.com/darktable-org/darktable/issues/18127
All affected users so far appear to be using NixOS and running the testsuite on other Linux distributions does not reproduce the error.
System metadata
- system:
"x86_64-linux" - host os:
Linux 6.14.4, NixOS, 25.05 (Warbler), 25.05.20250429.46e634b - multi-user?:
yes - sandbox:
yes - version:
nix-env (Nix) 2.28.2 - channels(root):
"nixos" - channels(may):
"home-manager" - nixpkgs:
/nix/store/s8b6phy15mzjvx56vjdd1rdd8hr07qw5-source
Notify maintainers
@flosse @mrVanDalo @paperdigits @freyacodes
Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)
I assert that this issue is relevant for Nixpkgs
- [x] I assert that this is a bug and not a support request.
- [x] I assert that this is not a duplicate of an existing issue.
- [x] I assert that I have read the NixOS Code of Conduct and agree to abide by it.
Is this issue important to you?
Add a :+1: reaction to issues you find important.
Hi, thanks for the report. Can you try exporting with hq mode enabled as noted in https://github.com/darktable-org/darktable/issues/18127#issuecomment-2848731584
--hq true
Thanks!
On May 3, 2025 9:18:22 AM PDT, mayjs @.***> wrote:
mayjs created an issue (NixOS/nixpkgs#403954)
Nixpkgs version
- Unstable (25.05)
Describe the bug
Disabling OpenCL when using
darktable-clior runningdarktable-cliwithout OpenCL available causes parts of the output images to be missing. The missing part of the image will just contain black pixels, forming a black bar at the bottom of the image. Exporting through the UI is not affected by this bug.I have found two workarounds so far:
- Disabling OpenMP using
-DUSE_OPENMP=OFFin package.nix- Switching to the clang stdenv and building darktable with clang
It seems like something related to OpenMP and gcc is different on NixOS compared to other distributions.
Steps to reproduce
- Install darktable or create a shell with darktable
- Run
darktable-cli <IMAGE> export.jpg --core --disable-opencl, replacing<IMAGE>with a path to some image- Check if
export.jpgmatches the input image, it will have a black bar at the bottom.Expected behaviour
export.jpgshould visually match the input image, no black bar should be present at the bottomScreenshots
Relevant log output
Additional context
This issue was first raised on the darktable repository: https://github.com/darktable-org/darktable/issues/18127
All affected users so far appear to be using NixOS and running the testsuite on other Linux distributions does not reproduce the error.
System metadata
- system:
"x86_64-linux"- host os:
Linux 6.14.4, NixOS, 25.05 (Warbler), 25.05.20250429.46e634b- multi-user?:
yes- sandbox:
yes- version:
nix-env (Nix) 2.28.2- channels(root):
"nixos"- channels(may):
"home-manager"- nixpkgs:
/nix/store/s8b6phy15mzjvx56vjdd1rdd8hr07qw5-sourceNotify maintainers
@flosse @mrVanDalo @paperdigits @freyacodes
Note for maintainers: Please tag this issue in your pull request description. (i.e.
Resolves #ISSUE.)I assert that this issue is relevant for Nixpkgs
- [x] I assert that this is a bug and not a support request.
- [x] I assert that this is not a duplicate of an existing issue.
- [x] I assert that I have read the NixOS Code of Conduct and agree to abide by it.
Is this issue important to you?
Add a :+1: reaction to issues you find important.
-- Reply to this email directly or view it on GitHub: https://github.com/NixOS/nixpkgs/issues/403954 You are receiving this because you were mentioned.
Message ID: @.***>
Hi, thanks for the report. Can you try exporting with hq mode enabled as noted in <darktable-org/darktable#18127 (comment)>
--hq trueThanks! …
Actually, I already ran the test suite as a part of my experiments, the results also show the issue. So HQ mode does not seem to make a difference (I even set it to false for one of my tests).
Let me know if I can assist in any other way! I would love to help resolve this, I just don't know the best approach for further analysis right now.
Thanks. This seems like one that's going to be tricky. 🙃
On May 3, 2025 11:42:04 AM PDT, mayjs @.***> wrote:
mayjs left a comment (NixOS/nixpkgs#403954)
Hi, thanks for the report. Can you try exporting with hq mode enabled as noted in <darktable-org/darktable#18127 (comment)>
--hq trueThanks! …
Actually, I already ran the test suite as a part of my experiments, the results also show the issue. So HQ mode does not seem to make a difference (I even set it to false for one of my tests).
Let me know if I can assist in any other way! I would love to help resolve this, I just don't know the best approach for further analysis right now.
-- Reply to this email directly or view it on GitHub: https://github.com/NixOS/nixpkgs/issues/403954#issuecomment-2848753648 You are receiving this because you were mentioned.
Message ID: @.***>
I don't know if it is relevant, but I've found this issue that talks about discrepancies between nixos's openmp and ubuntu using gcc.
It doesn't have any comment, so I guess it's not very helpful, but that's the only potentially relevant already open issue I could find on the nixos repository...
@paperdigits just a quick update, we have identified the root cause in darktable.
Apparently, for darktable-cli on NixOS, OpenMP dynamic thread number adjustment is allowed, resulting in some parallel for loops running in less threads than expected.
A PR to fix this by making the code not rely on the number of threads was merged yesterday and I think there is going to be an additional change to ensure that all darktable executables explicitly disable dynamic thread number adjustment.
Whether dynamic thread number adjustment is enabled or disabled by default is up to the implementation, which explains the differences between platforms and also means that all programs that require a fixed amount of threads must disable it explicitly. However, I do wonder why this appears to be enabled by default on NixOS while it's disabled by default on other platforms that are also using GCC. If this is something specific to NixOS, it might also cause failures in other programs.
For reference, this is the comment where I originally found the issue: https://github.com/darktable-org/darktable/issues/18127#issuecomment-2921643856
Actually, I just tested it, compiling a simple C program with GCC and OpenMP enabled will NOT enable dynamic thread number adjustment by default, so something else must cause it to be enabled for darktable-cli.
Aha, it turns out this is initialized to 1 by OpenCV: https://github.com/darktable-org/darktable/issues/18127#issuecomment-2925210094
I still have no idea why this is different on NixOS though, but I think we can at least close this issues or maybe close this once a new darktable version is released?
@mayjs this is an impressive bit of work, thank you so much for digging into it.
I'll close this issue for now, feel free to reopen if needed.
not sure why you closed this issue, i am still getting black bars on cli exports on nixpkgs' darktable v5.0.1.
@auroraanna have you tried the patch from the linked issue above or tried an overlay with the newest release 5.2.0?
no, i did not. point was though that the issue should not be closed as completed because it is still broken in master.
It'll be fixed by https://github.com/NixOS/nixpkgs/pull/418798
https://github.com/NixOS/nixpkgs/pull/418798 has been merged. Closing.