当前位置:操作系统 > 安卓/Android >>

android -- libcurl移植、编译与测试

 
 
 
1、移植Curl工具到Android 2.3 环境步骤
 
   1、直接到网站上下载 curl 源码
 
   2、利用tar在android编译环境下,一般放在 external 目录下
 
   3、由于Curl依赖一些一些头文件及定义需要先执行配置文件先,在external/curl 下面编译curl.sh
 
      需要 cd external/curl/.curl.sh进行执行,或者放在android根目录下的*.sh脚本中执行:source external/curl/curl.sh
 
      其中修改了相应的CURL路径及编译工具链路径等变量
 
[cpp]  
#!/bin/bash   
  
ANDROID_HOME_CURL=../../ && \  
NDK_HOME_CURL=../../ndk && \  
PATH="$ANDROID_HOME_CURL/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin:$PATH" \  
./configure --host=arm-linux CC=arm-eabi-gcc --with-random=/dev/urandom \  
CPPFLAGS="-I$NDK_HOME_CURL/platforms/android-8/arch-arm/usr/include \  
-I $ANDROID_HOME_CURL/external/curl/include/  \  
-I $ANDROID_HOME_CURL/external/curl/3rd/include   \  
-I $ANDROID_HOME_CURL/external/curl   \  
-I $ANDROID_HOME_CURL/out/target/product/generic/obj/STATIC_LIBRARIES/libcurl_intermediates   \  
-I $ANDROID_HOME_CURL/dalvik/libnativehelper/include/nativehelper   \  
-I $ANDROID_HOME_CURL/system/core/include   \  
-I $ANDROID_HOME_CURL/hardware/libhardware/include   \  
-I $ANDROID_HOME_CURL/hardware/libhardware_legacy/include   \  
-I $ANDROID_HOME_CURL/hardware/ril/include   \  
-I $ANDROID_HOME_CURL/dalvik/libnativehelper/include   \  
-I $ANDROID_HOME_CURL/frameworks/base/include   \  
-I $ANDROID_HOME_CURL/frameworks/base/opengl/include   \  
-I $ANDROID_HOME_CURL/frameworks/base/native/include   \  
-I $ANDROID_HOME_CURL/external/skia/include   \  
-I $ANDROID_HOME_CURL/out/target/product/generic/obj/include   \  
-I $ANDROID_HOME_CURL/bionic/libc/arch-arm/include   \  
-I $ANDROID_HOME_CURL/bionic/libc/include   \  
-I $ANDROID_HOME_CURL/bionic/libstdc++/include   \  
-I $ANDROID_HOME_CURL/bionic/libc/kernel/common   \  
-I $ANDROID_HOME_CURL/bionic/libc/kernel/arch-arm   \  
-I $ANDROID_HOME_CURL/bionic/libm/include   \  
-I $ANDROID_HOME_CURL/bionic/libm/include/arch/arm   \  
-I $ANDROID_HOME_CURL/bionic/libthread_db/include \  
-include $ANDROID_HOME_CURL/system/core/include/arch/linux-arm/AndroidConfig.h \  
-I $ANDROID_HOME_CURL/system/core/include/arch/linux-arm/ \  
-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -DNDEBUG -DNDEBUG -DHAVE_CONFIG_H" \  
CFLAGS="-fno-exceptions -Wno-multichar -msoft-float -fpic -ffunction-sections \  
-funwind-tables -fstack-protector -Wa,--noexecstack -Werror=format-security \  
-fno-short-enums -march=armv5te -mtune=xscale  -Wno-psabi -mthumb-interwork  \  
-fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith \  
-Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point  \  
-g -Wstrict-aliasing=2 -finline-functions -fno-inline-functions-called-once \  
-fgcse-after-reload -frerun-cse-after-loop -frename-registers  -UDEBUG \  
-mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64   \  
-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"  \  
LIBS="-nostdlib -Bdynamic -Wl,-T,$ANDROID_HOME_CURL/build/core/armelf.x \  
-Wl,-dynamic-linker,/system/bin/linker -Wl,--gc-sections -Wl,-z,nocopyreloc \  
-L$ANDROID_HOME_CURL/out/target/product/generic/obj/lib -Wl,-z,noexecstack \  
-Wl,-rpath-link=$ANDROID_HOME_CURL/out/target/product/generic/obj/lib \  
-lc -llog -lcutils -lstdc++ \  
-Wl,--no-undefined $ANDROID_HOME_CURL/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/libgcc.a  \  
$ANDROID_HOME_CURL/out/target/product/generic/obj/lib/crtend_android.o \  
-lm $ANDROID_HOME_CURL/out/target/product/generic/obj/lib/crtbegin_dynamic.o \  
-L$ANDROID_HOME_CURL/external/curl/3rd/libs"  
 
#!/bin/bash
 
ANDROID_HOME_CURL=../../ && \
NDK_HOME_CURL=../../ndk && \
PATH="$ANDROID_HOME_CURL/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin:$PATH" \
./configure --host=arm-linux CC=arm-eabi-gcc --with-random=/dev/urandom \
CPPFLAGS="-I$NDK_HOME_CURL/platforms/android-8/arch-arm/usr/include \
-I $ANDROID_HOME_CURL/external/curl/include/  \
-I $ANDROID_HOME_CURL/external/curl/3rd/include   \
-I $ANDROID_HOME_CURL/external/curl   \
-I $ANDROID_HOME_CURL/out/target/product/generic/obj/STATIC_LIBRARIES/libcurl_intermediates   \
-I $ANDROID_HOME_CURL/dalvik/libnativehelper/include/nativehelper   \
-I $ANDROID_HOME_CURL/system/core/include   \
-I $ANDROID_HOME_CURL/hardware/libhardware/include   \
-I $ANDROID_HOME_CURL/hardware/libhardware_legacy/include   \
-I $ANDROID_HOME_CURL/hardware/ril/include   \
-I $ANDROID_HOME_CURL/dalvik/libnativehelper/include   \
-I $ANDROID_HOME_CURL/frameworks/base/include   \
-I $ANDROID_HOME_CURL/frameworks/base/opengl/include   \
-I $ANDROID_HOME_CURL/frameworks/base/native/include   \
-I $ANDROID_HOME_CURL/external/skia/include   \
-I $ANDROID_HOME_CURL/out/target/product/generic/obj/include   \
-I $ANDROID_HOME_CURL/bionic/libc/arch-arm/include   \
-I $ANDROID_HOME_CURL/bionic/libc/include   \
-I $ANDROID_HOME_CURL/bionic/libstdc++/include   \
-I $ANDROID_HOME_CURL/bionic/libc/kernel/common   \
-I $ANDROID_HOME_CURL/bionic/libc/kernel/arch-arm   \
-I $ANDROID_HOME_CURL/bionic/libm/include   \
-I $ANDROID_HOME_CURL/bionic/libm/include/arch/arm   \
-I $ANDROID_HOME_CURL/bionic/libthread_db/include \
-include $ANDROID_HOME_CURL/system/core/include/arch/linux-arm/AndroidConfig.h \
-I $ANDROID_HOME_CURL/system/core/include/arch/linux-arm/ \
-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -DNDEBUG -DNDEBUG -DHAVE_CONFIG_H" \
CFLAGS="-fno-exceptions -Wno-multichar -msoft-float -fpic -ffunction-sections \
-funwind-tables -fstack-protector -Wa,--noexecstack -Werror=format-security \
-fno-short-enums -march=armv5te -mtune=xscale  -Wno-psabi -mthumb-interwork  \
-fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith \
-Werror=return
补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,