android curl库编译(一)

前言

用过Linux 都知道 curl 命令,curl 支持 DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP. 最为关键是开源.

1 下载 curl 源码 下载NDK

环境 win7 64
https://curl.se/download.html
在windows 就下载了 curl-7.80.0.zip
https://github.com/android/ndk/wiki/Unsupported-Downloads
最新都 23b 这里就下载个老版本 android-ndk-r16b-windows-x86_64.zip (以前用cocoscreator打包用这个版本)
在这里插入图片描述

解压curl-7.80.0.zip 创建个jni 目录 把所有文件 拷贝进去
在这里插入图片描述

2 创建Android.mk Application.mk curl_config.h

android.mk 内容如下
-DBUILDING_LIBCURL 一定要加

LOCAL_PATH:= $(call my-dir)
 
CFLAGS := -Wpointer-arith -Wwrite-strings -Wunused -Winline \
 -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-long-long \
 -Wfloat-equal -Wno-multichar -Wsign-compare -Wno-format-nonliteral \
 -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement \
 -Wno-system-headers -DHAVE_CONFIG_H -DBUILDING_LIBCURL
 
include $(CLEAR_VARS)
include $(LOCAL_PATH)/lib/Makefile.inc
 
LOCAL_SRC_FILES := $(addprefix lib/,$(CSOURCES))
LOCAL_CFLAGS += $(CFLAGS)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include/ $(LOCAL_PATH)/lib
 
LOCAL_COPY_HEADERS_TO := libcurl
LOCAL_COPY_HEADERS := $(addprefix include/curl/,$(HHEADERS))
 
LOCAL_MODULE:= libcurl
 
include $(BUILD_SHARED_LIBRARY)

Application.mk 内容如下
ARMv5 就不用支持了,这个太 老了,除非你要在很老很老的机器上跑,v9都出来,以后机子一般都不支持32位了

#CPU架构	ABI	
#ARMv5	armeabi	32位,从2010年
#ARMv7	armeabi-v7a	32位,从2010年
#x86	x86	32位,从2011年
#MIPS	mips	32位,从2012年
#ARMv8	arm64-v8a	64位,从2014年
#MIPS64	mips64	64位,从2014年
#x86_64	x86_64	64位,从2014年
#APP_ABI := armeabi,armeabi-v7a,x86,mips,arm64-v8a,mips64,x86_64
#APP_ABI := all    #直接生成所有的版本

APP_PLATFORM = android-23
APP_ABI := armeabi-v7a,arm64-v8a,x86,x86_64
APP_STL := stlport_static
APP_CPPFLAGS := -fexceptions -frtti  

curl_config.h ./configure配置环境生成curl_config.h
修改内容如下 (直接拷贝这个文件内容省事也不用去./configure) 放到lib目录下
在这里插入图片描述

#ifndef HEADER_CURL_CONFIG_H
#define HEADER_CURL_CONFIG_H
//eh modify for android
/* lib/curl_config.h.  Generated from curl_config.h.in by configure.  */
/* lib/curl_config.h.in.  Generated from configure.ac by autoheader.  */
 
/* when building libcurl itself */
/* #undef BUILDING_LIBCURL */
 
/* Location of default ca bundle */
/* #undef CURL_CA_BUNDLE */
 
/* Location of default ca path */
/* #undef CURL_CA_PATH */
 
/* to disable cookies support */
/* #undef CURL_DISABLE_COOKIES */
 
/* to disable cryptographic authentication */
/* #undef CURL_DISABLE_CRYPTO_AUTH */
 
/* to disable DICT */
/* #undef CURL_DISABLE_DICT */
 
/* to disable FILE */
/* #undef CURL_DISABLE_FILE */
 
/* to disable FTP */
#define CURL_DISABLE_FTP 1
 
/* to disable HTTP */
/* #undef CURL_DISABLE_HTTP */
 
/* to disable IMAP */
#define CURL_DISABLE_IMAP 1
 
/* to disable LDAP */
#define CURL_DISABLE_LDAP 1
 
/* to disable LDAPS */
#define CURL_DISABLE_LDAPS 1
 
/* to disable POP3 */
#define CURL_DISABLE_POP3 1
 
/* to disable proxies */
/* #undef CURL_DISABLE_PROXY */
 
/* to disable RTSP */
#define CURL_DISABLE_RTSP 1
 
/* to disable SMTP */
#define CURL_DISABLE_SMTP 1
 
/* to disable TELNET */
#define CURL_DISABLE_TELNET 1
 
