Can't compile C app with pthread.h

Can't compile app for device (compiles well for simulator and runs also). App is written on C and includes pthread.h and some file access functions (fread and etc).

Most of all I get such compilation errors:

undefined reference to `pthread_create'
undefined reference to `_read'

I tried to add -lpthread directly to arm-none-eabi-gcc but in the last linking step it gives an error:

arm-none-eabi/bin/ld: cannot find -lpthread

I would really appreciate your help! Ofc I could get rid of fread func, but I can't find suitable alternative for pthread so it's the main issue.

OS: macOS 12.5.1 AND 12.6
Host arch: both Intel and M1 Pro

Just a thought here, but could this be related to this post? I wasn't able to build with sprintf() unless I added --specs=nosys.specs in the recipe for /pdex.elf, line 145 of C_API/buildsupport/ It's conceivable that the same issue is happening here.

I don’t believe threads are supported.

Yup, threads are not supported.