Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

darktable: fix missing lensfun files #76529

Closed
wants to merge 1 commit into from

Conversation

hamishmack
Copy link
Contributor

Motivation for this change

When darktable starts we get an error that looks like this:

[iop_lens]: could not load lensfun database in `/nix/store/...-darktable-3.0.0/share/lensfun/version_2'!

Lens correction fails to work correctly (no thing is found).

Things done

A symlink to the lensfun database is added in preFixup.

It looks like there might be an error in lensfun or the darktable
code that uses it. With the missing database fixed the following
error is reported on startup:

** (darktable:62412): WARNING **: 00:23:58.558: [Lensfun] /nix/store/fs6lc5pa9jvy15fb3hvjmmdhs9nlsbp2-darktable-3.0.0/share/lensfun/version_2/mil-sigma.xml:35:40: Error on line 35 char 40: Element “mount” was closed, but the currently open element is “”

And when the program exits it gives:

(darktable:62412): GLib-GObject-CRITICAL **: 00:24:10.429: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
darktable(62412,0x10fdeb5c0) malloc: *** error for object 0x7fac25505400: pointer being freed was not allocated
darktable(62412,0x10fdeb5c0) malloc: *** set a breakpoint in malloc_error_break to debug
Abort trap: 6
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

When darktable starts we get an error that looks like this:

[iop_lens]: could not load lensfun database in
`/nix/store/...-darktable-3.0.0/share/lensfun/version_2'!
preFixup = let
libPathEnvVar = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
libPathPrefix = "$out/lib/darktable" + stdenv.lib.optionalString stdenv.isLinux ":${ocl-icd}/lib";
in ''
gappsWrapperArgs+=(
--prefix ${libPathEnvVar} ":" "${libPathPrefix}"
)
ln -s ${lensfun}/share/lensfun $out/share
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having lensefun a dependency is it possible to point darktable to the directory via an environment variable? We could then just have a wrapper around darktable setting that instead of triggering a rebuild of darktable when lensefun changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to avoid rebuilds, but:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would not it be preferable to patch the path here: https://github.com/darktable-org/darktable/blob/d9d279a1e1b38baaab07981dfa6bc87fe16238cf/src/iop/lens.cc#L1259

Or open an issue to respect XDG_DATA_DIRS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. Interesting. I had not looked in there. I am on macOS so it might be that the only problem is that the lensfun Load function is not actually being tried first if __APPLE__ is defined https://github.com/darktable-org/darktable/blob/d9d279a1e1b38baaab07981dfa6bc87fe16238cf/src/iop/lens.cc#L1246-L1249

Copy link
Contributor

@jtojnar jtojnar Dec 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, on Linux, the correct system path should be hopefully tried: https://github.com/lensfun/lensfun/blob/b58ac41f0f62000acdf6e73e0b5ef7c9af72efef/libs/lensfun/database.cpp#L93-L117

Maybe patching it to use Load on macOS too would be enough.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this issue on Linux. I'm not sure if darktable's cmake detects the platform as macOS and tries to build everything into one bundle, as masOS expects it, but this fix sholdn't be necessary on linux.

@stale
Copy link

stale bot commented Jun 24, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 24, 2020
@paperdigits
Copy link
Contributor

Also note that the version of lensfun shipped in 20.03 doesn't work correctly. In my own setup, I've reverted to 0.3.2

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 25, 2020
@SuperSandro2000 SuperSandro2000 marked this pull request as draft November 29, 2020 00:32
@flokli
Copy link
Contributor

flokli commented Jan 11, 2021

Is this still an issue on master/20.09?

I can use lensfun here just fine (NixOS Unstable), but #76529 (comment) seems to suggest it's a Darwin-only problem.

@stale
Copy link

stale bot commented Jul 11, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 11, 2021
@flokli
Copy link
Contributor

flokli commented Jul 11, 2021

Closing due to lack of feedback.

If this is still an issue on MacOS, please reopen.

@flokli flokli closed this Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 10.rebuild-darwin: 0 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants