Can't cross-compile dynamic library of sdl2-ttf for Windows with mingw

I’m trying to cross-compile sdl2 and sdl2-ttf for Windows using mingw to get the shared libraries. Build of sdl2 is successful in the sense that I get the SDL2.dll library, however building of sdl2-ttf fails, and I get these warnings:

/bin/sh ./libtool  --tag=CC   --mode=link cc  -g -O2 -I/workspace/destdir/include/freetype2 -I/workspace/destdir/include   -DHAVE_OPENGL -no-undefined -release 2.0 -version-info 14:1:14 -Wl,version.o  -o libSDL2_ttf.la -rpath /workspace/destdir/lib SDL_ttf.lo  -L/workspace/destdir/lib -lfreetype  -L/workspace/destdir/lib -lmingw32 -lSDL2main -lSDL2 -mwindows 

*** Warning: This system cannot link to static lib archive /workspace/destdir/lib/libSDL2main.la.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have.

*** Warning: linker path does not have real file for library -lmingw32.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libmingw32 and none of the candidates passed a file format test
*** using a file magic. Last file checked: /opt/x86_64-w64-mingw32/x86_64-w64-mingw32/sys-root/lib/libmingw32.a

*** Warning: linker path does not have real file for library -ldxguid.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libdxguid and none of the candidates passed a file format test
*** using a file magic. Last file checked: /opt/x86_64-w64-mingw32/x86_64-w64-mingw32/sys-root/lib/libdxguid.a

*** Warning: linker path does not have real file for library -ldxerr8.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libdxerr8 and none of the candidates passed a file format test
*** using a file magic. Last file checked: /opt/x86_64-w64-mingw32/x86_64-w64-mingw32/sys-root/lib/libdxerr8.a

*** Warning: linker path does not have real file for library -luuid.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libuuid and none of the candidates passed a file format test
*** using a file magic. Last file checked: /opt/x86_64-w64-mingw32/x86_64-w64-mingw32/sys-root/lib/libuuid.a
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.

*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.

In the building log file of SDL2 I found:

  LTLINK build/libSDL2main.la
libtool: link: warning: undefined symbols not allowed in x86_64-w64-mingw32 shared libraries
  LTLINK build/libSDL2_test.la
libtool: link: warning: undefined symbols not allowed in x86_64-w64-mingw32 shared libraries
  LTLINK build/libSDL2.la

*** Warning: Linking the shared library build/libSDL2.la against the non-libtool
*** objects  build/version.o is not portable!

My understanding is that part of the problem is that building sdl2 didn’t generate a libSDL2main.dll dynamic library. I have the shared library libSDL2main.a, which has a few undefined symbols:

# nm libSDL2main.a 

SDL_windows_main.o:
0000000000000000 b .bss
0000000000000000 d .data
0000000000000000 N .debug_abbrev
0000000000000000 N .debug_aranges
0000000000000000 N .debug_frame
0000000000000000 N .debug_info
0000000000000000 N .debug_line
0000000000000000 N .debug_loc
0000000000000000 N .debug_ranges
0000000000000000 N .debug_str
0000000000000000 p .pdata
0000000000000000 r .rdata
0000000000000000 r .rdata$zzz
0000000000000000 t .text
0000000000000000 r .xdata
                 U SDL_SetMainReady
                 U SDL_ShowSimpleMessageBox
                 U SDL_main
0000000000000380 T WinMain
                 U __imp_GetCommandLineW
                 U __imp_VirtualAlloc
                 U __imp_VirtualFree
                 U __imp_WideCharToMultiByte
0000000000000360 T console_ansi_main
0000000000000370 T console_wmain
0000000000000000 t main_getcmdline

Most of them are in SDL2.dll, but I have no clue where SDL_main should be defined.

Can someone please help me with this?