How To Keep Lensfun Current on Windows 10?

I have several program installed on Windows 10 that make use of Lensfun: darktable, Affinity Photo, and SilkyPix Developer version 10. My understanding is that each program maintains a version of Lensfun, instead of using a single system-wide installation. If this is true, are there established procedures to keep Lensfun current for various program running on Windows 10? If so, could someone point me to the information? I have searched, but most of the content related to updating Lensfun is for Linux, not Windows 10.

Actually, lensfun itself is set up to consider a hierarchy of the “standard” system data paths for both Linux and Windows. The problem is that their update mechanism is a python script that has a better connection to the Linux paths than to the Window paths, and there’s not a de rigueur deployment of Python to Windows…

Facing that challenge in my software, I wrote some C++ code to handle updating that works in both the Windows and Linux variants. Right now, it sits in a separate Github repository, both the library code and a simple dbupdate program I wrote for testing. Here’s the link: Right now, you could clone that source code and compile it for your use. That’s not a trivial thing for most folk to do, though, so I’m considering posting a release. Not trivial for me, and I’m in the middle of shepherding my own raw processor’s release for the two or three people that seem to be using it… :smiley:

What you could do right now is:

  1. Download and install rawproc 1.0.1 from here:;
  2. Run rawproc, go to Edit->Properties and set the tool.lenscorrection.databasepath to the full path where your lensfun database resides;
  3. In rawproc, select Edit->Update Data and ta-da!, the database will be updated. You can check that in the Help->About dialog, which displays the lensfun database path and its state.

Note that this approach will only work if you’re using the version_2 lensfun database, as that corresponds to the lensfun version to which rawproc 1.0.1 was linked. I’m not sure where darktable is in that regard; someone else who does is welcome to pipe in…

1 Like

In my ART and RT windows builds, I ship the @ggbutcher’s dbupdate.exe and the corresponding .bat.
Double-clicking the .bat permits to update the bundled lensfun DB.
I don’t know if any user of my builds ever used that.
available here : –

remark1: the exe needs some dll shipped in the zip which are perhaps incompatible with DT dlls versions.
I don’t know how to statically build dbupdate statically with MSYS2/mingw64. @ggbutcher can you help?

remark2: it should be much better if this function was integrated in the apps as in rawproc.

Just went looking; the work I did to produce the static build of dbupdate was on a tablet that borked a couple of weeks ago. Lots of dependencies, including the dreaded glibc.

I think I have that .exe somewhere, will take some time to find. I’m also going to re-create the static build so I can make a proper autoconf setup for it, but that’ll probably take a few weeks…

Just out of curiosity, why you use autoconf and not something like cmake?

Because I’m 63 years old, I guess… :stuck_out_tongue:

Actually, there are some things a ./configure will do that a CMakeLists.txt won’t. The big one to me is to put a copy of the ./configure command line used to make the buildfiles in config.log; I do a lot of excursions, and it’s helpful to have that record. CMake won’t make uninstall targets, although it now seems to make an install manifest that can be used with xarg to remove installed artifacts. Although I haven’t fully researched CMake on this, ./configure will let me specify paths to libraries that override the pkgconfig search, essential to my current approach of statically linking LIbraw, LittleCMS, librtprocess, and lensfun in order to better support new features like new cameras.

Funny you should ask, I was thinking today of maybe using CMake for lensfun-dbupdate, a simple project with which to learn the ropes. Absolutely no plans to replace the months of teeth-gnashing it took to autoconf rawproc, however…


Well, that hurt my head…

Finally found a CMakeLists.txt that handily produced a dbupdate executable in all my build enviroments, x86_64 Linux, Win32/mxe and Win32/msys2. With the mxe toolchain, I was able to build a dbupdate.exe that only depends on dlls in c:\windows\system32, which is as close to static as I think one gets in Windows.

dbupdate.exe is a command-line program; I can build a wininstaller, but it’s quicker for me to release in a .zip file. @sshapiro63, can you handle a .zip?

1 Like

Sure, a zip file is great.

'ere y’go:

If it doesn’t work, post the error messaging here and I’ll investigate…

1 Like

Thanks, @ggbutcher
The static build works ok. Will confirm if all is ok when building ART or RT

1 Like

Thank you for the effort. I appreciate it.

1 Like

The path for dt lensfun on my Win 10 computer is:

C:\Program Files\darktable\share\lensfun\version_1\

The xmls are date 12/14/20.

That post was about using rawproc as a lensfun database getter, before I got up off my keester and shaped up dbupdate. Since it’s linked to the github master of lensfun, rawproc 1.0.1 is essentially hard-coded to get version_2.

dbupdate.exe will get either version, for version_1 just run:

$ dbupdate.exe 1 C:\Program Files\darktable\share\lensfun\version_1\

Since I am running dt 3.4, do I need to update at this time?

Edit: also, I do not understand “$ dbupdate”. That’s the way to launch it from a command line?

Bob, there’s some context you’re missing, available in the earlier parts of the thread…

The ‘history of oil’, so to speak, is this: in rawproc, I wanted the capability to update the lensfun database ‘with the push of a button’. Coupla weeks later, I had code and two new library dependencies, libcurl and libarchive, in rawproc to do just this, works like a treat. In writing this code, I wrote a command-line program to test things outside of the rawproc code, dbupdate.cpp.

Buoyed by this success, I rounded up all the relevant artifacts into a separate github repo, butcherg/lensfun_dbupdate. My intent was to offer the functions for other software to incorporate, but it seems dbupdate.cpp has a potential life of its own as a Windows solution to the problem. So, I did the work to statically compile dbupdate.exe and to post it as a ‘version 0.1’ of sorts:

For ease of use, in my ART and RT builds I put dbupdate.exe and a dbupdate.bat in the installation root dir.
dbupdate.bat for darktable could contain:

    @echo off
    dbupdate.exe 1 share\lensfun\version_1
    set /p asd="Hit enter to continue"

Double clicking on the .bat permits to update the DB.