/* to disable TFTP */
#define CURL_DISABLE_TFTP 1
 
/* to disable verbose strings */
/* #undef CURL_DISABLE_VERBOSE_STRINGS */
 
/* to make a symbol visible */
/* #undef CURL_EXTERN_SYMBOL */
 
/* to enable hidden symbols */
/* #undef CURL_HIDDEN_SYMBOLS */
 
/* W$ LDAP with non-W$ compiler */
/* #undef CURL_LDAP_HYBRID */
 
/* Use W$ LDAP implementation */
/* #undef CURL_LDAP_WIN */
 
/* when not building a shared library */
/* #undef CURL_STATICLIB */
 
/* your Entropy Gathering Daemon socket pathname */
/* #undef EGD_SOCKET */
 
/* Define if you want to enable IPv6 support */
/* #undef ENABLE_IPV6 */
 
/* Define to the type qualifier of arg 1 for getnameinfo. */
#define GETNAMEINFO_QUAL_ARG1 const
 
/* 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 size_t
 
/* Define to the type of arg 7 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG7 int
 
/* Specifies the number of arguments to getservbyport_r */
/* #undef GETSERVBYPORT_R_ARGS */
 
/* Specifies the size of the buffer to pass to getservbyport_r */
/* #undef GETSERVBYPORT_R_BUFSIZE */
 
/* Define to 1 if you have the alarm function. */
#define HAVE_ALARM 1
 
/* Define to 1 if you have the <alloca.h> header file. */
#define HAVE_ALLOCA_H 1
 
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
 
/* Define to 1 if you have the <arpa/tftp.h> header file. */
/* #undef HAVE_ARPA_TFTP_H */
 
/* Define to 1 if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
 
/* Define to 1 if you have the basename function. */
#define HAVE_BASENAME 1
 
/* Define to 1 if bool is an available type. */
#define HAVE_BOOL_T 1
 
/* Define to 1 if you have the clock_gettime function and monotonic timer. */
#define HAVE_CLOCK_GETTIME_MONOTONIC 1
 
/* 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 1
 
/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */
/* #undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA */
 
/* Define to 1 if you have the <crypto.h> header file. */
/* #undef HAVE_CRYPTO_H */
 
/* Define to 1 if you have the <des.h> header file. */
/* #undef HAVE_DES_H */
 
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
 
/* Define to 1 if you have the `ENGINE_cleanup' function. */
/* #undef HAVE_ENGINE_CLEANUP */
 
/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */
/* #undef HAVE_ENGINE_LOAD_BUILTIN_ENGINES */
 
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
 
/* Define to 1 if you have the <err.h> header file. */
/* #undef HAVE_ERR_H */
 
/* Define to 1 if you have the fcntl function. */
#define HAVE_FCNTL 1
 
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
 
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */
#define HAVE_FCNTL_O_NONBLOCK 1
 
/* Define to 1 if you have the fdopen function. */
#define HAVE_FDOPEN 1
 
/* Define to 1 if you have the `fork' function. */
#define HAVE_FORK 1
 
/* Define to 1 if you have the freeaddrinfo function. */
#define HAVE_FREEADDRINFO 1
 
/* Define to 1 if you have the freeifaddrs function. */
/* #undef HAVE_FREEIFADDRS */
 
/* Define to 1 if you have the ftruncate function. */
#define HAVE_FTRUNCATE 1
 
/* Define to 1 if you have a working getaddrinfo function. */
#define HAVE_GETADDRINFO 1
 
/* Define to 1 if the getaddrinfo function is threadsafe. */
#define HAVE_GETADDRINFO_THREADSAFE 1
 
/* Define to 1 if you have the `geteuid' function. */
#define HAVE_GETEUID 1
 
/* Define to 1 if you have the gethostbyaddr function. */
#define HAVE_GETHOSTBYADDR 1
 
/* Define to 1 if you have the gethostbyaddr_r function. */
/* #undef HAVE_GETHOSTBYADDR_R */
 
/* gethostbyaddr_r() takes 5 args */
/* #undef HAVE_GETHOSTBYADDR_R_5 */
 
/* gethostbyaddr_r() takes 7 args */
/* #undef HAVE_GETHOSTBYADDR_R_7 */
 
/* gethostbyaddr_r() takes 8 args */
/* #undef HAVE_GETHOSTBYADDR_R_8 */
 
/* Define to 1 if you have the gethostbyname function. */
#define HAVE_GETHOSTBYNAME 1
 
/* Define to 1 if you have the gethostbyname_r function. */
#define HAVE_GETHOSTBYNAME_R 1
 
