On 12/02/13 4:25 AM, Jens Axboe wrote: > On Mon, Feb 11 2013, David N wrote: >> Hello Everyone, >> >> I've been trying to compile FIO for Android but keep getting error >> bellow. Can anybody give me any guidance please? >> >> I very much appreciate! >> >> David >> >> >> david@david-HP-ubuntu:~/development/android/external/fio-2.0.13$ make >> UNAME=Android CROSS_COMPILE=$CCOMPILER >> CC init.o >> init.c: In function ‘free_shm’: >> init.c:224:18: error: storage size of ‘sbuf’ isn’t known >> init.c:233:3: warning: implicit declaration of function ‘shmdt’ >> [-Wimplicit-function-declaration] >> init.c:234:3: warning: implicit declaration of function ‘shmctl’ >> [-Wimplicit-function-declaration] >> init.c:224:18: warning: unused variable ‘sbuf’ [-Wunused-variable] >> init.c: In function ‘setup_thread_area’: >> init.c:263:3: warning: implicit declaration of function ‘shmget’ >> [-Wimplicit-function-declaration] >> init.c:277:2: warning: implicit declaration of function ‘shmat’ >> [-Wimplicit-function-declaration] >> init.c:277:10: warning: assignment makes pointer from integer without >> a cast [enabled by default] >> make: *** [init.o] Error 1 > > Lets CC in Aaron, who added the port. The switch to configure broke Android. I got a very minimal build working with the attached patch and: make cross_prefix=~/dev/android-toolchain-r8c/bin/arm-linux-androideabi- UNAME=Android Hope that helps, -- Aaron
diff --git a/Makefile b/Makefile index 8a7410a..bb345ed 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,6 @@ ifeq ($(UNAME), Android) SOURCE += diskutil.c fifo.c blktrace.c trim.c profiles/tiobench.c LIBS += -ldl LDFLAGS += -rdynamic - CPPFLAGS += -DFIO_NO_HAVE_SHM_H endif ifeq ($(UNAME), SunOS) LIBS += -lpthread -ldl -laio -lrt -lnsl -lsocket diff --git a/configure b/configure index 87cc1cf..8267e1c 100755 --- a/configure +++ b/configure @@ -161,7 +161,9 @@ if test "$show_help" = "yes" ; then exit $exit_val fi -if check_define __linux__ ; then +if check_define __ANDROID__ ; then + targetos="Android" +elif check_define __linux__ ; then targetos="Linux" elif check_define __OpenBSD__ ; then targetos='OpenBSD' @@ -222,6 +224,15 @@ CYGWIN*) echo "CC=$CC" >> $config_host_mak echo "EXTFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak exit 0 + ;; +Android) + output_sym "CONFIG_32BIT" + output_sym "CONFIG_SOCKLEN_T" + output_sym "CONFIG_GETTIMEOFDAY" + output_sym "CONFIG_CLOCK_GETTIME" + echo "CC=$cc" >> $config_host_mak + echo "EXTFLAGS=$CFLAGS -include config-host.h -DFIO_NO_HAVE_SHM_H -D_GNU_SOURCE" >> $config_host_mak + exit 0 esac if test ! -z "$cpu" ; then diff --git a/os/os-android.h b/os/os-android.h index e436f8f..cedfdaf 100644 --- a/os/os-android.h +++ b/os/os-android.h @@ -30,6 +30,7 @@ #define FIO_USE_GENERIC_INIT_RANDOM_STATE #define FIO_HAVE_E4_ENG #define FIO_HAVE_BYTEORDER_FUNCS +#define FIO_HAVE_MMAP_HUGE #define OS_MAP_ANON MAP_ANONYMOUS