Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [Android] Help building TTF addon

This thread is locked; no one can reply to it. rss feed Print
[Android] Help building TTF addon
kenmasters1976
Member #8,794
July 2007

I'm trying to set up a standalone Android toolchain. I've managed to build the basic Allegro libs and it works fine in the Android emulator. However, when I try to use the TTF addon, the application always fails.

I can build the Freetype library just fine and then rebuild Allegro to generate the allegro_ttf library but every attempt at using it crashes the application.

I/allegro ( 2169): main     D 2183:         ex_android.c:103  main                             [   0.36421] Testing TTF addon
F/libc    ( 2169): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=128)
D/gralloc_ranchu( 1215): gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
W/NetworkManagementSocketTagger( 1215): setKernelCountSet(10021, 0) failed with errno -2
I/DEBUG   ( 1116): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   ( 1116): Build fingerprint: 'generic_x86/google_sdk_x86/generic_x86:4.0.4/MR1/3093080:eng/test-keys'
I/DEBUG   ( 1116): pid: 2169, tid: 2183  >>> com.example.AllegroTest <<<
I/DEBUG   ( 1116): signal 11 (SIGSEGV), code 128 (?), fault addr 00000000
I/DEBUG   ( 1116):  eax 00000000  ebx 9aaaf8b0  ecx 9aa96721  edx 0000004d
I/DEBUG   ( 1116):  esi 09c6c5a0  edi 09c8c220
I/DEBUG   ( 1116):  xcs 00000073  xds 0000007b  xes 0000007b  xfs 00000000 xss 0000007b
I/DEBUG   ( 1116):  eip 9aa39663  ebp 09cb01c8  esp 9a866614  flags 00010246
I/DEBUG   ( 1116):     #00  eip: 9aa39663  /data/data/com.example.AllegroTest/lib/liballegro_ttf-debug.so
I/DEBUG   ( 1116): stack: 
I/DEBUG   ( 1116):     #00  9a866614  09cc02c0  [heap]
I/DEBUG   ( 1116):     #00  9a866618  09c8c218  [heap]
I/DEBUG   ( 1116):     #00  9a86661c  09c8c540  [heap]
I/DEBUG   ( 1116):     #00  9a866620  09cb01c8  [heap]
I/DEBUG   ( 1116):     #00  9a866624  0000000d  
I/DEBUG   ( 1116):     #00  9a866628  00000000  
I/DEBUG   ( 1116):     #00  9a86662c  9a86667c  [stack:2183]
I/DEBUG   ( 1116):     #00  9a866630  b772c654  /system/lib/libc.so
I/DEBUG   ( 1116):     #00  9a866634  09c8cd78  [heap]
I/DEBUG   ( 1116):     #00  9a866638  09cb0938  [heap]
I/DEBUG   ( 1116):     #00  9a86663c  9aab20a4  /data/data/com.example.AllegroTest/lib/liballegro_ttf-debug.so
I/DEBUG   ( 1116):     #00  9a866640  b76c1a77  /system/lib/libc.so (dlmalloc)
I/DEBUG   ( 1116):     #00  9a866644  b772dc18  /system/lib/libc.so (dlmalloc)
I/DEBUG   ( 1116):     #00  9a866648  09cb6198  [heap] (dlmalloc)
I/DEBUG   ( 1116):     #00  9a86664c  9a86669c  [stack:2183] (dlmalloc)
I/DEBUG   ( 1116):     #00  9a866650  b76c25db  /system/lib/libc.so (dlfree)
I/DEBUG   ( 1116):     ......  ......  
W/InputDispatcher( 1215): channel 'a0e64ad8 com.example.AllegroTest/com.example.AllegroTest.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x8

I have no idea what I'm doing wrong. Any help appreciated.

[EDIT:] Nevermind, it seems the problem was caused because I forgot to define the CFLAGS and LDFLAGS environment variables:

export CFLAGS="-fPIE -fPIC"
export LDFLAGS="-pie"

After setting these I got the addon to build and work correctly.

Thanks.

Go to: