From b96287a13f0f54048e582feec707a10ad7635881 Mon Sep 17 00:00:00 2001 From: Param Reddy Date: Sat, 14 Oct 2017 12:43:31 -0700 Subject: Fix build for ios app using grpc as cc_library For ios build, bazel build needs to be invoked with: --ios_multi_cpu=armv7,arm64 build. This in turn gets picked as cpu based on the docs: --[no]experimental_enable_objc_cc_deps default: "true" Allows objc_* rules to depend on cc_library and causes any objc dependencies to be built with --cpu set to "ios_<--ios_cpu>" for any values in --ios_multi_cpu. This diff explicitly adds darwin config for cpu being ios_x86_64, ios_armv7, ios_armv7s and ios_arm64. We cant use ios_cpu as condition because its set to x86_64 by default and causes linux build break. --- third_party/cares/cares.BUILD | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'third_party') diff --git a/third_party/cares/cares.BUILD b/third_party/cares/cares.BUILD index 978e9b1ed9..bca1bd0d07 100644 --- a/third_party/cares/cares.BUILD +++ b/third_party/cares/cares.BUILD @@ -3,6 +3,23 @@ config_setting( values = {"cpu": "darwin"}, ) +config_setting( + name = "ios_x86_64", + values = {"cpu": "ios_x86_64"}, +) +config_setting( + name = "ios_armv7", + values = {"cpu": "ios_armv7"}, +) +config_setting( + name = "ios_armv7s", + values = {"cpu": "ios_armv7s"}, +) +config_setting( + name = "ios_arm64", + values = {"cpu": "ios_arm64"}, +) + cc_library( name = "ares", srcs = [ @@ -81,6 +98,10 @@ cc_library( "cares/nameser.h", "cares/setup_once.h", ] + select({ + ":ios_x86_64": ["config_darwin/ares_config.h"], + ":ios_armv7": ["config_darwin/ares_config.h"], + ":ios_armv7s": ["config_darwin/ares_config.h"], + ":ios_arm64": ["config_darwin/ares_config.h"], ":darwin": ["config_darwin/ares_config.h"], "//conditions:default": ["config_linux/ares_config.h"], }), @@ -88,6 +109,10 @@ cc_library( ".", "cares" ] + select({ + ":ios_x86_64": ["config_darwin"], + ":ios_armv7": ["config_darwin"], + ":ios_armv7s": ["config_darwin"], + ":ios_arm64": ["config_darwin"], ":darwin": ["config_darwin"], "//conditions:default": ["config_linux"], }), -- cgit v1.2.3 From 819ec5069b050c21d3cbaa69289b89dfc7080979 Mon Sep 17 00:00:00 2001 From: Param Reddy Date: Fri, 20 Oct 2017 23:40:14 -0700 Subject: Android does not have getservbyport_r so use getservbyport --- third_party/cares/cares.BUILD | 11 + third_party/cares/config_android/ares_config.h | 458 +++++++++++++++++++++++++ 2 files changed, 469 insertions(+) create mode 100644 third_party/cares/config_android/ares_config.h (limited to 'third_party') diff --git a/third_party/cares/cares.BUILD b/third_party/cares/cares.BUILD index bca1bd0d07..058a992ea9 100644 --- a/third_party/cares/cares.BUILD +++ b/third_party/cares/cares.BUILD @@ -3,6 +3,15 @@ config_setting( values = {"cpu": "darwin"}, ) +# Android is not officially supported. +# This just helps with the build for now. +config_setting( + name = "android", + values = { + "crosstool_top": "//external:android/crosstool", + }, +) + config_setting( name = "ios_x86_64", values = {"cpu": "ios_x86_64"}, @@ -103,6 +112,7 @@ cc_library( ":ios_armv7s": ["config_darwin/ares_config.h"], ":ios_arm64": ["config_darwin/ares_config.h"], ":darwin": ["config_darwin/ares_config.h"], + ":android": ["config_android/ares_config.h"], "//conditions:default": ["config_linux/ares_config.h"], }), includes = [ @@ -114,6 +124,7 @@ cc_library( ":ios_armv7s": ["config_darwin"], ":ios_arm64": ["config_darwin"], ":darwin": ["config_darwin"], + ":android": ["config_android"], "//conditions:default": ["config_linux"], }), linkstatic = 1, diff --git a/third_party/cares/config_android/ares_config.h b/third_party/cares/config_android/ares_config.h new file mode 100644 index 0000000000..2caf1b396e --- /dev/null +++ b/third_party/cares/config_android/ares_config.h @@ -0,0 +1,458 @@ +/* Generated from ares_config.h.cmake*/ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* define this if ares is built for a big endian system */ +#undef ARES_BIG_ENDIAN + +/* when building as static part of libcurl */ +#undef BUILDING_LIBCURL + +/* Defined for build that exposes internal static functions for testing. */ +#undef CARES_EXPOSE_STATICS + +/* Defined for build with symbol hiding. */ +#undef CARES_SYMBOL_HIDING + +/* Definition to make a library symbol externally visible. */ +#undef CARES_SYMBOL_SCOPE_EXTERN + +/* Use resolver library to configure cares */ +/* #undef CARES_USE_LIBRESOLV */ + +/* if a /etc/inet dir is being used */ +#undef ETC_INET + +/* Define to the type of arg 2 for gethostname. */ +#define GETHOSTNAME_TYPE_ARG2 size_t + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 socklen_t + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Specifies the number of arguments to getservbyport_r */ +#define GETSERVBYPORT_R_ARGS + +/* Define to 1 if you have AF_INET6. */ +#define HAVE_AF_INET6 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_NAMESER_COMPAT_H + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_NAMESER_H + +/* Define to 1 if you have the header file. */ +#define HAVE_ASSERT_H + +/* Define to 1 if you have the `bitncmp' function. */ +/* #undef HAVE_BITNCMP */ + +/* Define to 1 if bool is an available type. */ +#define HAVE_BOOL_T + +/* Define HAVE_CLOCK_GETTIME_MONOTONIC if you have the clock_gettime + * function and monotonic timer. + * + * IMPORTANT: gRPC MANUAL EDIT HERE! + * Note: setting HAVE_CLOCK_GETTIME_MONOTONIC causes use of the clock_gettime + * function from glibc, don't set it to support glibc < 2.17 */ +#ifndef GPR_BACKWARDS_COMPATIBILITY_MODE + #define HAVE_CLOCK_GETTIME_MONOTONIC +#endif + +/* Define to 1 if you have the closesocket function. */ +/* #undef HAVE_CLOSESOCKET */ + +/* Define to 1 if you have the CloseSocket camel case function. */ +/* #undef HAVE_CLOSESOCKET_CAMEL */ + +/* Define to 1 if you have the connect function. */ +#define HAVE_CONNECT + +/* define if the compiler supports basic C++11 syntax */ +/* #undef HAVE_CXX11 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H + +/* Define to 1 if you have the fcntl function. */ +#define HAVE_FCNTL + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +#define HAVE_FCNTL_O_NONBLOCK + +/* Define to 1 if you have the freeaddrinfo function. */ +#define HAVE_FREEADDRINFO + +/* Define to 1 if you have a working getaddrinfo function. */ +#define HAVE_GETADDRINFO + +/* Define to 1 if the getaddrinfo function is threadsafe. */ +/* #undef HAVE_GETADDRINFO_THREADSAFE */ + +/* Define to 1 if you have the getenv function. */ +#define HAVE_GETENV + +/* Define to 1 if you have the gethostbyaddr function. */ +#define HAVE_GETHOSTBYADDR + +/* Define to 1 if you have the gethostbyname function. */ +#define HAVE_GETHOSTBYNAME + +/* Define to 1 if you have the gethostname function. */ +#define HAVE_GETHOSTNAME + +/* Define to 1 if you have the getnameinfo function. */ +#define HAVE_GETNAMEINFO + +/* Define to 1 if you have the getservbyport_r function. */ +/* #undef HAVE_GETSERVBYPORT_R */ + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the `if_indextoname' function. */ +#define HAVE_IF_INDEXTONAME + +/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */ +/* #undef HAVE_INET_NET_PTON */ + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +#define HAVE_INET_NTOP + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +#define HAVE_INET_PTON + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H + +/* Define to 1 if you have the ioctl function. */ +#define HAVE_IOCTL + +/* Define to 1 if you have the ioctlsocket function. */ +/* #undef HAVE_IOCTLSOCKET */ + +/* Define to 1 if you have the IoctlSocket camel case function. */ +/* #undef HAVE_IOCTLSOCKET_CAMEL */ + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. + */ +/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +/* #undef HAVE_IOCTLSOCKET_FIONBIO */ + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO + +/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ +#define HAVE_IOCTL_SIOCGIFADDR + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +/* #undef HAVE_LIBRESOLV */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H + +/* if your compiler supports LL */ +#define HAVE_LL + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#define HAVE_LONGLONG + +/* Define to 1 if you have the malloc.h header file. */ +#define HAVE_MALLOC_H + +/* Define to 1 if you have the memory.h header file. */ +#define HAVE_MEMORY_H + +/* Define to 1 if you have the MSG_NOSIGNAL flag. */ +#define HAVE_MSG_NOSIGNAL + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_TCP_H + +/* Define to 1 if you have the header file. */ +#define HAVE_NET_IF_H + +/* Define to 1 if you have PF_INET6. */ +#define HAVE_PF_INET6 + +/* Define to 1 if you have the recv function. */ +#define HAVE_RECV + +/* Define to 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM + +/* Define to 1 if you have the send function. */ +#define HAVE_SEND + +/* Define to 1 if you have the setsockopt function. */ +#define HAVE_SETSOCKOPT + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H + +/* Define to 1 if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ + +/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID + +/* Define to 1 if you have the socket function. */ +#define HAVE_SOCKET + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SOCKET_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H + +/* Define to 1 if you have the strcasecmp function. */ +#define HAVE_STRCASECMP + +/* Define to 1 if you have the strcmpi function. */ +/* #undef HAVE_STRCMPI */ + +/* Define to 1 if you have the strdup function. */ +#define HAVE_STRDUP + +/* Define to 1 if you have the stricmp function. */ +/* #undef HAVE_STRICMP */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H + +/* Define to 1 if you have the strncasecmp function. */ +#define HAVE_STRNCASECMP + +/* Define to 1 if you have the strncmpi function. */ +/* #undef HAVE_STRNCMPI */ + +/* Define to 1 if you have the strnicmp function. */ +/* #undef HAVE_STRNICMP */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STROPTS_H + +/* Define to 1 if you have struct addrinfo. */ +#define HAVE_STRUCT_ADDRINFO + +/* Define to 1 if you have struct in6_addr. */ +#define HAVE_STRUCT_IN6_ADDR + +/* Define to 1 if you have struct sockaddr_in6. */ +#define HAVE_STRUCT_SOCKADDR_IN6 + +/* if struct sockaddr_storage is defined */ +#define HAVE_STRUCT_SOCKADDR_STORAGE + +/* Define to 1 if you have the timeval struct. */ +#define HAVE_STRUCT_TIMEVAL + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UIO_H + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H + +/* Define to 1 if you have the windows.h header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the winsock2.h header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if you have the winsock.h header file. */ +/* #undef HAVE_WINSOCK_H */ + +/* Define to 1 if you have the writev function. */ +#define HAVE_WRITEV + +/* Define to 1 if you have the ws2tcpip.h header file. */ +/* #undef HAVE_WS2TCPIP_H */ + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +/* #undef NEED_MALLOC_H */ + +/* Define to 1 if you need the memory.h header file even with stdlib.h */ +/* #undef NEED_MEMORY_H */ + +/* a suitable file/device to read random data from */ +/* #undef RANDOM_FILE */ + +/* Define to the type qualifier pointed by arg 5 for recvfrom. */ +#define RECVFROM_QUAL_ARG5 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 void * + +/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ +#define RECVFROM_TYPE_ARG2_IS_VOID 0 + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr * + +/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ +#define RECVFROM_TYPE_ARG5_IS_VOID 0 + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 socklen_t * + +/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ +#define RECVFROM_TYPE_ARG6_IS_VOID 0 + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV ssize_t + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 void * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV ssize_t + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 void * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV ssize_t + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME + +/* Define to disable non-blocking sockets. */ +#undef USE_BLOCKING_SOCKETS + +/* Define to avoid automatic inclusion of winsock.h */ +#undef WIN32_LEAN_AND_MEAN + +/* Type to use in place of in_addr_t when system does not provide it. */ +#undef in_addr_t + +#ifdef GPR_BACKWARDS_COMPATIBILITY_MODE + /* IMPORTANT: gRPC MANUAL EDIT HERE! + * Redefine the fd_set macros for GLIBC < 2.15 support. + * This is a backwards compatibility hack. At version 2.15, GLIBC introduces + * the __fdelt_chk function, and starts using it within its fd_set macros + * (which c-ares uses). For compatibility with GLIBC < 2.15, we need to redefine + * the fd_set macros to not use __fdelt_chk. */ + #include + #undef FD_SET + #undef FD_CLR + #undef FD_ISSET + /* 'FD_ZERO' doesn't use __fdelt_chk, no need to redefine. */ + + #ifdef __FDS_BITS + #define GRPC_CARES_FDS_BITS(set) __FDS_BITS(set) + #else + #define GRPC_CARES_FDS_BITS(set) ((set)->fds_bits) + #endif + + #define GRPC_CARES_FD_MASK(d) ((long int)(1UL << (d) % NFDBITS)) + + #define FD_SET(d, set) \ + ((void) (GRPC_CARES_FDS_BITS (set)[ (d) / NFDBITS ] |= GRPC_CARES_FD_MASK(d))) + #define FD_CLR(d, set) \ + ((void) (GRPC_CARES_FDS_BITS (set)[ (d) / NFDBITS ] &= ~GRPC_CARES_FD_MASK(d))) + #define FD_ISSET(d, set) \ + ((GRPC_CARES_FDS_BITS (set)[ (d) / NFDBITS ] & GRPC_CARES_FD_MASK(d)) != 0) +#endif /* GPR_BACKWARDS_COMPATIBILITY_MODE */ -- cgit v1.2.3 From 8ccb83a9e2c3c0d7351c36d482e92b566f3a387b Mon Sep 17 00:00:00 2001 From: Param Reddy Date: Tue, 24 Oct 2017 14:06:21 -0700 Subject: Update comments to mention iOS also is not supported. --- third_party/cares/cares.BUILD | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'third_party') diff --git a/third_party/cares/cares.BUILD b/third_party/cares/cares.BUILD index 058a992ea9..8cc01b64c4 100644 --- a/third_party/cares/cares.BUILD +++ b/third_party/cares/cares.BUILD @@ -3,7 +3,7 @@ config_setting( values = {"cpu": "darwin"}, ) -# Android is not officially supported. +# Android is not officially supported through C++. # This just helps with the build for now. config_setting( name = "android", @@ -12,6 +12,8 @@ config_setting( }, ) +# iOS is not officially supported through C++. +# This just helps with the build for now. config_setting( name = "ios_x86_64", values = {"cpu": "ios_x86_64"}, -- cgit v1.2.3