I need to use the C standard to compile with my POSIX implementation. I downloaded the precompiled lib of gcc-11.2, but after unzipping, I am facing libgcc.a and libc.a libraries.
I tried to compile with libc.a, but <stddef.h> is missing. I compiled with both libraries, and it solved the inclusion issue. But a new issue has arisen: the function clock_gettime() isn’t being referenced. This function is defined by POSIX (Real Time) as an extension of time.h. I need this file and function for my implementation. I checked with dumpobj on libc.a and libgcc.a, but the function is not present. So, it seems that libc.a has been compiled without the function. A solution can be to compile the GCC sources with the -D_POSIX_TIMERS flag (clock_gettime is defined if _POSIX_TIMERS exists) ?
I don’t understand why there are libgcc.a and libc.a instead of one library, what is the difference between these libraries ? And is it possible to use a POSIX function defined in the GCC library without including all the other POSIX features to prevent conflicts with my POSIX implementation ?
Eoa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.