sseefried / docker-build-ghc-android

A Dockerfile to build a GHC 7.8.3 ARM cross compiler for Android development
58 stars 13 forks source link

Example project structure. #5

Closed seanparsons closed 9 years ago

seanparsons commented 9 years ago

While this docker image gets people a few steps forward, it would be useful to provide a sample project that people can use to springboard off into their own work.

sseefried commented 9 years ago

Hi Sean,

That's a great idea. I'll try to add soon.

Sean

On 25 January 2015 at 08:39, Sean Parsons notifications@github.com wrote:

While this docker image gets people a few steps forward, it would be useful to provide a sample project that people can use to springboard off into their own work.

— Reply to this email directly or view it on GitHub https://github.com/sseefried/docker-build-ghc-android/issues/5.

seanparsons commented 9 years ago

Any thoughts on this? If you've got any starting points I'll be happy to give them a bash.

sseefried commented 9 years ago

Perhaps just a very simple Hello World app would be good first. They can "adb shell" in and see that it is working.

But in the long run I suppose it would be nice to have some kind of app. The question then becomes, is this going to be a Java app? To tell the truth the only app I have built for so far is a native SDL app (with a small Java shim) but I think that's too complicated for a newbie.

Perhaps we could try using this? https://github.com/neurocyte/android-haskell-activity

What are your thoughts?

seanparsons commented 9 years ago

I wasn't sure about that because of the need to install the foreign-jni package and the like which seems like an unnecessary faff.

sseefried commented 9 years ago

Yes, I was a bit worried about that too. I expect, however, that some people would really like to see a proper application. What about a simple OpenGL graphic effect or the like? Could probably do that by calling Haskell from a small Java program, but write the OpenGL effect in Haskell.

seanparsons commented 9 years ago

That would be perfect.

seanparsons commented 9 years ago

How about this as a starting point for the code? http://dpwright.com/posts/2015/03/25/the-haskell-gl-package/

johnjelinek commented 9 years ago

@sseefried: I built your docker image last night and this morning I wanted to give it a try. From initial research, I found the same https://github.com/neurocyte/android-haskell-activity app you mentioned above. I'd really like to start with this app, but as @seanparsons mentioned, it requires foreign-jni, which I've had some trouble building:

androidbuilder@012b479ea572:~/foreign-jni$ ~/.ghc/android-14/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-cabal update
Downloading the latest package list from hackage.haskell.org
androidbuilder@012b479ea572:~/foreign-jni$ ~/.ghc/android-14/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-cabal install
Resolving dependencies...
Downloading text-1.2.0.4...
Downloading transformers-0.4.3.0...
Configuring transformers-0.4.3.0...
Configuring text-1.2.0.4...
Failed to install transformers-0.4.3.0
Build log ( /home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/.cabal/logs/transformers-0.4.3.0.log ):
/home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/cabal/setup-exe-cache/setup-Simple-Cabal-1.18.1.3-arm-linux-android-ghc-7.8.3: 1: /home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/cabal/setup-exe-cache/setup-Simple-Cabal-1.18.1.3-arm-linux-android-ghc-7.8.3: Syntax error: word unexpected (expecting ")")
[1 of 1] Compiling Main             ( /tmp/transformers-0.4.3.0-343/transformers-0.4.3.0/dist/setup/setup.hs, /tmp/transformers-0.4.3.0-343/transformers-0.4.3.0/dist/setup/Main.o )
Linking /tmp/transformers-0.4.3.0-343/transformers-0.4.3.0/dist/setup/setup ...
Failed to install text-1.2.0.4
Build log ( /home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/.cabal/logs/text-1.2.0.4.log ):
/home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/cabal/setup-exe-cache/setup-Simple-Cabal-1.18.1.3-arm-linux-android-ghc-7.8.3: 1: /home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/cabal/setup-exe-cache/setup-Simple-Cabal-1.18.1.3-arm-linux-android-ghc-7.8.3: Syntax error: word unexpected (expecting ")")
cabal: Error: some packages failed to install:
foreign-jni-0.1.0.0 depends on text-1.2.0.4 which failed to install.
mtl-2.2.1 depends on transformers-0.4.3.0 which failed to install.
text-1.2.0.4 failed during the configure step. The exception was:
ExitFailure 2
transformers-0.4.3.0 failed during the configure step. The exception was:
ExitFailure 2

I think it'd be valuable to make a new tag/branch of the docker container with whatever java requirements are necessary to get that going. If you'd like, I can try to extend it with a JDK and adding some env variables like JAVA_HOME if you think it'll be helpful.

sseefried commented 9 years ago

@johnjelinek, sorry for being so tardy on this issue.

The problem is the line

jobs: $ncpus

in /home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/.cabal/config

sseefried commented 9 years ago

Fixed in https://github.com/sseefried/docker-build-ghc-android/commit/e136d7f9063f65ef74145abce000df28addca785

sseefried commented 9 years ago

There is now a project built on top of this that builds a simple Android game.

https://github.com/sseefried/docker-epidemic-build-env

seanparsons commented 9 years ago

@sseefried You sir are a champion!

sseefried commented 9 years ago

Thanks :-) It's taken a while to get all this working, but it was worth it. Please let me know how you go building it.