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

Fix build error with clang #472

Merged
merged 1 commit into from
Nov 2, 2022
Merged

Conversation

ehuss
Copy link
Collaborator

@ehuss ehuss commented Nov 2, 2022

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.

Details:
curl_setup.h used to include curl.h which always imports sys/time.h. However, curl/curl@e5839f4 removed the curl.h import. The only way sys/time.h gets imported otherwise is in curl_setup_once.h, but that is conditional on HAVE_SYS_TIME_H.

@alexcrichton alexcrichton merged commit 0162fe1 into alexcrichton:main Nov 2, 2022
bors added a commit to rust-lang/cargo that referenced this pull request Nov 2, 2022
Update curl-sys

This updates curl-sys which pulls in alexcrichton/curl-rust#472 which should fix the build errors with clang.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants