mirror of
https://github.com/flyinghead/flycast.git
synced 2026-11-07 17:11:09 -10:00
libretro: link libandroid, or the dynarec dies on the first memory access
flycast's libretro build has never run on Android 11 or later. It loads,
reaches frame one, and then takes a SIGSEGV its own handler cannot place:
[VMEM] Virtual memory file allocation failed: errno 13
[VMEM] Warning! nvmem is DISABLED
[COMMON] SIGSEGV @ 0x71d0c87618 invalid access to 0x71ce6cba00
errno 13 is EACCES. posix_vmem.cpp asks ASharedMemory_create first and
falls back to opening /dev/ashmem when the symbol is null -- and Android
11 took that device away from apps. So the fallback is refused, nvmem is
disabled, and the dynarec's fastmem accesses have no mapping behind
them. rewrite() cannot place the fault, and the handler falls through to
die("segfault").
The good path was there all along and was dead code, because the symbol
is declared weak:
extern "C" int __attribute__((weak)) ASharedMemory_create(const char*, size_t);
and nothing in the LIBRETRO branch links libandroid, so it resolved to
null every time. readelf on the built core shows only libm, libdl and
libc in NEEDED, and nm shows ASharedMemory_create as an undefined weak.
The app build links `android log` in its own ANDROID block further down;
the libretro build never did.
This commit is contained in:
1 parent
4509ee903c
commit
8933f9fe0c
1 file changed
+3
@@ -220,6 +220,9 @@ elseif(LIBRETRO)
|
||||
endif()
|
||||
if(ANDROID OR USE_GLES)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE GLES GLES3 HAVE_OPENGLES HAVE_OPENGLES3 HAVE_OIT)
|
||||
if(ANDROID)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE android)
|
||||
endif()
|
||||
elseif(IOS)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE GLES GLES3 HAVE_OPENGLES HAVE_OPENGLES3)
|
||||
find_library(OPENGLES OpenGLES)
|
||||
|
||||
Reference in new issue
Block a user