android - Error when compiling LibCurl under Ubuntu: zlib.h : no such file or directory -
i trying compile curl source code (version 7.22.0)under ubuntu 13.04 import libcurl android platform. android source code (version android-2.2_r1) has been compiled , environment compiling curl has been set successfully.
compiling environment:
android source code version: 2.2_r1 ndk version:android-ndk-r8e curl souce code version:7.22.0 gcc version:4.4.7 jdk version:1.5.0_21
the following configure command setting compiling environment libcurl:
android_home=/home/kevin/android-build/working-space && \ ndk_home=/home/kevin/software/android-ndk-r8e && \ path="$android_home/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/platforms/android-14/arch-arm/usr/include \ -i $android_home/external/curl/include/ \ -i $android_home/external/curl \ -i $android_home/out/target/product/generic/obj/static_libraries/libcurl_intermediates \ -i $android_home/dalvik/libnativehelper/include/nativehelper \ -i $android_home/system/core/include \ -i $android_home/hardware/libhardware/include \ -i $android_home/hardware/libhardware_legacy/include \ -i $android_home/hardware/ril/include \ -i $android_home/dalvik/libnativehelper/include \ -i $android_home/frameworks/base/include \ -i $android_home/frameworks/base/opengl/include \ -i $android_home/frameworks/base/native/include \ -i $android_home/external/skia/include \ -i $android_home/out/target/product/generic/obj/include \ -i $android_home/bionic/libc/arch-arm/include \ -i $android_home/bionic/libc/include \ -i $android_home/bionic/libstdc++/include \ -i $android_home/bionic/libc/kernel/common \ -i $android_home/bionic/libc/kernel/arch-arm \ -i $android_home/bionic/libm/include \ -i $android_home/bionic/libm/include/arch/arm \ -i $android_home/bionic/libthread_db/include \ -include $android_home/system/core/include/arch/linux-arm/androidconfig.h \ -i $android_home/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/build/core/armelf.x \ -wl,-dynamic-linker,/system/bin/linker -wl,--gc-sections -wl,-z,nocopyreloc \ -l$android_home/out/target/product/generic/obj/lib -wl,-z,noexecstack \ -wl,-rpath-link=$android_home/out/target/product/generic/obj/lib \ -lc -llog -lcutils -lstdc++ \ -wl,--no-undefined $android_home/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/libgcc.a \ $android_home/out/target/product/generic/obj/lib/crtend_android.o \ -lm $android_home/out/target/product/generic/obj/lib/crtbegin_dynamic.o"
after executing config command, can see following content config.log file under external/curl directory
configure:21303: checking zlib.h usability configure:21303: $? = 0 configure:21303: result: yes configure:21303: checking zlib.h presence configure:21303: $? = 0 configure:21303: result: yes configure:21303: checking zlib.h configure:21303: result: yes configure:21384: found both libz , libz.h header
i checked directory : $ndk_home/platforms/android-14/arch-arm/usr/include
, make sure zlib.h file exist there.
problem: when tried compile libcurl using commands make libcurl
, compliation fails. , error got is:
in file included external/curl/lib/base64.c:30: external/curl/lib/urldata.h:141:59: error: zlib.h: no such file or directory in file included external/curl/lib/base64.c:30: external/curl/lib/urldata.h:585: error: expected specifier-qualifier-list before 'z_stream'
it makes me upset since file exist , found @ configuration step.
solution attempt: tried add absolute path of zlib.h file in ndk_home android.mk file locates @ external/curl directory following.
local_c_includes += $(local_path)/include/ /home/kevin/software/android-ndk-r8e/platforms/android-14/arch-arm/usr/include
it turns out errors gone , compliation successful, when using curl library in program, following error happens:
/home/kevin/software/android-ndk-r8e/platforms/android-14/arch-arm/usr/lib/libcurl.a(content_encoding.o): in function curl_unencode_deflate_write:external/curl/lib/content_encoding.c:180: error: undefined reference 'inflateinit_'
anyone has same problem? appreciated.
looks missing -lz when building program.
Comments
Post a Comment