Closed barracuda156 closed 1 month ago
@paleolimbot Could you please help with this?
Usual fallbacks for this are malloc
and posix_memalign
.
Wait, looks like flatcc_alloc.h
already has everything needed, but nanoarrow
does not use needed macros to pick the right implementation.
So, passing -DFLATCC_USE_GENERIC_ALIGNED_ALLOC
via Makevars fixes the bug.
I.e., what is needed is a configure script with a check for aligned_alloc
support; if it is not present, then add the flag to Makevars. Problem solved.
I think aligned_alloc()
is C11 also, so perhaps compiling with explicit C99 will work?
I think
aligned_alloc()
is C11 also, so perhaps compiling with explicit C99 will work?
@paleolimbot Assuming nanoarrow
does not need C11, that might work, but AFAIK R
bakes in flags used to build R
itself, I have no idea if we could manually cancel them out for a single package and whether this is desirable at all.
Assuming nanoarrow does not need C11
We do test with explicit c99; however, that's just a compiler flag and I can't see where it would disable this based on the C11 or C99-ness.
So, passing
-DFLATCC_USE_GENERIC_ALIGNED_ALLOC
via Makevars fixes the bug.
Great! I may actually just add this to Makevars
because generating protobuf is not a bottleneck for the types of things that we are doing with it 🙂 and because I don't think R even has the ability to force a C standard (in the same way that it cares about the C++ standard).
What gcc suggests won't work here, though a missing header is still wrong, of course, since
aligned_alloc
is not provided by the compiler but relies on the OS, and it is not supported in many macOS versions (and likely other systems).We need a fallback implementation with a better cross-platform support here.