/* gethostbyname_r() takes 3 args */
/* #undef HAVE_GETHOSTBYNAME_R_3 */
 
/* gethostbyname_r() takes 5 args */
/* #undef HAVE_GETHOSTBYNAME_R_5 */
 
/* gethostbyname_r() takes 6 args */
#define HAVE_GETHOSTBYNAME_R_6 1
 
/* Define to 1 if you have the gethostname function. */
#define HAVE_GETHOSTNAME 1
 
/* Define to 1 if you have a working getifaddrs function. */
/* #undef HAVE_GETIFADDRS */
 
/* Define to 1 if you have the getnameinfo function. */
#define HAVE_GETNAMEINFO 1
 
/* Define to 1 if you have the `getpass_r' function. */
/* #undef HAVE_GETPASS_R */
 
/* Define to 1 if you have the `getppid' function. */
#define HAVE_GETPPID 1
 
/* Define to 1 if you have the `getprotobyname' function. */
#define HAVE_GETPROTOBYNAME 1
 
/* Define to 1 if you have the `getpwuid' function. */
#define HAVE_GETPWUID 1
 
/* Define to 1 if you have the `getrlimit' function. */
#define HAVE_GETRLIMIT 1
 
/* 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 1
 
/* Define to 1 if you have a working glibc-style strerror_r function. */
/* #undef HAVE_GLIBC_STRERROR_R */
 
/* Define to 1 if you have a working gmtime_r function. */
#define HAVE_GMTIME_R 1
 
/* if you have the gssapi libraries */
/* #undef HAVE_GSSAPI */
 
/* Define to 1 if you have the <gssapi/gssapi_generic.h> header file. */
/* #undef HAVE_GSSAPI_GSSAPI_GENERIC_H */
 
/* Define to 1 if you have the <gssapi/gssapi.h> header file. */
/* #undef HAVE_GSSAPI_GSSAPI_H */
 
/* Define to 1 if you have the <gssapi/gssapi_krb5.h> header file. */
/* #undef HAVE_GSSAPI_GSSAPI_KRB5_H */
 
/* if you have the GNU gssapi libraries */
/* #undef HAVE_GSSGNU */
 
/* if you have the Heimdal gssapi libraries */
/* #undef HAVE_GSSHEIMDAL */
 
/* if you have the MIT gssapi libraries */
/* #undef HAVE_GSSMIT */
 
/* Define to 1 if you have the `idna_strerror' function. */
/* #undef HAVE_IDNA_STRERROR */
 
/* Define to 1 if you have the `idn_free' function. */
/* #undef HAVE_IDN_FREE */
 
/* Define to 1 if you have the <idn-free.h> header file. */
/* #undef HAVE_IDN_FREE_H */
 
/* Define to 1 if you have the <ifaddrs.h> header file. */
/* #undef HAVE_IFADDRS_H */
 
/* Define to 1 if you have the `inet_addr' function. */
#define HAVE_INET_ADDR 1
 
/* Define to 1 if you have the inet_ntoa_r function. */
/* #undef HAVE_INET_NTOA_R */
 
/* inet_ntoa_r() takes 2 args */
/* #undef HAVE_INET_NTOA_R_2 */
 
/* inet_ntoa_r() takes 3 args */
/* #undef HAVE_INET_NTOA_R_3 */
 
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */
#define HAVE_INET_NTOP 1
 
/* Define to 1 if you have a IPv6 capable working inet_pton function. */
#define HAVE_INET_PTON 1
 
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
 
/* Define to 1 if you have the ioctl function. */
#define HAVE_IOCTL 1
 
/* 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 1
 
/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */
#define HAVE_IOCTL_SIOCGIFADDR 1
 
/* Define to 1 if you have the <io.h> header file. */
/* #undef HAVE_IO_H */
 
/* if you have the Kerberos4 libraries (including -ldes) */
/* #undef HAVE_KRB4 */
 
/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */
/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */
 
/* Define to 1 if you have the <krb.h> header file. */
/* #undef HAVE_KRB_H */
 
/* Define to 1 if you have the lber.h header file. */
/* #undef HAVE_LBER_H */
 
/* Define to 1 if you have the ldapssl.h header file. */
/* #undef HAVE_LDAPSSL_H */
 
/* Define to 1 if you have the ldap.h header file. */
/* #undef HAVE_LDAP_H */
 
/* Use LDAPS implementation */
/* #undef HAVE_LDAP_SSL */
 
