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

来源:互联网 发布:农村淘宝真的能赚钱吗 编辑:程序博客网 时间:2024/06/06 05:30

How to compile libcurl

  • How to compile libcurl
    • 1. Android
      • 1.1 Configure
      • 1.2 Make
      • 1.3 The parameters of configure
    • 2. iOS
    • 3. Windows
    • 4. About the header files

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/shSDK_ROOT=/home/nudtzxm/android_sdkexport 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 0
原创粉丝点击