Solved: No longer able to compile darktable (Windows msys2)

Hi,

I update my mysys2 environment and tried to compile dt 4.4.0 but I am having an error due apparently to a deprecated warning in darktable/src/develop/lightroom.c. I was able to compile and install from master last week with no issue. Not sure what changed.

I would appreciate any help!

Here is the output:

FAILED: bin/CMakeFiles/lib_darktable.dir/develop/lightroom.c.obj
C:\msys64\mingw64\bin\cc.exe -DAVIF_DLL -DGDK_DISABLE_DEPRECATED -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_24 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_MIN_REQUIRED -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_56 -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES -DHAVE_BUILTIN_CPU_SUPPORTS -DHAVE_CONFIG_H -DHAVE_GAME -DHAVE_GMIC -DHAVE_GPHOTO2 -DHAVE_GRAPHICSMAGICK -DHAVE_ICU -DHAVE_IMATH -DHAVE_ISO_CODES -DHAVE_LIBAVIF=1 -DHAVE_LIBEXIV2_WITH_ISOBMFF=1 -DHAVE_LIBHEIF=1 -DHAVE_LIBJXL -DHAVE_LIBRAW=1 -DHAVE_LIBSECRET -DHAVE_LIBSHARPYUV=1 -DHAVE_MAP -DHAVE_OPENCL -DHAVE_OPENEXR -DHAVE_OPENJPEG -DHAVE_OSMGPSMAP_110_OR_NEWER -DHAVE_OSMGPSMAP_NEWER_THAN_110 -DHAVE_SQLITE_324_OR_NEWER -DHAVE_VISIBILITY -DHAVE_WEBP -DIMATH_DLL -DLIBHEIF_EXPORTS -DLIBRAW_NODLL -DNATIVE_ARCH -DOPENEXR_DLL -DSQLITE_CORE -DSQLITE_ENABLE_ICU -DUSE_LUA -D_POSIX_THREAD_SAFE_FUNCTIONS -D_USE_MATH_DEFINES -D__USE_MINGW_ANSI_STDIO=1 -Dlib_darktable_EXPORTS -IC:/msys64/home/msika/darktable/build/bin -IC:/msys64/home/msika/darktable/src -IC:/msys64/home/msika/darktable/src/external/LuaAutoC -IC:/msys64/home/msika/darktable/src/external/whereami/src -IC:/msys64/home/msika/darktable/src/external/LibRaw -isystem C:/msys64/home/msika/darktable/src/external -isystem C:/msys64/home/msika/darktable/src/external/OpenCL -isystem C:/msys64/mingw64/include/glib-2.0 -isystem C:/msys64/mingw64/lib/glib-2.0/include -isystem C:/msys64/mingw64/include/gtk-3.0 -isystem C:/msys64/mingw64/include/pango-1.0 -isystem C:/msys64/mingw64/include/harfbuzz -isystem C:/msys64/mingw64/include/freetype2 -isystem C:/msys64/mingw64/include/libpng16 -isystem C:/msys64/mingw64/include/fribidi -isystem C:/msys64/mingw64/include/cairo -isystem C:/msys64/mingw64/include/pixman-1 -isystem C:/msys64/mingw64/include/gdk-pixbuf-2.0 -isystem C:/msys64/mingw64/include/webp -isystem C:/msys64/mingw64/include/atk-1.0 -isystem C:/msys64/mingw64/include/libxml2 -isystem C:/msys64/mingw64/include/lensfun -isystem C:/msys64/mingw64/include/librsvg-2.0 -isystem C:/msys64/mingw64/include/json-glib-1.0 -isystem C:/msys64/mingw64/include/openjpeg-2.5 -isystem C:/msys64/mingw64/include/libsecret-1 -isystem C:/msys64/mingw64/include/GraphicsMagick -isystem C:/msys64/mingw64/include/osmgpsmap-1.0 -isystem C:/msys64/mingw64/include/libsoup-2.4 -isystem C:/msys64/mingw64/include/Imath -isystem C:/msys64/mingw64/include/OpenEXR -Wall -Wno-format -Wshadow -Wtype-limits -Wvla -Wold-style-declaration -Wmaybe-uninitialized -Wno-unknown-pragmas -Wno-error=varargs -Wno-format-truncation -Wno-error=address-of-packed-member -fopenmp -march=native -msse2 -g -mfpmath=sse -O3 -DNDEBUG -O3 -ffast-math -fno-finite-math-only -fexpensive-optimizations -std=c99   -DUNICODE -D_UNICODE -Werror -Wfatal-errors -MD -MT bin/CMakeFiles/lib_darktable.dir/develop/lightroom.c.obj -MF bin\CMakeFiles\lib_darktable.dir\develop\lightroom.c.obj.d -o bin/CMakeFiles/lib_darktable.dir/develop/lightroom.c.obj -c C:/msys64/home/msika/darktable/src/develop/lightroom.c
C:/msys64/home/msika/darktable/src/develop/lightroom.c: In function 'dt_lightroom_import':
C:/msys64/home/msika/darktable/src/develop/lightroom.c:1094:3: error: 'xmlParseEntity' is deprecated [-Werror=deprecated-declarations]
 1094 |   doc = xmlParseEntity(pathname);
      |   ^~~
compilation terminated due to -Wfatal-errors.
cc1.exe: all warnings being treated as errors
[369/894] Building C object bin/CMakeFiles/lib_darktable.dir/develop/masks/group.c.obj

Either downgrade libxml2, or patch the dt source code like this: Fix to ensure build with libxml2 2.11 where xmlParseEntity is deprecated by victoryforce · Pull Request #14781 · darktable-org/darktable · GitHub

(…or temporarily do export CFLAGS+=" -Wno-error=deprecated-declarations" before running all the cmake commands; clean the build folder first of course)

1 Like

Also, you might want to switch away from MINGW64 to the recommended UCRT64 environment at this point.

1 Like

Thank you kmilos! I was able to build after patching the code as per victoryforce.

(I first tried to switch to ucrt64 but had many “'quick_exit has not been declared in ::” errors).

I’m getting this under UCRT64 (trying to build 4.2.1 and then integrate the G9 rawspeed mod).