Skip to content

cannot build cURL for android NDK. Error couldn't find libraries for gethostbyname() #27

@jonnyenglish207

Description

@jonnyenglish207

My enveronment:
System OS: mac lion 10.8.4
NDK: android-ndk-r9
CURL: curl-7.31.0

I tried to build for android but it not successful.
Please check this help me.

Thanks.
Jonny.

build-all.sh
export PATH=${TMPDIR}/droidtoolchains/${PLATFORM}/${PLATFORM}/bin:$PATH

echo "Build minizip"
${TOPDIR}/build-droid/build-minizip.sh > "${LOGPATH}-minizip.log"

echo "Build icu"
${TOPDIR}/build-droid/build-icu.sh > "${LOGPATH}-icu.log"

echo "Build c-ares"
${TOPDIR}/build-droid/build-cares.sh > "${LOGPATH}-cares.log"

echo "Build bzip2"
${TOPDIR}/build-droid/build-bzip2.sh > "${LOGPATH}-bzip2.log"

echo "Build libidn (before curl and gsasl)"
${TOPDIR}/build-droid/build-libidn.sh > "${LOGPATH}-libidn.log"

echo "Build OpenSSL"
${TOPDIR}/build-droid/build-openssl.sh > "${LOGPATH}-OpenSSL.log"

# Build libssh2
# ${TOPDIR}/build-droid/build-libssh2.sh > "${LOGPATH}-libssh2.log"

echo "Build cURL"
${TOPDIR}/build-droid/build-cURL.sh > "${LOGPATH}-cURL.log"

build-cURL.sh

DROID_GCC_LIBS=${TMPDIR}/droidtoolchains/${PLATFORM}/lib/gcc/arm-linux-androideabi/${TOOLCHAIN_VERSION}

export CC=${DROIDTOOLS}-gcc
export LD=${DROIDTOOLS}-ld
export CPP=${DROIDTOOLS}-cpp
export CXX=${DROIDTOOLS}-g++
export AR=${DROIDTOOLS}-ar
export AS=${DROIDTOOLS}-as
export NM=${DROIDTOOLS}-nm
export STRIP=${DROIDTOOLS}-strip
export CXXCPP=${DROIDTOOLS}-cpp
export RANLIB=${DROIDTOOLS}-ranlib

export LDFLAGS="-Os -fPIC -nostdlib -Wl,-rpath-link=${SYSROOT}/usr/lib -L${SYSROOT}/usr/lib -L${DROID_GCC_LIBS} -L${ROOTDIR}/lib"

export CFLAGS="-Os -pipe -isysroot ${SYSROOT}"
export CPPFLAGS="${CFLAGS} -I${ROOTDIR}/include -I${SYSROOT}/usr/include"
export CXXFLAGS="${CFLAGS} -I${ROOTDIR}/include -I${SYSROOT}/usr/include"

./configure --host=${PLATFORM} --target=${PLATFORM} --with-sysroot=${SYSROOT}/usr --prefix=${ROOTDIR} --with-zlib=${ROOTDIR} --with-ssl=${ROOTDIR} --with-libidn=${ROOTDIR} --enable-ares=${ROOTDIR} --with-random=/dev/urandom --enable-optimize --enable-nonblocking --disable-ares --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp --disable-gopher --disable-sspi --disable-ipv6 --disable-soname-bump --without-polarssl --without-gnutls --without-cyassl --without-axtls --without-libssh2 --disable-manual --disable-verbose --disable-shared

//============================================================
THIS IS LOG ERROR:

FILE: arm-linux-androideabi-cURL.log

checking if X/Open network library is required... no
checking for gethostbyname... no
checking for gethostbyname in -lnsl... no
checking for gethostbyname in -lsocket... no
checking for gethostbyname in -lwatt... no
checking for gethostbyname with both nsl and socket libs... no
checking for gethostbyname for Minix 3... no
checking for gethostbyname for eCos... no
checking for gethostbyname in -lnetwork... no
checking for gethostbyname in -lnet... no

FILE: config.log

/* confdefs.h */

define PACKAGE_NAME "curl"

define PACKAGE_TARNAME "curl"

define PACKAGE_VERSION "-"

define PACKAGE_STRING "curl -"

define PACKAGE_BUGREPORT "a suitable curl mailing list: http://curl.haxx.se/mail/"

define PACKAGE_URL ""

define PACKAGE "curl"

define VERSION "-"

define OS "arm-unknown-linux-androideabi"

define HAVE_SYS_TYPES_H 1

define HAVE_STDINT_H 1

define HAVE_INTTYPES_H 1

define STDC_HEADERS 1

define HAVE_SYS_TYPES_H 1

define HAVE_SYS_STAT_H 1

define HAVE_STDLIB_H 1

define HAVE_STRING_H 1

define HAVE_MEMORY_H 1

define HAVE_STRINGS_H 1

define HAVE_INTTYPES_H 1

define HAVE_STDINT_H 1

define HAVE_UNISTD_H 1

define SIZEOF_LONG 4

define SIZEOF_VOIDP 4

define CURL_PULL_SYS_TYPES_H 1

define CURL_PULL_STDINT_H 1

define CURL_PULL_INTTYPES_H 1

define CURL_TYPEOF_CURL_OFF_T int64_t

define CURL_FORMAT_CURL_OFF_T "lld"

define CURL_FORMAT_CURL_OFF_TU "llu"

define CURL_FORMAT_OFF_T "%lld"

define CURL_SIZEOF_CURL_OFF_T 8

define CURL_SUFFIX_CURL_OFF_T LL

define CURL_SUFFIX_CURL_OFF_TU ULL

define HAVE_DLFCN_H 1

define LT_OBJDIR ".libs/"

define CURL_DISABLE_FTP 1

define CURL_DISABLE_LDAP 1

define CURL_DISABLE_LDAPS 1

define CURL_DISABLE_RTSP 1

define CURL_DISABLE_DICT 1

define CURL_DISABLE_TELNET 1

define CURL_DISABLE_TFTP 1

define CURL_DISABLE_POP3 1

define CURL_DISABLE_IMAP 1

define CURL_DISABLE_SMTP 1

define CURL_DISABLE_GOPHER 1

configure: exit 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions