How to compile libbson for STM32

Hello I’m trying to cross-compile libbson to include it as lib to STM32CubeIDE to use it on STM32 ARM-core processor. I spceified my toolchain according to: this. Im trying to build with toolchain from ARM (I tried on ubuntu and windows).

After generating Makefile with MinGW Makefiles the build fails(again on both platforms Ubuntu and Windows) with the same error:

    [  1%] Building C object src/libbson/CMakeFiles/bson_shared.dir/src/bson/bcon.c.obj
In file included from C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-compat.h:75,
                 from C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson.h:23,
                 from C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bcon.h:26,
                 from C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bcon.c:24:
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bcon.c: In function '_bcon_append_tokenize':
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bcon.c:470:27: warning: 'bcon_type_t' is promoted to 'int' when passed through '...'
  470 |       type = va_arg (*ap, bcon_type_t);
      |                           ^
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bcon.c:470:27: note: (so you should pass 'int' not 'bcon_type_t' to 'va_arg')
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bcon.c:470:27: note: if this code is reached, the program will abort
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bcon.c:486:40: warning: 'bson_subtype_t' is promoted to 'int' when passed through '...'
  486 |          u->BIN.subtype = va_arg (*ap, bson_subtype_t);
      |                                        ^
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bcon.c:486:40: note: if this code is reached, the program will abort
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bcon.c: In function '_bcon_extract_tokenize':
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bcon.c:602:27: warning: 'bcon_type_t' is promoted to 'int' when passed through '...'
  602 |       type = va_arg (*ap, bcon_type_t);
      |                           ^
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bcon.c:602:27: note: if this code is reached, the program will abort
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bcon.c:671:33: warning: 'bson_type_t' is promoted to 'int' when passed through '...'
  671 |          u->TYPE = va_arg (*ap, bson_type_t);
      |                                 ^
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bcon.c:671:33: note: if this code is reached, the program will abort
[  2%] Building C object src/libbson/CMakeFiles/bson_shared.dir/src/bson/bson.c.obj
[  4%] Building C object src/libbson/CMakeFiles/bson_shared.dir/src/bson/bson-atomic.c.obj
In file included from C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-atomic.h:25,
                 from C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-atomic.c:18:
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-atomic.c: In function 'bson_thrd_yield':
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-atomic.c:41:19: warning: implicit declaration of function 'sched_yield' [-Wimplicit-function-declaration]
   41 |    BSON_IF_POSIX (sched_yield ();)
      |                   ^~~~~~~~~~~
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-compat.h:195:28: note: in definition of macro 'BSON_IF_POSIX'
  195 | #define BSON_IF_POSIX(...) __VA_ARGS__
      |                            ^~~~~~~~~~~
[  5%] Building C object src/libbson/CMakeFiles/bson_shared.dir/src/bson/bson-clock.c.obj
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-clock.c: In function 'bson_get_monotonic_time':
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-clock.c:149:9: note: '#pragma message: Monotonic clock is not yet supported on your platform.'
  149 | #pragma message "Monotonic clock is not yet supported on your platform."
      |         ^~~~~~~
[  7%] Building C object src/libbson/CMakeFiles/bson_shared.dir/src/bson/bson-context.c.obj
In file included from C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-context-private.h:25,
                 from C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-context.c:28:
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-context.c: In function 'bson_context_get_default':
c:\users\blast\codesandbox\bson2\mongo-c-driver\src\common\common-thread-private.h:37:24: error: 'PTHREAD_ONCE_INIT' undeclared (first use in this function)
   37 | #define BSON_ONCE_INIT PTHREAD_ONCE_INIT
      |                        ^~~~~~~~~~~~~~~~~
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-context.c:440:30: note: in expansion of macro 'BSON_ONCE_INIT'
  440 |    static bson_once_t once = BSON_ONCE_INIT;
      |                              ^~~~~~~~~~~~~~
c:\users\blast\codesandbox\bson2\mongo-c-driver\src\common\common-thread-private.h:37:24: note: each undeclared identifier is reported only once for each function it appears in
   37 | #define BSON_ONCE_INIT PTHREAD_ONCE_INIT
      |                        ^~~~~~~~~~~~~~~~~
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-context.c:440:30: note: in expansion of macro 'BSON_ONCE_INIT'
  440 |    static bson_once_t once = BSON_ONCE_INIT;
      |                              ^~~~~~~~~~~~~~
c:\users\blast\codesandbox\bson2\mongo-c-driver\src\common\common-thread-private.h:38:19: warning: implicit declaration of function 'pthread_once' [-Wimplicit-function-declaration]
   38 | #define bson_once pthread_once
      |                   ^~~~~~~~~~~~
C:\Users\blast\CodeSandbox\bson2\mongo-c-driver\src\libbson\src\bson\bson-context.c:442:4: note: in expansion of macro 'bson_once'
  442 |    bson_once (&once, _bson_context_init_default);
      |    ^~~~~~~~~
mingw32-make.exe[2]: *** [src\libbson\CMakeFiles\bson_shared.dir\build.make:131: src/libbson/CMakeFiles/bson_shared.dir/src/bson/bson-context.c.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:1044: src/libbson/CMakeFiles/bson_shared.dir/all] Error 2
mingw32-make.exe: *** [Makefile:165: all] Error 2

I will appreceate any help.