关于libcurl在各种平台上面的编译

31 篇文章 0 订阅
30 篇文章 1 订阅

How to compile libcurl

This document describes how to compile libcurl for Android, iOS and windows. The difficulty to compile libcurl is the parameters for configuration.

You can download the source code from:
http://curl.haxx.se/download.html

The document bases on version 7.21.4.

1. Android

1.1 Configure

Place the curl source into external/curl/ in the Android source tree. Create a shell script configure.sh, and put it into external/curl/. The script content is:

#!/bin/sh
SDK_ROOT=/home/nudtzxm/android_sdk
export PATH="$SDK_ROOT/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin:$PATH"
./configure --host=arm-linux CC=arm-eabi-gcc \
CPPFLAGS="-I $SDK_ROOT/system/core/include 
         -I $SDK_ROOT/hardware/libhardware/include 
         -I $SDK_ROOT/hardware/libhardware_legacy/include   
         -I $SDK_ROOT/hardware/ril/include   
         -I $SDK_ROOT/dalvik/libnativehelper/include  
         -I $SDK_ROOT/frameworks/base/include   
         -I $SDK_ROOT/frameworks/base/opengl/include   
         -I $SDK_ROOT/external/skia/include   
         -I $SDK_ROOT/out/target/product/generic/obj/include 
         -I $SDK_ROOT/bionic/libc/arch-arm/include   
         -I $SDK_ROOT/bionic/libc/include   
         -I $SDK_ROOT/bionic/libstdc++/include   
         -I $SDK_ROOT/bionic/libc/kernel/common  
         -I $SDK_ROOT/bionic/libc/kernel/arch-arm   
         -I $SDK_ROOT/bionic/libm/include   
         -I $SDK_ROOT/bionic/libm/include/arch/arm   
         -I $SDK_ROOT/bionic/libthread_db/include   
         -I $SDK_ROOT/bionic/libc/kernel/common   
         -I $SDK_ROOT/bionic/libc/kernel/arch-arm  
         -I $SDK_ROOT/system/core/libcutils   
         -I $SDK_ROOT/out/target/product/generic/obj/STATIC_LIBRARIES/libcutils_intermediates  
         -I $SDK_ROOT/out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates 
         -I $SDK_ROOT/system/core/include/arch/linux-arm/ 
         -include $SDK_ROOT/system/core/include/arch/linux-arm/AndroidConfig.h" \
CFLAGS="-nostdlib -fno-exceptions -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums 
       -Wno-multichar -msoft-float -march=armv5te -mtune=xscale -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ 
       -mthumb-interwork -DANDROID -fmessage-length=0 
       -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Werror=return-type -Werror=non-virtual-dtor -Werror=address 
       -Werror=sequence-point -DSK_RELEASE -DNDEBUG -g -Wstrict-aliasing=2 -finline-functions 
       -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop 
       -frename-registers -DNDEBUG -UDEBUG -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64" \
LIBS="-L$SDK_ROOT/out/target/product/generic/obj/lib 
     -L$SDK_ROOT/out/target/product/generic/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a -lc -lm -ldl
     $SDK_ROOT/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/interwork/libgcc.a"

Goto the root of curl, and run the script:

1.2 Make

Goto the root of curl and make curl:

1.3 The parameters of configure

You may see the parameters of configuration are complex. How to set it? You should read the comments of curl/Android.mk.

2. iOS

I compile it as the article says:
http://www.creativealgorithms.com/blog/content/building-libcurl-ios-42
or
http://blog.sina.com.cn/s/blog\_673975590100qjuh.html (chinese)

I change the parameters of configure, so the configure command is:

./configure --disable-shared  --host=arm-apple-darwin10

3. Windows

Open the vc6curl.dsw and select “DLL Release” to build. You may find libcurl.dll and libcurl_imp.lib in the CURL_ROOT\lib\DLL-Release.

4. Mac Osx

    对于最近在mac下面编译curl源码,并在xcode中进行使用的过程,具体纪录在编译方法

   不过全部都是E文,可以锻炼我们的E文水平 呵呵


5. About the header files

The header files of curl/include can be only used after succesful configuration. And the header files are different on different platforms.

出自于  libcurl编译方法

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值