-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
HAVE_POLL_FINE is always false when cross-compiling with CMake #14714
Comments
The check for this actually builds and runs code to verify poll() and that cannot be done for cross-compiles. Thus, it guesses. Maybe this should rather guess on it working, if not using Apple OS. |
One option is to hard-wire known results for (cross-)compilation targets (like done for Apple). |
In ./configure this detection is reserved for cross-builds as well. |
Classically, you'd double-check the config.h file after configure has run so that it figured out things correctly. For cross-compiles especially, as it has more limited checks due to not being able to run code for checks. So cmake/configure needs to use a use a default for such checks. Probably going with the safe one. |
That seem a reasonable solution to me. I would say that there are more platforms with a working Either way, I think it would be cool to have an entry about this behavior in the Known Bugs section; something like " |
It's not really a bug, it's a known limitation. And this is not unique for curl, this is how cross-compiling works for just about everyone. There several more checks that cannot be done for cross-builds. Ideally we should have these documented, but it might be tricky. |
Would it help to fall back to a non-runtime detection for cross-builds, like?: #if <UNIX> && defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L
/* has native poll() */
#endif |
Yeah, that's probably a decent guess. |
Also: - cmake: delete unnecessary `#include <sys/time.h>` from non-cross-build `poll()` detection snippet. Follow-up tp cc8b813 curl#14718 Fixes curl#14714
Yes, it's correctly detected. Thanks! |
I did this
I was having a weird issue when using the multi interface where the
curl_multi_poll()
call occasionally returnsCURLM_UNRECOVERABLE_POLL
.The thing is, this issue was only reproducible in cross-compiled binaries. After a bit of investigation around
Curl_poll()
, I found that this is caused by the lack of theHAVE_POLL_FINE
define in these builds.Looking at CMake/OtherTests.cmake I see that there is indeed a check for
HAVE_POLL_FINE
inside aif (NOT CMAKE_CROSSCOMPILING)
condition.Removing the
NOT CMAKE_CROSSCOMPILING
check and replacingcheck_c_source_runs()
withcheck_c_source_compiles()
fixes this.I expected the following
Properly detection of
HAVE_POLL_FINE
.curl/libcurl version
libcurl/8.10.0-DEV BearSSL nghttp2/1.61.0
operating system
Linux rhel 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: