Skip to content

SDL example cannot locate __gxx_personality_v0 at runtime #28

@markkimsal

Description

@markkimsal

It seems like the libSDL.so, when built for aarch64, doesn't properly link to android's libc++ (or libstdc++?).

zig build -Dtarget=aarch64-linux-android 
adb install zig-out/bin/sdl-zig-demo.apk

When building for arm, it can't find android_getCpuFamily

zig build -Dtarget=arm-linux-android 
adb install zig-out/bin/sdl-zig-demo.apk

I'm only using NDK version 28 and build-tools version 35.0.1. do either of those matter?

The minimal example seems to build. install, and run fine.

dumping the libSDL.so from the apk shows that it does not need libc++

objdump -p lib/arm64-v8a/libSDL2.so

Dynamic Section:
  NEEDED               libdl.so
  NEEDED               libGLESv1_CM.so
  NEEDED               libGLESv2.so
  NEEDED               libOpenSLES.so
  NEEDED               liblog.so
  NEEDED               libandroid.so
  NEEDED               libm.so
  NEEDED               libc.so
  SONAME               libSDL2.so
  FLAGS                0x0000000000000008
  FLAGS_1              0x0000000000000001
  RELA                 0x00000000000220c8
  RELASZ               0x0000000000009a08
  RELAENT              0x0000000000000018
  RELACOUNT            0x000000000000057b
  JMPREL               0x000000000002bad0
  PLTRELSZ             0x0000000000006450
  PLTGOT               0x00000000001cced8

and readelf shows that it does need __gxx_personality_v0

readelf -Ws lib/arm64-v8a/libSDL2.so

 30: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _ZdlPv
    31: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_cond_signal@LIBC (2)
    32: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_cond_broadcast@LIBC (2)
    33: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _Znam
    34: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND free@LIBC (2)
    35: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND clock_gettime@LIBC (2)
    36: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_cond_timedwait@LIBC (2)
    37: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND gettimeofday@LIBC (2)
    38: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __errno@LIBC (2)
    39: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND nanosleep@LIBC (2)
    40: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND wcsncpy@LIBC (2)
    41: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __cxa_begin_catch
    42: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _ZSt9terminatev
    43: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __gxx_personality_v0
    44: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND stat@LIBC (2)
    45: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND setenv@LIBC (2)

I can't really find anything online about __gxx_personality_v0 except to use gpp instead of gcc, which I assume is like using zig c++ instead of zig cc, but I'm not sure how to achieve that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions