Game controller subsystem failing for SDL2.0.9 mingw-w64 and msvc

I compile sdl2 as a static library like so:

cmake.exe -DCMAKE_BUILD_TYPE=Debug -G "MinGW Makefiles"^
 -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld.exe" -DCMAKE_C_FLAGS="-target x86_64-windows-gnu" -DCMAKE_C_COMPILER="clang.exe" -DCMAKE_C_COMPILER_ID="Clang"^
cmake.exe --build . -- -j %NUMBER_OF_PROCESSORS%

I link against this static library like so:

SET ll_common_flags=-DLL_SLOW -DLL_DEV -fno-omit-frame-pointer -fno-optimize-sibling-calls -g^
 -target x86_64-windows-gnu -fuse-ld=lld.exe -Wall -Wextra -Wpedantic -Wfloat-equal -Wunreachable-code -Wshadow^

clang.exe %ll_common_flags% ..\code\sdl-ll.c -o sdl-ll.exe^
 -Wl,-subsystem,windows -I ..\sdl2-2.0.9-minimal\include -L ..\sdl2-2.0.9-minimal\build^
  -lmingw32 -lwinmm -lole32 -limm32 -loleaut32 -lgdi32 -luuid -lversion -lopengl32^
    -lSDL2maind -lSDL2d 

This line fails:

    SDL_LogCritical("Unable to initialize SDL: %s", SDL_GetError());
    return EXIT_FAILURE;

When I run under a debugger ‘SDL_GetError()’ does not return anything meaningful (actually nothing at all). The video and audio subsystems work fine when initialized together. It is the gamecontroller and haptic that cause it to fail. Suggestions?

I have tried compiling with microsoft libraries, i.e. cl.exe and associated headers:

cmake.exe -DCMAKE_BUILD_TYPE=Debug^
cmake.exe --build . 

I get a syntax error in SDL_joystick.c:

Subsequently I cannot build sdl2, only sdl2-main.

It seems that cl.exe does not support the C99 initialization here. So if this is the case, how has anyone compiled sdl2.0.9 for windows with working controller support??