Building newlib with clock_gettime()
Jeff Johnston
jjohnstn@redhat.com
Wed Jan 8 21:37:16 GMT 2025
Hello,
Newlib does not provide an implementation for clock_gettime(). In glibc,
for example, the source code uses syscalls to implement this which are not
part of the standard newlib syscall set. Some platforms may define
clock_gettime() stubs that simply fail (RTEMS for example). If you just
need to satisfy a link requirement, you can easily create such a stub that
fails, otherwise, you will have to implement the function yourself or try
to port an implementation from another library (e.g. FreeBSD).
-- Jeff J.
On Mon, Jan 6, 2025 at 5:32 PM Caden <przcaden@gmail.com> wrote:
> Hi!
>
> I'm trying to build a RISC-V GNU compiler with *clock_gettime()* provided
> by newlib. It seems that building the toolchain by default does *not* enable
> this function -- looking at the libstdc++ library config settings shows
> that any symbols regarding *clock_gettime()* are disabled*.*
>
> I'm wondering if there's anything specific that can be done to have this
> function provided by newlib.
> Here's the command that newlib was built with:
>
> $ /nobackup/build/riscv-gnu-toolchain/newlib/configure
> --target=riscv64-unknown-elf --prefix=/nobackup/build/riscv64-unknown-elf
> --enable-newlib-io-long-double --enable-newlib-io-long-long
> --enable-newlib-io-c99-formats
> --enable-newlib-reigster-fini CFLAGS_FOR_TARGET=-O2 -D_POSIX_MODE
> -ffunction-sections -fdata-sections -mcmodel=medlow
> CXXFLAGS_FOR_TARGET=-O2 -D_POSIX_MODE -ffunction-sections -fdata-sections
> -mcmodel=medlow
>
> Thanks!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/newlib/attachments/20250108/0f689ded/attachment.htm>
More information about the Newlib
mailing list