/* Define to 1 if you have the ldap_ssl.h header file. */
/* #undef HAVE_LDAP_SSL_H */
 
/* Define to 1 if you have the `ldap_url_parse' function. */
/* #undef HAVE_LDAP_URL_PARSE */
 
/* Define to 1 if you have the <libgen.h> header file. */
#define HAVE_LIBGEN_H 1
 
/* Define to 1 if you have the `idn' library (-lidn). */
/* #undef HAVE_LIBIDN */
 
/* Define to 1 if you have the `resolv' library (-lresolv). */
/* #undef HAVE_LIBRESOLV */
 
/* Define to 1 if you have the `resolve' library (-lresolve). */
/* #undef HAVE_LIBRESOLVE */
 
/* Define to 1 if you have the `ssh2' library (-lssh2). */
/* #undef HAVE_LIBSSH2 */
 
/* Define to 1 if you have the <libssh2.h> header file. */
/* #undef HAVE_LIBSSH2_H */
 
/* Define to 1 if you have the `libssh2_version' function. */
/* #undef HAVE_LIBSSH2_VERSION */
 
/* Define to 1 if you have the `ssl' library (-lssl). */
/* #undef HAVE_LIBSSL */
 
/* if zlib is available */
/* #undef HAVE_LIBZ */
 
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
 
/* if your compiler supports LL */
#define HAVE_LL 1
 
/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
 
/* Define to 1 if you have a working localtime_r function. */
#define HAVE_LOCALTIME_R 1
 
/* Define to 1 if the compiler supports the 'long long' data type. */
#define HAVE_LONGLONG 1
 
/* Define to 1 if you have the malloc.h header file. */
#define HAVE_MALLOC_H 1
 
/* Define to 1 if you have the memory.h header file. */
#define HAVE_MEMORY_H 1
 
/* Define to 1 if you have the memrchr function or macro. */
#define HAVE_MEMRCHR 1
 
/* Define to 1 if you have the MSG_NOSIGNAL flag. */
#define HAVE_MSG_NOSIGNAL 1
 
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
 
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
 
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#define HAVE_NETINET_TCP_H 1
 
/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1
 
/* Define to 1 if NI_WITHSCOPEID exists and works. */
/* #undef HAVE_NI_WITHSCOPEID */
 
/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE
   */
/* #undef HAVE_OLD_GSSMIT */
 
/* Define to 1 if you have the <openssl/crypto.h> header file. */
/* #undef HAVE_OPENSSL_CRYPTO_H */
 
/* Define to 1 if you have the <openssl/engine.h> header file. */
/* #undef HAVE_OPENSSL_ENGINE_H */
 
/* Define to 1 if you have the <openssl/err.h> header file. */
/* #undef HAVE_OPENSSL_ERR_H */
 
/* Define to 1 if you have the <openssl/pem.h> header file. */
/* #undef HAVE_OPENSSL_PEM_H */
 
/* Define to 1 if you have the <openssl/pkcs12.h> header file. */
/* #undef HAVE_OPENSSL_PKCS12_H */
 
/* Define to 1 if you have the <openssl/rsa.h> header file. */
/* #undef HAVE_OPENSSL_RSA_H */
 
/* Define to 1 if you have the <openssl/ssl.h> header file. */
/* #undef HAVE_OPENSSL_SSL_H */
 
/* Define to 1 if you have the <openssl/x509.h> header file. */
/* #undef HAVE_OPENSSL_X509_H */
 
/* Define to 1 if you have the <pem.h> header file. */
/* #undef HAVE_PEM_H */
 
/* Define to 1 if you have the `perror' function. */
#define HAVE_PERROR 1
 
/* Define to 1 if you have the `pipe' function. */
#define HAVE_PIPE 1
 
/* if you have the function PK11_CreateGenericObject */
/* #undef HAVE_PK11_CREATEGENERICOBJECT */
 
/* Define to 1 if you have a working poll function. */
#define HAVE_POLL 1
 
/* If you have a fine poll */
#define HAVE_POLL_FINE 1
 
/* Define to 1 if you have the <poll.h> header file. */
#define HAVE_POLL_H 1
 
/* Define to 1 if you have a working POSIX-style strerror_r function. */
#define HAVE_POSIX_STRERROR_R 1
 
/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
 
/* Define to 1 if you have the `RAND_egd' function. */
/* #undef HAVE_RAND_EGD */
 
/* Define to 1 if you have the `RAND_screen' function. */
/* #undef HAVE_RAND_SCREEN */
 
/* Define to 1 if you have the `RAND_status' function. */
/* #undef HAVE_RAND_STATUS */
 
/* Define to 1 if you have the recv function. */
#define HAVE_RECV 1
 
/* Define to 1 if you have the recvfrom function. */
#define HAVE_RECVFROM 1
 
/* Define to 1 if you have the <rsa.h> header file. */
/* #undef HAVE_RSA_H */
 
/* Define to 1 if you have the select function. */
#define HAVE_SELECT 1
 
/* Define to 1 if you have the send function. */
#define HAVE_SEND 1
 
/* Define to 1 if you have the <setjmp.h> header file. */
#define HAVE_SETJMP_H 1
 
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
 
/* Define to 1 if you have the `setmode' function. */
/* #undef HAVE_SETMODE */
 
/* Define to 1 if you have the `setrlimit' function. */
#define HAVE_SETRLIMIT 1
 
/* Define to 1 if you have the setsockopt function. */
#define HAVE_SETSOCKOPT 1
 
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */
 
/* Define to 1 if you have the <sgtty.h> header file. */
#define HAVE_SGTTY_H 1
 
/* Define to 1 if you have the sigaction function. */
#define HAVE_SIGACTION 1
 
/* Define to 1 if you have the siginterrupt function. */
#define HAVE_SIGINTERRUPT 1
 
/* Define to 1 if you have the signal function. */
/* #undef HAVE_SIGNAL */
 
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
 
/* Define to 1 if you have the sigsetjmp function or macro. */
#define HAVE_SIGSETJMP 1
 
/* Define to 1 if sig_atomic_t is an available typedef. */
#define HAVE_SIG_ATOMIC_T 1
 
/* Define to 1 if sig_atomic_t is already defined as volatile. */
/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */
 
/* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */
/* #undef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID */
 
/* Define to 1 if you have the socket function. */
#define HAVE_SOCKET 1
 
/* Define to 1 if you have the <socket.h> header file. */
/* #undef HAVE_SOCKET_H */
 
/* Define this if you have the SPNEGO library fbopenssl */
/* #undef HAVE_SPNEGO */
 
/* Define to 1 if you have the `SSL_get_shutdown' function. */
/* #undef HAVE_SSL_GET_SHUTDOWN */
 
/* Define to 1 if you have the <ssl.h> header file. */
/* #undef HAVE_SSL_H */
 
/* Define to 1 if you have the <stdbool.h> header file. */
#define HAVE_STDBOOL_H 1
 
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
 
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
 
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
 
/* Define to 1 if you have the strcasecmp function. */
#define HAVE_STRCASECMP 1
 
/* Define to 1 if you have the strcasestr function. */
#define HAVE_STRCASESTR 1
 
/* Define to 1 if you have the strcmpi function. */
/* #undef HAVE_STRCMPI */
 
/* Define to 1 if you have the strdup function. */
#define HAVE_STRDUP 1
 
/* Define to 1 if you have the strerror_r function. */
#define HAVE_STRERROR_R 1
 
/* Define to 1 if you have the stricmp function. */
/* #undef HAVE_STRICMP */
 
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
 
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
 
/* Define to 1 if you have the strlcat function. */
#define HAVE_STRLCAT 1
 
/* Define to 1 if you have the `strlcpy' function. */
/* #undef HAVE_STRLCPY */
 
/* Define to 1 if you have the strncasecmp function. */
#define HAVE_STRNCASECMP 1
 
/* 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 <stropts.h> header file. */
/* #undef HAVE_STROPTS_H */
 
/* Define to 1 if you have the strstr function. */
#define HAVE_STRSTR 1
 
/* Define to 1 if you have the strtok_r function. */
#define HAVE_STRTOK_R 1
 
/* Define to 1 if you have the strtoll function. */
#define HAVE_STRTOLL 1
 
/* if struct sockaddr_storage is defined */
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
 
/* Define to 1 if you have the timeval struct. */
#define HAVE_STRUCT_TIMEVAL 1
 
/* Define to 1 if you have the <sys/filio.h> header file. */
/* #undef HAVE_SYS_FILIO_H */
 
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
 
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
 
/* Define to 1 if you have the <sys/poll.h> header file. */
#define HAVE_SYS_POLL_H 1
 
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
 
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
 
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
 
/* Define to 1 if you have the <sys/sockio.h> header file. */
/* #undef HAVE_SYS_SOCKIO_H */
 
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
 
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
 
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
 
/* Define to 1 if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1
 
/* Define to 1 if you have the <sys/un.h> header file. */
#define HAVE_SYS_UN_H 1
 
/* Define to 1 if you have the <sys/utime.h> header file. */
#define HAVE_SYS_UTIME_H 1
 
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
 
/* Define to 1 if you have the <termio.h> header file. */
/* #undef HAVE_TERMIO_H */
 
/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1
 
/* Define to 1 if you have the <tld.h> header file. */
/* #undef HAVE_TLD_H */
 
/* Define to 1 if you have the `tld_strerror' function. */
/* #undef HAVE_TLD_STRERROR */
 
/* Define to 1 if you have the `uname' function. */
#define HAVE_UNAME 1
 
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
 
/* Define to 1 if you have the `utime' function. */
#define HAVE_UTIME 1
 
/* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
 
/* Define to 1 if compiler supports C99 variadic macro style. */
#define HAVE_VARIADIC_MACROS_C99 1
 
/* Define to 1 if compiler supports old gcc variadic macro style. */
#define HAVE_VARIADIC_MACROS_GCC 1
 
/* Define to 1 if you have the winber.h header file. */
/* #undef HAVE_WINBER_H */
 
/* Define to 1 if you have the windows.h header file. */
/* #undef HAVE_WINDOWS_H */
 
/* Define to 1 if you have the winldap.h header file. */
/* #undef HAVE_WINLDAP_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 this symbol if your OS supports changing the contents of argv */
/* #undef HAVE_WRITABLE_ARGV */
 
/* Define to 1 if you have the writev function. */
#define HAVE_WRITEV 1
 
/* Define to 1 if you have the ws2tcpip.h header file. */
/* #undef HAVE_WS2TCPIP_H */
 
/* Define to 1 if you have the <x509.h> header file. */
/* #undef HAVE_X509_H */
 
/* if you have the zlib.h header file */
/* #undef HAVE_ZLIB_H */
 
/* Define to the sub-directory in which libtool stores uninstalled libraries.
   */
#define LT_OBJDIR ".libs/"
 
/* Define to 1 if you are building a native Windows target. */
/* #undef NATIVE_WINDOWS */
 
/* Define to 1 if you need the lber.h header file even with ldap.h */
/* #undef NEED_LBER_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 */
 
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */
/* #undef NEED_REENTRANT */
 
/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */
/* #undef NEED_THREAD_SAFE */
 
/* cpu-machine-OS */
#define OS "arm-unknown-linux-gnu"
 
/* Name of package */
#define PACKAGE "curl"
 
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"
 
/* Define to the full name of this package. */
#define PACKAGE_NAME "curl"
 
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "curl -"
 
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "curl"
 
/* Define to the home page for this package. */
/* #undef PACKAGE_URL */
 
/* Define to the version of this package. */
#define PACKAGE_VERSION "-"
 
/* a suitable file to read random data from */
/* #undef RANDOM_FILE */
 
/* Define to the type of arg 1 for recvfrom. */
/* #undef RECVFROM_TYPE_ARG1 */
 
/* Define to the type pointed by arg 2 for recvfrom. */
/* #undef RECVFROM_TYPE_ARG2 */
 
/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */
/* #undef RECVFROM_TYPE_ARG2_IS_VOID */
 
/* Define to the type of arg 3 for recvfrom. */
/* #undef RECVFROM_TYPE_ARG3 */
 
/* Define to the type of arg 4 for recvfrom. */
/* #undef RECVFROM_TYPE_ARG4 */
 
/* Define to the type pointed by arg 5 for recvfrom. */
/* #undef RECVFROM_TYPE_ARG5 */
 
/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */
/* #undef RECVFROM_TYPE_ARG5_IS_VOID */
 
/* Define to the type pointed by arg 6 for recvfrom. */
/* #undef RECVFROM_TYPE_ARG6 */
 
/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */
/* #undef RECVFROM_TYPE_ARG6_IS_VOID */
 
/* Define to the function return type for recvfrom. */
/* #undef RECVFROM_TYPE_RETV */
 
/* 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 unsigned 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 void
 
/* Define to the type qualifier of arg 5 for select. */
#define SELECT_QUAL_ARG5 
 
/* Define to the type of arg 1 for select. */
#define SELECT_TYPE_ARG1 int
 
/* Define to the type of args 2, 3 and 4 for select. */
#define SELECT_TYPE_ARG234 fd_set *
 
/* Define to the type of arg 5 for select. */
#define SELECT_TYPE_ARG5 struct timeval *
 
/* Define to the function return type for select. */
#define SELECT_TYPE_RETV int
 
/* Define to the type qualifier of arg 2 for send. */
#define SEND_QUAL_ARG2 const
 
/* 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 unsigned int
 
/* Define to the function return type for send. */
#define SEND_TYPE_RETV ssize_t
 
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
 
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 4
 
/* The size of `off_t', as computed by sizeof. */
#define SIZEOF_OFF_T 4
 
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
 
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
 
/* The size of `time_t', as computed by sizeof. */
#define SIZEOF_TIME_T 4
 
/* The size of `void*', as computed by sizeof. */
#define SIZEOF_VOIDP 4
 
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
 
/* Define to the type of arg 3 for strerror_r. */
#define STRERROR_R_TYPE_ARG3 size_t
 
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
 
/* Define to enable c-ares support */
/* #undef USE_ARES */
 
/* Define to disable non-blocking sockets. */
/* #undef USE_BLOCKING_SOCKETS */
 
/* if GnuTLS is enabled */
/* #undef USE_GNUTLS */
 
/* if libSSH2 is in use */
/* #undef USE_LIBSSH2 */
 
/* If you want to build curl with the built-in manual */
/* #undef USE_MANUAL */
 
/* if NSS is enabled */
/* #undef USE_NSS */
 
/* if OpenSSL is in use */
/* #undef USE_OPENSSL */
 
/* if SSL is enabled */
/* #undef USE_SSLEAY */
 
/* Define to 1 if you are building a Windows target without large file
   support. */
/* #undef USE_WIN32_LARGE_FILES */
 
/* to enable SSPI support */
/* #undef USE_WINDOWS_SSPI */
 
/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */
/* #undef USE_YASSLEMUL */
 
/* Version number of package */
#define VERSION "7.47.1"
 
/* Define to avoid automatic inclusion of winsock.h */
/* #undef WIN32_LEAN_AND_MEAN */
 
/* Define to 1 if OS is AIX. */
#ifndef _ALL_SOURCE
/* #  undef _ALL_SOURCE */
#endif
 
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
 
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
 
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
 
/* Type to use in place of in_addr_t when system does not provide it. */
/* #undef in_addr_t */
 
/* Define to `__inline__' or `__inline' if that's what the C compiler
   calls it, or to nothing if 'inline' is not supported under any name.  */
#ifndef __cplusplus
/* #undef inline */
#endif
 
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
 
/* the signed version of size_t */
/* #undef ssize_t */
#endif /* HEADER_CURL_CONFIG_H */

3 编译libcurl.so

3.1 修改 http_chunks.h line32
原定义 #define CHUNK_MAXNUM_LEN (SIZEOF_CURL_OFF_T * 2)
SIZEOF_CURL_OFF_T 编译时找不到,搜了相关文件也没有,所有手动修改了
CURL_TYPEOF_CURL_OFF_T 在 include/system.h 有定义
看意思 For 64 bit curl_off_t we support 16 digits. For 32 bit, 8 digits 跟手动定义的一样

/*
 * The longest possible hexadecimal number we support in a chunked transfer.
 * Neither RFC2616 nor the later HTTP specs define a maximum chunk size.
 * For 64 bit curl_off_t we support 16 digits. For 32 bit, 8 digits.
 */
#define CHUNK_MAXNUM_LEN (sizeof(CURL_TYPEOF_CURL_OFF_T) *2 )  //eh modify (SIZEOF_CURL_OFF_T * 2)

3.2 修改Android.mk
-DBUILDING_LIBCURL 这个一定要加 ,上面 mk文件里已经加了,为什么呢,直接上图
自己看 easy.c easy.h 函数定义
在这里插入图片描述
3.3 编译so
ndk-build 这里因为ndk-build 所在目录没放到系统path 里,所以
在这里插入图片描述
libs 里有所有的so
在这里插入图片描述

4 编译好的SO 库链接地址

https://download.csdn.net/download/yunteng521/61669865

5 android 调用 curl库

android curl.so使用(二)

参考

