clibs / uv

A clib pointer to libuv: Cross-platform asychronous I/O http://libuv.org/
46 stars 8 forks source link

Compilation using Android NDK #2

Closed julien33 closed 9 years ago

julien33 commented 9 years ago

When using the android NDK with intel target, in src/unix/fs.c, the function uv__to_stat don't have the right parameters in struct stat* src.

I don't know if there is a specific #define ANDROID but the stat structure is as follow (NDK platform API>=9)

dst->st_atim.tv_sec = src->st_atime; dst->st_atim.tv_nsec = src->st_atime_nsec; dst->st_mtim.tv_sec = src->st_mtime; dst->st_mtim.tv_nsec = src->st_mtime_nsec; dst->st_ctim.tv_sec = src->st_ctime; dst->st_ctim.tv_nsec = src->st_ctime_nsec;

currently it goes through the following code : (line 686)

elif defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || defined(_XOPEN_SOURCE)

dst->st_atim.tv_sec = src->st_atim.tv_sec; dst->st_atim.tv_nsec = src->st_atim.tv_nsec; dst->st_mtim.tv_sec = src->st_mtim.tv_sec; dst->st_mtim.tv_nsec = src->st_mtim.tv_nsec; dst->st_ctim.tv_sec = src->st_ctim.tv_sec; dst->st_ctim.tv_nsec = src->st_ctim.tv_nsec;

By the way, I used android-configure setup script for ARM as a reference and changed it to intel :

!/bin/bash

export TOOLCHAIN=$PWD/android-toolchain mkdir -p $TOOLCHAIN $1/build/tools/make-standalone-toolchain.sh \ --toolchain=x86-4.8 \ --arch=x86 \ --install-dir=$TOOLCHAIN \ --platform=android-9 export PATH=$TOOLCHAIN/bin:$PATH export AR=i686-linux-android-ar export CC=i686-linux-android-gcc export CXX=i686-linux-android-g++ export LINK=i686-linux-android-g++

./configure \ --without-snapshot \ --dest-cpu=ia32 \ --dest-os=android

mv $TOOLCHAIN/bin/python2.7 $TOOLCHAIN/bin/oldpython2.7 ln -s /usr/bin/python2.7 $TOOLCHAIN/python2.7

jwerle commented 9 years ago

You should probably propagate this issue upstream to https://github.com/libuv/libuv

julien33 commented 9 years ago

Thank you, I just copied the issue to libuv/libuv, do we need to close it here ?

jwerle commented 9 years ago

Link the issue here. When it is resolved we'll update this downstream.

julien33 commented 9 years ago

Here is the equivalent issue opened in libuv/libuv : https://github.com/libuv/libuv/issues/252

julien33 commented 9 years ago

issue resolved and commited in libuv/libuv : https://github.com/libuv/libuv/commit/ae6b590fef74cd9cd17875d239f0f7f9170529d3

jwerle commented 9 years ago

I've updated this upstream. Thanks