shm_open shm_unlink not found

I am new to CMake and trying to build a project for aarch64 armv8 from Termux on my android phone. I am running into this error:
gcc -o ex main.c -lc
main.c:19:10: warning: call to undeclared function ‘shm_open’; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
fd = shm_open(“/my_shm”, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
^
1 warning generated.
ld.lld: error: undefined symbol: shm_open

referenced by main.c
/data/data/com.termux/files/usr/tmp/main-8f7dab.o:(main)
did you mean: sem_open
defined in: /system/lib64/libc.so
clang-15: error: linker command failed with exit code 1 (use -v to see invocation

I found from googling that libc includes these functions and according to the fact that the error messaage suggests me to use >>> did you mean: sem_open I assume that the libc was found in my termux environment, or not? Any help or hints are very appreciated as I wasted a couple of hours already to try to fix that.

I uploaded a small project that reproduces my problem on termux from an android phone: GitHub - alexg93333/cmaketest

shm_open comes from librt and must be linked separately with -lrt.

I get the exact same error with -lrt. I checked my /system/lib64/ path and libc.so is there. librt.so is missing. What does that mean?

This sounds like a different kind of system/platform. But I’d expect an error about librt.so to be missing, not a missing symbol in this case anyways.

In my CMakeLists.txt I executed:
FIND_LIBRARY(RT_LIBRARY rt)
message(${RT_LIBRARY})

it returns this path:
/data/data/com.termux/files/usr/lib/librt.so

the content of this file is just:
INPUT -lc

No idea. Might be a question for Termux folks. Maybe shm_open isn’t implemented in Bionic?

I found a librt.so in my linux VM on my PC. Can I just copy it to my phone and use it?

No. I suspect that the Android way is something like Binder or the like, but it’s really a question more for an Android development forum than CMake (as CMake cannot make function appear from nowhere if they’re not implemented on the target).