Closed kalibera closed 1 year ago
Did this surface because R changed from C-99 to C-11, or due to a change in the compiler? Can we specify a C standard in the package Makevars, like we do for CXXSTD
?
cc @kevinAlbs
I think it is the C standard, because that is what the code in bson-memory.c is checking. It uses aligned_alloc when it is being compiled in C11. I think the code needs to be patched to make an exception for Windows and use other allocation functions. One probably shouldn't be permanently be choosing pre-C11 standards for that code just becuase of aligned_alloc. But, yes, with gnu99 it would most likely work.
It cannot be directly the effect of the compiler, this is about the headers (MinGW-W64) and that is in turn about what the C runtime on Windows supports. Only indirectly re what is the (default) standard.
There is work in progress on selecting also C standards, see the NEWS file.
workaround submitted to CRAN for now. Hopefully we can come up with a fix in upstream libmongoc.
Thanks!
Please note
in the CRAN check results. Sadly the suggestion is not helpful,
aligned_alloc
is not instdlib.h
and it is not supported in Windows, despite that it is in C11. See https://learn.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance:Probably this has to be treated as an exception from C11 upstream when compiling on Windows: https://github.com/mongodb/mongo-c-driver/blob/fa7d499b8ca53269b008cf7c19747164f98bede2/src/libbson/src/bson/bson-memory.c#L33