Help with compiling and Lensfun

I have decided to compile RawTherapee to check a Lensfun fix.
I am using Windows so I followed the instructions at
http://rawpedia.rawtherapee.com/Windows
and I have been able to compile and start RT from inside MSYS2. The program works but it does not find the Lensfun database by default since after compiling RT look at it in
./share/lensfun
and the folder is missing. For this reason Lensfun distortion correction is not available.
In MSYS2 the Lensfun database is stored at
C:\msys64\mingw64\share\lensfun\version_2
If I copy the database files from that folder to
./share/lensfun
and I run RT I immediately get a segmentation fault.

The AboutThisBuild.txt file for version 5.4 shows
Lensfun: V0.3.2.0
while mine shows
Lensfun: V0.3.95.0

My lensfun.dll is much smaller (262 KB) than V5.4’s (624 KB).

May anybody suggest a way to make Lensfun work when I build RawTherapee?

Thanks in advance.

This thread might help Darktable windows build help needed

pacman -U /var/cache/pacman/pkg/mingw-w64-x86_64-lensfun-0.3.2-4-any.pkg.tar.xz

Thank you for your help: I had just installed MSYS2 (I never used it before) so the previous version was not in the cache. I had to manually download it before, but now I installed it.

I built RT and now AboutThisBuild.txt says
Lensfun: V0.3.2.0
just like version 5.4.

I still have a problem: now MSYS2 contains lens correction files of version 1.
I had modified the database in 5.4 because I recomputed the correction parameters for my Panasonic 14-45 zoom: the original ones were terribly wrong.
For this reason I copied the lensfun database from 5.4 to my compiled version but now at startup RT complains that database version is 2, but supported is only 1.

I can modify the V1 database, of course, but since I would like to test a fix I’d rather use the same database files as version 5.4.
How can I use version 2 database, like version 5.4 is doing?

Thanks in advance.

The executable that I compiled only accepted V1 lensfun databases when I ran it from inside MSYS2.
I copied it into a downloaded 5.4-dev installation and it worked well with V2 databases. This is really strange and I have no idea why this happened.

This is not a problem for testing a fix, but I think that is could be if I were doing some real development.