Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined reference to _gettimeofday #9413

Closed
gdsports opened this issue Nov 8, 2019 · 1 comment
Closed

undefined reference to _gettimeofday #9413

gdsports opened this issue Nov 8, 2019 · 1 comment
Labels
Component: Compilation Related to compilation of Arduino sketches Type: Bug Type: Invalid Off topic for this repository, or a bug report determined to not actually represent a bug

Comments

@gdsports
Copy link

gdsports commented Nov 8, 2019

OS: Ubuntu 18.04 64-bit

When building the same source code, 1.8.9 works fine. But 1.8.10 and hourly both fail at the link step with gettimeofdayr.c:(.text._gettimeofday_r+0xe): undefined reference to '_gettimeofday'.

Defining the function in the sketch keeps the linker happy.

extern "C" {
  // This must exist to keep the linker happy but is never called.
  int _gettimeofday( struct timeval *tv, void *tzvp )
  {
    Serial.println("_gettimeofday dummy");
    uint64_t t = 0;  // get uptime in nanoseconds
    tv->tv_sec = t / 1000000000;  // convert to seconds
    tv->tv_usec = ( t % 1000000000 ) / 1000;  // get remaining microseconds
    return 0;  // return non-zero for error
  } // end _gettimeofday()
}

Build log: https://gist.github.com/gdsports/d0046f9f91b2bed66f0a0a2608064485

@per1234 per1234 added Component: Compilation Related to compilation of Arduino sketches Type: Bug labels Nov 9, 2019
@gdsports
Copy link
Author

gdsports commented Nov 9, 2019

Sorry, the description is wrong. The code does NOT compile correctly with 1.8.9 so this appears to the an STM32duino problem.

@gdsports gdsports closed this as completed Nov 9, 2019
@per1234 per1234 added the Type: Invalid Off topic for this repository, or a bug report determined to not actually represent a bug label Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Compilation Related to compilation of Arduino sketches Type: Bug Type: Invalid Off topic for this repository, or a bug report determined to not actually represent a bug
Projects
None yet
Development

No branches or pull requests

2 participants