android-haskell-activity
android-haskell-activity copied to clipboard
Specify that ~/.ghc/android-host/bin's ghc must be first on the path
I wrestled with this for a couple of days trying to work out why HaskellActivity.cabal was causing incompatible options to ld (-Wl,-r emanating from the bowels of GHC, and -lopt-shared from the cabal file) and trying to make it go (add -shared to ghc-options, then link HSrts and Cffi, finally wrestling with trying to dynamically link modp from gnustl_shared.)
I ultimately realized my (perhaps obvious, in hindsight?) mistake: I was using some random ghc; putting ~/.ghc/android-host/bin first on my path and everything went swimmingly.
It would be nice if the instructions were me-proof.
I guess I should mention in the ghc-android docs that you should have the android-host ghc compiler as you default ghc when using the cross compilers. The way ghc-android installs things should be cleaned up in general.
I cloned android-haskell-activity again, and despite having the path set up this time, I encountered this error again:
[exec] /home/dpc/.ghc/android-14/x86-4.7/bin/../lib/gcc/i686-linux-android/4.7/../../../../i686-linux-android/bin/ld:
fatal error: -shared and -r are incompatible
ant is annoying because it doesn't really understand dependencies. So it seems by continually messing with build options and rebuilding I was able to get to a working state.
It seems voodoo which works again is to edit HaskellActivity.cabal and build once with ghc-options minus -optl-shared plus -shared and no cc-options: -shared or ld-options: shared; then restore the HaskellActivity.cabal and rebuild. For whatever reason ghc doesn't pass -Wl,-r this second time.
I ran into this issue today: /home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.gold: fatal error: -shared and -r are incompatible
I was doing arm-linux-androideabi-cabal build
.