Mon 05 Nov 2012 04:53:42 PM UTC, original submission:
Hi,
I'm trying to cross compile FreeType 2.4.10 and run it with Cairo 1.10.2 on Android as static libraries. I set up a program that loads a ttf font from file to memory, calls "FT_New_Memory_Face" and passes the FT_Face to "cairo_ft_font_face_create_for_ft_face". The SIGSEGV happens after any text rendering call in Cairo (i.e. "cairo_show_text"). Cairo works fine if I don't pass any FT fonts (use default font).
At first it looked like "tt_cmap4_char_map_binary" was to blame. I disabled "cmap4" functions in "ftoptions.h" and it started to crash in other places (interpreter, get_glyph...). I finally noticed that the crashes always happened on TT_PEEK_USHORT or FT_PEEK_USHORT. I tried running it on other phones (HTC Explorer with Android 2.3, HTC HD2 with Android 2.3 and Nexus with Android 4.0). Funny thing is it worked only on HTC Explorer, other SIGSEGVed exactly the same way.
I've been trying to debug the issue for few days now, no success so far. Here are the details:
Host:
Ubuntu Release 12.04 (precise) 32-bit
Kernel Linux 3.2.0-32-generic-pae
Processor: AMD E-450 APU with Radeon(tm) HD Graphics × 2
Target:
Galaxu Nexus running Android 4.1.2
Toolchain:
CMake and CMake for Android
NDK version r8b, standalone toolchain (using GCC 4.6)
./configure ran with options:
--enable-static=yes --enable-shared=yes --prefix=$AND_SYSROOT/usr
Tried to compile with and without these flags:
-mandroid
-mfloat-abi=soft OR -mfloat-abi=softfp
-msoft-float
-mfpu=neon
-march=armv5 OR -march=armv7-a
-Wl,--fix-cortex-a8
-fno-strict-aliasing
-g
-O0
-ggdb
-fPIC
-DPIC
Stacktrace:
#0 0x5d405ebc in tt_cmap4_char_map_binary (cmap=0x59e29f40, pcharcode=0x5d7a0440, next=0 '\000') at /home/user/Desktop/Projects/freetype-2.4.10/src/sfnt/ttcmap.c:1097
#1 0x5d406a04 in tt_cmap4_char_index (cmap=0x59e29f40, char_code=83) at /home/user/Desktop/Projects/freetype-2.4.10/src/sfnt/ttcmap.c:1329
#2 0x5d3b5700 in FT_Get_Char_Index (face=0x5c52e610, charcode=83) at /home/user/Desktop/Projects/freetype-2.4.10/src/base/ftobjs.c:3306
#3 0x5d395ce8 in _cairo_ft_ucs4_to_index (abstract_font=0x5c7b8c08, ucs4=83) at cairo-ft-font.c:2354
#4 0x5d376098 in cairo_scaled_font_text_to_glyphs_internal_uncached (scaled_font=0x5c7b8c08, x=200, y=400, utf8=0x5c7b8b34 "Siemka!", glyphs=0x5d7a0da0, clusters=0x0, num_chars=7) at cairo-scaled-font.c:1681
#5 0x5d3766dc in INT_cairo_scaled_font_text_to_glyphs (scaled_font=0x5c7b8c08, x=200, y=400, utf8=0x5c7b8b34 "Siemka!", utf8_len=7, glyphs=0x5d7a15bc, num_glyphs=0x5d7a15b4, clusters=0x0, num_clusters=0x0,
cluster_flags=0x0) at cairo-scaled-font.c:2007
#6 0x5d3456d0 in _cairo_gstate_text_to_glyphs (gstate=0x5d699130, x=200, y=400, utf8=0x5c7b8b34 "Siemka!", utf8_len=7, glyphs=0x5d7a15bc, num_glyphs=0x5d7a15b4, clusters=0x0, num_clusters=0x5d7a15b0,
cluster_flags=0x5d7a15ac) at cairo-gstate.c:1848
#7 0x5d33ab44 in cairo_show_text (cr=0x5d699110, utf8=0x5c7b8b34 "Siemka!") at cairo.c:3437
Cheers,
Marek
|