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: https://github.com/butcherg/lensfun_dbupdate. 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:
    https://github.com/butcherg/rawproc/releases/download/1.0.1/rawproc-1.0.1-w64.exe;
  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 : dbupdate.zip ā€“ Keybase.pub

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ā€¦

2 Likes

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:

https://github.com/butcherg/lensfun_dbupdate/releases/tag/0.1

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:

https://github.com/butcherg/lensfun_dbupdate/releases/tag/0.1

@Underexposed
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.

2 Likes