Skip to main content
kchin.2
Associate II
August 4, 2023
Solved

_gettimeofday_r error come while i am building with latest stm cube ide

stmcube ide 1.13.1

.win32_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/ST/STM32CubeIDE_1.13.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v8-m.main+fp/hard\libc_nano.a(libc_a-gettimeofdayr.o): in function `_gettimeofday_r':

    This topic has been closed for replies.
    kchin.2
    kchin.2Best answer
    Associate II
    August 4, 2023

    @KnarfB wrote:

    This is a warning, not an error. You can ignore it unless you want to use gettimeofday, in which case you have to implement it yourself for an embedded system :).

    hth

    KnarfB


    I am trying to change the ld file I thought may be because of this my ld file is not refecting

    17 replies

    KnarfB
    Super User
    August 4, 2023

    error message not included?!

    kchin.2
    kchin.2Author
    Associate II
    August 4, 2023

    C:/ST/STM32CubeIDE_1.13.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/ST/STM32CubeIDE_1.13.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v8-m.main+fp/hard\libc_nano.a(libc_a-gettimeofdayr.o): in function `_gettimeofday_r':

    (.text._gettimeofday_r+0xe): warning: _gettimeofday is not implemented and will always fail

    KnarfB
    Super User
    August 4, 2023

    This is a warning, not an error. You can ignore it unless you want to use gettimeofday, in which case you have to implement it yourself for an embedded system :).

    hth

    KnarfB

    kchin.2
    kchin.2AuthorBest answer
    Associate II
    August 4, 2023

    @KnarfB wrote:

    This is a warning, not an error. You can ignore it unless you want to use gettimeofday, in which case you have to implement it yourself for an embedded system :).

    hth

    KnarfB


    I am trying to change the ld file I thought may be because of this my ld file is not refecting

    Riscy00_UPP
    Associate II
    August 10, 2023

     I checked the ID file and found no gettimeofday so I don't know where this coming from and how to make it go away or I have to wait for next revision release by ST?

    is there code snips to add in gettimeofday

    ETan.3
    Associate
    August 9, 2023

    I got the same error after performing "Check for Update" and patching CubeMX to 6.19.1 and CubeIDE to 1.13.1.

    This compiling error should be fixed, but no just be ignored.

    Visitor II
    August 9, 2023

    Same here. Tried rebuilding a code from prior CubeMX / CubeIDE version. Prior to the 2 of August 2023.
    plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.linux64_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld:
    /home/lawrence/st/stm32cubeide_1.12.1/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.linux64_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc_nano.a(libc_a-gettimeofdayr.o):
    in function `_gettimeofday_r': (.text._gettimeofday_r+0xe):
    warning: _gettimeofday is not implemented and will always fail

    Visitor II
    August 11, 2023

     

    Guys, I have this problem after IDE upgrade to 1.13.1.

    This topic is marked as "solved", but nobody specified how it was solved. Could somebody write the solution, please?


    C:/ST/STM32CubeIDE_1.11.2/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/ST/STM32CubeIDE_1.11.2/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc_nano.a(libc_a-gettimeofdayr.o): in function `_gettimeofday_r':
    (.text._gettimeofday_r+0xe): warning: _gettimeofday is not implemented and will always fail

    AScha.3
    Super User
    August 11, 2023

    as KnarfB wrote:

     You can ignore it unless you want to use gettimeofday, in which case you have to implement it yourself for an embedded system :).

    or if you trust more in compiler :

    warning: _gettimeofday is not implemented and will always fail.

    solution is : write it yourself.

    If you feel a post has answered your question, please click on " Best Answer ".
    Riscy00_UPP
    Associate II
    August 13, 2023

    I would like to help other so I created the gettimeofday.c and then added a function that return just 0 since I'm not using it but it resolve compiler error with some peace of mind. 

    #include <sys/time.h>
    
    int _gettimeofday( struct timeval *tv, void *tzvp )
    {
     // you can add code here there many example in google search. 
     return 0; // return non-zero for error
    } // end _gettimeofday()

     

    Associate
    October 21, 2023

    Made a new gettimeofday.c source file in src folder and this worked, thanks!

    Senior
    September 5, 2023

    Same issue for me

    Associate
    September 26, 2023

    Same issue here after IDE upgrade to 1.13.2.

     

    C:/ST/STM32CubeIDE_1.13.2/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.1.202309131626/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/ST/STM32CubeIDE_1.13.2/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.1.202309131626/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard\libc_nano.a(libc_a-gettimeofdayr.o): in function `_gettimeofday_r':
    (.text._gettimeofday_r+0xe): warning: _gettimeofday is not implemented and will always fail

     

    Please help to solve. Thanks.

    AScha.3
    Super User
    September 26, 2023

    you can read...?  >>

    You can ignore it unless you want to use gettimeofday, in which case you have to implement it yourself for an embedded system :).

    or if you trust more in compiler :

    warning: _gettimeofday is not implemented and will always fail.

    solution is : write it yourself.

    If you feel a post has answered your question, please click on " Best Answer ".
    Associate
    September 28, 2023

    Our application doesn't use gettimeofday. It's not clear to us why we need to implement it.

    Thanks.

    Patrice LF
    ST Employee
    October 25, 2023

     

    Hi,

    If you are using mbedTLS a solution to get rid of this warning is to not activate MBEDTLS_HAVE_TIME and MBEDTLS_HAVE_TIME_DATE in mbedtls_config.h

    regards

    Patrice