-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Error while compiling with Android NDK r15b #1738
Comments
Can you elaborate exactly how that "invalid code" is generated and why? We can run that configure check perfectly fine with clang on other platforms... And yes, |
Here is part of config.log
|
As i mentions in first post problem comes from new headers that NDK ships.
|
Ah, thanks, now I get it. That's makes it a little tricky to make the detection work. So does the check work if the prototype in the check is removed completely? (If so, we could remove it with preprocessor magic) |
Removing prototype also helps :)
Here is part of config.log:
|
Hm, removing the prototype completely turns out to be a bad idea. Removing the proto actually makes the test succeed on the first attempt for my test on Linux, as it is the proto is what causes the typical errors. It renders the test rather useless. But also, if we provide the --- a/acinclude.m4
+++ b/acinclude.m4
@@ -1381,12 +1381,16 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
+#ifdef __ANDROID__
+#define __attribute__((overloadable))
+#else
#define RECVCALLCONV
#endif
+#endif
extern $recv_retv RECVCALLCONV
recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
]],[[
$recv_arg1 s=0;
$recv_arg2 buf=0;
Not exactly sure what the best way to proceed from this is. |
Inserting @@ -1083,9 +1083,13 @@
#include <netdb.h>
#endif
#define GNICALLCONV
#endif
- extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2,
+ extern int GNICALLCONV
+#ifdef __ANDROID__
+__attribute__((overloadable))
+#endif
+ getnameinfo($gni_arg1, $gni_arg2,
char *, $gni_arg46,
char *, $gni_arg46,
$gni_arg7);
]],[[
@@ -1387,8 +1391,11 @@
#endif
#define RECVCALLCONV
#endif
extern $recv_retv RECVCALLCONV
+#ifdef __ANDROID__
+__attribute__((overloadable))
+#endif
recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
]],[[
$recv_arg1 s=0;
$recv_arg2 buf=0;
@@ -1521,8 +1528,11 @@
#endif
#define SENDCALLCONV
#endif
extern $send_retv SENDCALLCONV
+#ifdef __ANDROID__
+__attribute__((overloadable))
+#endif
send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
]],[[
$send_arg1 s=0;
$send_arg3 len=0;
@@ -2377,13 +2387,17 @@
long tv_sec;
long tv_usec;
};
#endif
- extern $sel_retv SELECTCALLCONV select($sel_arg1,
- $sel_arg234,
- $sel_arg234,
- $sel_arg234,
- $sel_arg5);
+ extern $sel_retv SELECTCALLCONV
+#ifdef __ANDROID__
+__attribute__((overloadable))
+#endif
+ select($sel_arg1,
+ $sel_arg234,
+ $sel_arg234,
+ $sel_arg234,
+ $sel_arg5);
]],[[
$sel_arg1 nfds=0;
$sel_arg234 rfds=0;
$sel_arg234 wfds=0; |
Okay, cool! But you mentioned this is news in some Android NDK version and exists in r15b, right? So won't this risk breaking the build for older Android builds? Should the #ifdef in there be more complicated? |
Maybe it is better to add new one. I did not see any define that is passed to compiler if unified headers are used.
|
And there was no header earlier that we could use to detect a pre-r15 version? |
Hm, I suppose an unknown |
... since they now provide several functions as __attribute__((overloadable)), the argument detection logic need updates. Patched-by: destman at github Fixes #1738
Thanks! |
When compiling with Android NDK r15b i got errors like this:
Cannot find proper types to use for recv args
Version of curl is 7.54.1
The problem is that NDK r15b switch to clang and use new headers now. So when configure checks if some functions have valid arguments invalid code is generated.
I fix this problem by adding
__attribute__((overloadable))
before some functions (recv, send, select, getnameinfo) in acinclude.m4But not sure how it influence other platforms...
The text was updated successfully, but these errors were encountered: