1、curl编译编译libcurl1 libcurl相关链接http:/curl.haxx.se/libcurl 主页http:/curl.haxx.se/download/curl-7.21.3.tar.bz2 下载 Http应用 HTTP/FTP客户端开发库:libwww、libcurl、libfetch 以及更多 libcurl使用的简单例子 libcurl编程流程2 编译参考的地址:http:/curl.haxx.se/mail/lib-2009-12/0071.html3 编译使用cygwin+android sdk1.5 + NDK 6编译libcurl过程:3.1 环境搭建1、 搭建
2、环境就不说了网上很多。3.2 编译下载源码,在cygwin命令行中切换到curl目录下。执行./configure命令,生成curl_config.h文件。参照上面连接,把没有的包相关宏定义关闭。通过NDk编译就可以生成静态库。生成静态库会有一些警告:把buildplatformsandroid-3arch-armusrinclude中的time.h,和unistd.h中有问题的代码修改一下,就可以避免警告:time.h中把extern clock_t clock();改成 extern clock_t clock(void);,把unistd.h中的extern unsigned int _
3、page_shift;改成 unsigned int _page_shift;就可以避免生成静态库时出现警告。我的cur_config.h文件如下:但是生成动态库时会出错:生成动态库用到的Android.mk文件如下:我讲源码、头文件所在curl文件夹都放在MK所在目录。4 Android.mkLOCAL_PATH:= $(call my-dir)common_CFLAGS := -Wpointer-arith -Wwrite-strings -Wunused -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototyp
4、es -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 include $(CLEAR_VARS)LOCAL_SRC_FILES := axtls.c base64.c connect.c content_encoding.c cookie.c curl_addrinfo.c cur
5、l_fnmatch.c curl_gethostname.c curl_memrchr.c curl_rand.c curl_rtmp.c curl_sspi.c curl_threads.c dict.c easy.c escape.c file.c fileinfo.c formdata.c ftp.c ftplistparser.c getenv.c getinfo.c gopher.c gtls.c hash.c hmac.c hostares.c hostasyn.c hostip4.c hostip6.c hostip.c hostsyn.c hostthre.c http.c h
6、ttp_chunks.c http_digest.c http_negotiate.c http_negotiate_sspi.c http_ntlm.c idn_win32.c if2ip.c imap.c inet_ntop.c inet_pton.c krb4.c krb5.c ldap.c llist.c md4.c md5.c memdebug.c mprintf.c multi.c netrc.c nonblock.c nss.c openldap.c parsedate.c pingpong.c polarssl.c pop3.c progress.c qssl.c rawstr
7、.c rtsp.c security.c select.c sendf.c share.c slist.c smtp.c socks.c socks_gssapi.c socks_sspi.c speedcheck.c splay.c ssh.c sslgen.c ssluse.c strdup.c strequal.c strerror.c strtok.c strtoofft.c telnet.c tftp.c timeval.c transfer.c url.c version.c warnless.c wildcard.c LOCAL_CFLAGS += $(common_CFLAGS
8、)LOCAL_C_INCLUDES += $(LOCAL_PATH)/include/LOCAL_MODULE:= curjniinclude $(BUILD_SHARED_LIBRARY)5 cur_config.h/* 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_L
9、IBCURL */* 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 CUR
10、L_DISABLE_DICT */* to disable FILE */* #undef CURL_DISABLE_FILE */* to disable FTP */* #undef CURL_DISABLE_FTP */* to disable Gopher */* #undef CURL_DISABLE_GOPHER */* to disable HTTP */* #undef CURL_DISABLE_HTTP */* to disable IMAP */* #undef CURL_DISABLE_IMAP */* to disable LDAP */* #undef CURL_DI
11、SABLE_LDAP */#define CURL_DISABLE_LDAP 1/* to disable LDAPS */* #undef CURL_DISABLE_LDAPS */* to disable POP3 */* #undef CURL_DISABLE_POP3 */* to disable proxies */* #undef CURL_DISABLE_PROXY */* to disable RTSP */* #undef CURL_DISABLE_RTSP */* to disable SMTP */* #undef CURL_DISABLE_SMTP */* to dis
12、able TELNET */* #undef CURL_DISABLE_TELNET */* to disable TFTP */* #undef CURL_DISABLE_TFTP */* to disable TLS-SRP authentication */* #undef CURL_DISABLE_TLS_SRP */* to disable verbose strings */* #undef CURL_DISABLE_VERBOSE_STRINGS */* to make a symbol visible */* #undef CURL_EXTERN_SYMBOL */* to e
13、nable hidden symbols */* #undef CURL_HIDDEN_SYMBOLS */* Use Windows 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 */*
14、#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 int/* Define to the type of arg 7 for getnameinfo
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1