Due to some include files being rearranged in more recent versions of curl, the sys/time.h header was no longer being included for timeval.c, which was causing the error:
cargo:warning=curl/lib/timeval.c:106:11: error: call to undeclared function 'gettimeofday'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
cargo:warning= (void)gettimeofday(&now, NULL);
cargo:warning= ^
cargo:warning=1 error generated.
This fixes it by setting HAVE_SYS_TIME_H which would normally be set by the configure script.
I don't actually know why gcc treats this as a warning, and clang treats it as an error.
Due to some include files being rearranged in more recent versions of curl, the
sys/time.h
header was no longer being included fortimeval.c
, which was causing the error:This fixes it by setting HAVE_SYS_TIME_H which would normally be set by the configure script.
I don't actually know why gcc treats this as a warning, and clang treats it as an error.
Details:
curl_setup.h
used to includecurl.h
which always importssys/time.h
. However, https://github.com/curl/curl/commit/e5839f4ee706054d3a9bb7430e0eac061d78e35a removed thecurl.h
import. The only waysys/time.h
gets imported otherwise is incurl_setup_once.h
, but that is conditional on HAVE_SYS_TIME_H.