### 回答1: 要将GDAL编译为适用于Android的共享(.so),可以按照以下步骤进行操作: 1. 确保你已经具备了进行Android开发的环境,包括Android Studio和SDK。 2. 下载GDAL源代码,可以从官方网站或GitHub获取最新的GDAL源代码。 3. 在下载的GDAL源代码目录中找到`android`文件夹,这个文件夹包含了编译所需的相关配置和脚本。 4. 进入`android`文件夹,并在终端中运行`./build.py`命令,这个命令将使用脚本自动编译GDAL为Android的共享。 5. 等待编译过程完成,这可能需要一些时间。如果一切顺利,编译过程会生成共享文件(.so)和其他所需的文件。 6. 将生成的共享文件(.so)复制到你的Android项目中,并在项目的`jniLibs`文件夹中创建对应的架构文件夹(如armeabi-v7a、arm64-v8a等),将文件分别放入各自的文件夹中。 7. 在Android项目的`gradle.build`文件中添加相应的NDK配置,以确保Android系统能够正确加载并使用GDAL共享。配置示例: ```groovy android { // ... defaultConfig { // ... ndk { abiFilters 'armeabi-v7a', 'arm64-v8a' // 添加所需的架构 } } // ... } ``` 8. 然后就可以在你的Android项目中使用GDAL了。你可以根据GDAL的文档和API参考来编写自己的代码,并通过JNI接口调用GDAL中的功能。 这些步骤可以帮助你将GDAL编译为适用于Android的共享,供你的Android项目使用。记得遵循GDAL和Android的相关开发规范,并根据你的项目的需求进行适当的配置和调整。 ### 回答2: 要将GDAL编译成可以在Android上使用的.so,您可以按照以下步骤进行操作: 1. 在编译GDAL之前,您需要准备好Android NDK(Native Development Kit),它包含了用于编译C/C++代码的工具链和。 2. 下载GDAL的源代码,并解压缩到一个目录中。 3. 打开终端(或命令提示符),进入GDAL源代码目录。 4. 创建一个用于构建Android的文件夹,可以命名为"android-build"。 5. 在终端中切换到"android-build"文件夹,并运行以下命令: ``` $ /path/to/android-ndk/ndk-build -C /path/to/gdal/source ``` 其中"/path/to/android-ndk"是Android NDK的安装路径,"/path/to/gdal/source"是GDAL源代码的路径。 6. 等待编译完成,成功后会在"android-build"文件夹中生成一个".so"文件,该文件即为可用于Android的GDAL。 7. 将生成的".so"文件复制到您的Android项目中的"libs"文件夹。 8. 在您的Android项目的build.gradle文件中,添加以下代码: ``` android { // ... sourceSets { main { jniLibs.srcDirs = ['libs'] } } } ``` 这会告诉Android构建系统在编译时将so打包到apk文件中。 9. 使用GDAL功能的代码中,可以加载并使用GDAL了。您可以在代码中使用`System.loadLibrary("gdal")`来加载。 10. 现在,您可以在Android应用程序中使用GDAL了,通过调用GDAL函数进行地理数据处理和分析。 以上是将GDAL编译成可以在Android使用的.so的基本步骤。根据您的具体编译环境和需求,可能需要进行一些额外的配置和调整。 ### 回答3: 为了将GDAL编译成适用于Android的.so,您可以按照以下步骤进行操作: 1. 下载GDAL源代码:您可以从GDAL官方网站(https://gdal.org/)下载最新的GDAL源代码压缩包。 2. 配置Android开发环境:确保您的系统配置了适用于Android开发的环境,包括安装了Java JDK、Android SDK和NDK。 3. 解压GDAL源代码压缩包:将下载的GDAL源代码压缩包解压到您的计算机上的一个目录中。 4. 打开终端:在终端中进入GDAL源代码的根目录。 5. 设置编译参数:使用以下命令设置编译参数: ``` export CC=<在NDK中找到您的工具链的绝对路径> export CXX=<在NDK中找到您的工具链的绝对路径> export AR=<在NDK中找到您的工具链的绝对路径> export CFLAGS="-fPIC" export ANDROID_NDK=<您的NDK安装路径> export ANDROID_SDK=<您的SDK安装路径> ``` 6. 配置编译选项:使用以下命令配置编译选项: ``` ./configure \ --host=arm-linux-androideabi \ --with-android=yes \ --prefix=/usr/local \ --with-jpeg=internal \ --with-png=internal \ --with-geotiff=internal \ --with-libtiff=internal \ --with-curl=no \ --with-pcraster=no \ --with-gif=no \ --with-ogr=no \ --with-php=no \ --with-xml2=no \ --with-expat=no \ --with-sqlite3=no \ --with-spatialite=no ``` 7. 编译和安装:运行以下命令编译和安装.so: ``` make sudo make install ``` 8. 生成.so编译完成后,在你的目录中会生成一个.libs文件夹,在该文件夹中可以找到所需的.so文件。 现在,您已经成功地将GDAL编译Android可用的.so。您可以将这些.so添加到您的Android项目中,并在代码中使用GDAL的功能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值