File: comment_3_5dca47a4599d6e88d19193701c5a571b._comment

package info (click to toggle)
git-annex 10.20250721-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 74,484 kB
  • sloc: haskell: 90,982; javascript: 9,103; sh: 1,469; makefile: 213; perl: 137; ansic: 44
file content (46 lines) | stat: -rw-r--r-- 1,794 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
[[!comment format=mdwn
 username="https://www.google.com/accounts/o8/id?id=AItOawlhIMPGF1E0XEJKV6j6-PFzAxA1-nIlydo"
 nickname="Bernhard"
 subject="GHC and Android"
 date="2012-09-10T21:58:28Z"
 content="""
I played around a bit with GHC and Android today. It isn't really a result, but maybe useful for someone out there.

I have a Debian `chroot` environment on my Android device (howto: <http://www.saurik.com/id/10/>). In the Debian box:

    $ cat arm.hs
    main = do
      putStrLn \"Hello ARM\"
    $ ghc -static --make arm.hs
    Linking arm ...
    $ ldd arm
	libgmp.so.3 => /usr/lib/libgmp.so.3 (0x40233000)
	libm.so.6 => /lib/libm.so.6 (0x400c8000)
	libffi.so.5 => /usr/lib/libffi.so.5 (0x401b1000)
	librt.so.1 => /lib/librt.so.1 (0x40171000)
	libdl.so.2 => /lib/libdl.so.2 (0x40180000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4018b000)
	libc.so.6 => /lib/libc.so.6 (0x40282000)
	/lib/ld-linux.so.3 (0x400a2000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x4007e000)

well, that isn't really static. tell the linker to build a static binary (those are arguments to `ld`):

    $ ghc --make arm.hs -optl-static -optl-pthread
    [1 of 1] Compiling Main             ( arm.hs, arm.o )
    Linking arm ...
    $ file arm
    arm: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.18, not stripped
    $ ldd arm
    	not a dynamic executable
    $ ./arm
    Hello ARM

now, get this (quite big) binary into the normal android environment, using `adb`, `SSHDroid` or whatever:

    % cd /data/local/tmp # assuming destination of file transfer
    % ./arm
    arm: mkTextEncoding: invalid argument (Invalid argument)

looking in the source of `System.IO` it seems like an `iconv` issue. So, there's still some dynamic dependency in there... *sigh*
"""]]