Open Guang1234567 opened 5 years ago
I think this Stack Overflow answer gives some good reasoning as to where this issue comes from: https://stackoverflow.com/a/38379405
@otherpeopleWantSupportAndroid16
ghc-8.6.5-20190531-armv7-linux-androideabi-ndk14-api16
base on ghc-v8.6.5-release
is here.
Just for fun, dont try it on product env.
BTW, ghc's rts
not link the android-16's stdlib ( comment by @angerman), so got above compile error:
../../../../hs-libs/armeabi-v7a/libhs.a(RtsFlags.o):rts/RtsFlags.c:function procRtsOpts: error: undefined reference to 'atof'
......
@Guang1234567 could you explain how you built that binary distribution?
@angerman
ENV: ndk14, mac OSX 10.1.4, llvm 5.0, ghc-8.6.5-release-sourcecode
first, read your blog, haha.
second, modify ANDROID_API=16
in toolchainwrapper
.
sysroot
cannot to assign to ${ANDROID_NDK} /sysroot
is important, must be depends on android-16's sysroot
ANDROID_API=16
--sysroot ${ANDROID_NDK}/platforms/android-${ANDROID_API}/arch-${ANDROID_ARM_ARCH}"
add -fPIC
to cflags in toolchainwrapper is also important.
@all
That haskell wiki
https://gitlab.haskell.org/ghc/ghc/wikis/arm64
maybe more detailed!
but remember if you want to support android api 16 at least:
1)
ANDROID_API=16
--sysroot ${ANDROID_NDK}/platforms/android-${ANDROID_API}/arch-${ANDROID_ARM_ARCH}"
2) -fPIC
cd $PROJDIR/ghc-8.0.0.20160111
./configure \
--target=aarch64-linux-android \
--with-gcc=$TOOLCHAIN/bin/aarch64-linux-android-gcc \
--with-clang=$TOOLCHAIN/bin/clang \
--with-ld=$TOOLCHAIN/bin/aarch64-linux-android-ld \
--with-ld.gold=$TOOLCHAIN/bin/aarch64-linux-android-ld.gold \
--with-nm=$TOOLCHAIN/bin/aarch64-linux-android-nm \
--with-objdump=$TOOLCHAIN/bin/aarch64-linux-android-objdump \
--with-ar=$TOOLCHAIN/bin/aarch64-linux-android-ar \
--with-ranlib=$TOOLCHAIN/bin/aarch64-linux-android-ranlib \
--with-llc=$TOOLCHAIN/bin/llc \
--with-opt=$TOOLCHAIN/bin/opt \
--prefix=$PROJDIR \
CONF_CC_OPTS_STAGE1="-fPIC -fPIE -pie" \
CONF_GCC_LINKER_OPTS_STAGE1="-fPIC -fPIE -pie" \
CONF_LD_LINKER_OPTS_STAGE1="-fPIC -fPIE -pie" \
CONF_CC_OPTS_STAGE2="-fPIC -fPIE -pie" \
CONF_GCC_LINKER_OPTS_STAGE2="-fPIC -fPIE -pie" \
CONF_LD_LINKER_OPTS_STAGE2="-fPIC -fPIE -pie"
Hello @angerman
Today, i modify this project to support at least 'android-16'.
then 1) modify the
toolchain-wrapper
's android version from 24 to 16 2) modifybuild-liviconv
script's android version from 24 to 16 and buildlibiconv
again. 3) buildlibhs.a
again 4) modifyapp/build.gradle
minSdkVersion to 16 5) compile appbut got a error :
which min android version is supported by prebuild-ghc in http://hackage.mobilehaskell.org ?
Should i compile ghc from source to support android-16 ?