Nathan Hüsken | 11 Jan 12:36 2013
Picon

Building on android - compiled program segfaults

Hi,

I was succesfull in building ghc (pulled from git) to compile for
arm-linux-androideabi!

Now using "inplace/bin/ghc-stage1 -dcore-lint -debug" I compiler this
Main.hs:

main = putStrLn "Hello, World"

I get an executable, which I can run on my android device. Unfortantly
it segfaults.

Running it with ./Main +RTS -DS gives:

cap 0: initialised

Now I am trying to debug this in gdb. When I try to display the stack
(which should be in r13 on arm of I understand correctly, I get);

(gdb) p8 $r13
0xbef00a74:	0x0
0xbef00a70:	0x0
0xbef00a6c:	0x3c2e74
0xbef00a68:	0x530350
0xbef00a64:	0x0
0xbef00a60:	0x0
0xbef00a5c:	0x0
0xbef00a58:	0x0

(Continue reading)

Bernhard Urban | 13 Jan 11:16 2013
Picon

Re: Building on android - compiled program segfaults

Hi Nathan,

On Fri, Jan 11, 2013 at 12:36 PM, Nathan Hüsken
<nathan.huesken <at> posteo.de> wrote:
> I was succesfull in building ghc (pulled from git) to compile for
> arm-linux-androideabi!

Great news!
Can you describe how you managed to build it and which environment you use?

> main = putStrLn "Hello, World"
>
> I get an executable, which I can run on my android device. Unfortantly
> it segfaults.

just a random idea, does
  main = error "Hello, World"
work?

Thanks,
Bernhard
Nathan Hüsken | 13 Jan 16:22 2013
Picon

Re: Building on android - compiled program segfaults

There is some more success :).
When I do an unregisterised build, it works without segfault.

On 01/13/2013 11:16 AM, Bernhard Urban wrote:
> Hi Nathan,
> 
> On Fri, Jan 11, 2013 at 12:36 PM, Nathan Hüsken
> <nathan.huesken <at> posteo.de> wrote:
>> I was succesfull in building ghc (pulled from git) to compile for
>> arm-linux-androideabi!
> 
> Great news!
> Can you describe how you managed to build it and which environment you use?

I am on ubuntu 64  bit.
I am planing to share the information in a blog post, but I will wait if
I (or someone else) gets the registerised build to work.

I made a short writedown of the steps it took here:
https://github.com/RudolfVonKrugstein/jshaskell-blog/blob/master/android_ghc/android_ghc.md

Regards,
Nathan
Conrad Parker | 13 Jan 12:56 2013

Re: Building on android - compiled program segfaults

On 11 January 2013 19:36, Nathan Hüsken <nathan.huesken <at> posteo.de> wrote:
> Hi,
>
> I was succesfull in building ghc (pulled from git) to compile for
> arm-linux-androideabi!
>
> Now using "inplace/bin/ghc-stage1 -dcore-lint -debug" I compiler this
> Main.hs:
>
> main = putStrLn "Hello, World"
>
> I get an executable, which I can run on my android device. Unfortantly
> it segfaults.
>
> Running it with ./Main +RTS -DS gives:
>
> cap 0: initialised
>
> Now I am trying to debug this in gdb. When I try to display the stack
> (which should be in r13 on arm of I understand correctly, I get);
>
> (gdb) p8 $r13
> 0xbef00a74:     0x0
> 0xbef00a70:     0x0
> 0xbef00a6c:     0x3c2e74
> 0xbef00a68:     0x530350
> 0xbef00a64:     0x0
> 0xbef00a60:     0x0
> 0xbef00a5c:     0x0
> 0xbef00a58:     0x0
(Continue reading)

Nathan Hüsken | 13 Jan 16:31 2013
Picon

Re: Building on android - compiled program segfaults

Mmh, that does not seem to work.

(gdb) strace
warning: Couldn't determine the static tracepoint marker to probe
Static tracepoint 1 at 0x3f0588

On 01/13/2013 12:56 PM, Conrad Parker wrote:
> On 11 January 2013 19:36, Nathan Hüsken <nathan.huesken <at> posteo.de> wrote:
>> Hi,
>>
>> I was succesfull in building ghc (pulled from git) to compile for
>> arm-linux-androideabi!
>>
>> Now using "inplace/bin/ghc-stage1 -dcore-lint -debug" I compiler this
>> Main.hs:
>>
>> main = putStrLn "Hello, World"
>>
>> I get an executable, which I can run on my android device. Unfortantly
>> it segfaults.
>>
>> Running it with ./Main +RTS -DS gives:
>>
>> cap 0: initialised
>>
>> Now I am trying to debug this in gdb. When I try to display the stack
>> (which should be in r13 on arm of I understand correctly, I get);
>>
>> (gdb) p8 $r13
>> 0xbef00a74:     0x0
(Continue reading)


Gmane