'Multiple definition error of StringCchPrintfW when cross-compling with MinGW on Alpine linux

I'm cross-compiling opencascade on Alpine linux for windows with MinGW and run into a multiple definition linking error of StringCchPrintfW. I have managed to cross-compile and link this successfully without errors with Ubuntu linux, however I'm not sure how to debug this on Alpine, any ideas would be appreciated? The output is as follows:

Compiling test.exe

x86_64-w64-mingw32-g++ -O2 obj/geom_util.o-mingw obj/main.o-mingw
obj/util.o-mingw obj/error.o-mingw obj/geom.o-mingw obj/mesh.o-mingw
obj/shapemap.o-mingw obj/export.o-mingw obj/import.o-mingw
obj/gobj.o-mingw -L/usr/local/lib/opencascade-mingw -lTKSTEP
-lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKIGES -lTKSTL -lTKXSBase
-lTKMesh -lTKOffset -lTKFillet -lTKBool -lTKBO -lTKShHealing -lTKPrim
-lTKTopAlgo -lTKGeomAlgo -lTKBRep -lTKGeomBase -lTKG3d -lTKG2d
-lTKMath -lTKernel -o test.exe -s -lws2_32 -lpsapi -static -lpthread

/usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld:
/usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingwex.a(lib64_libmingwex_a-strsafe.o):strsafe.c:(.text+0xbe3):
multiple definition of `StringCchPrintfW';
/usr/local/lib/opencascade-mingw/libTKernel.a(OSD_FileNode.cxx.o):OSD_FileNode.c:(.text$StringCchPrintfW[StringCchPrintfW]+0x0):
first defined here

collect2: error: ld returned 1 exit status
make: *** [Makefile:146: test.exe] Error 1


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source