Building SDL for Android Using Swift Package manager

Hi,
I am using Swift Package Manager for building Shared Library libSDL.so which builds without any error. But there are some methods in SDL_android.c which are compiled and available in .o file but not in final .so file. For example this one in SDL_android.c

JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize( JNIEnv* env, jclass jcls, jint width, jint height, jint format, jfloat rate)

Which is dumped in .o file

00000000000004d0 <Java_org_libsdl_app_SDLActivity_onNativeResize>:
4d0: 55 push %rbp
4d1: 48 89 e5 mov %rsp,%rbp
4d4: 48 83 ec 20 sub $0x20,%rsp
4d8: 48 89 7d f8 mov %rdi,-0x8(%rbp)
4dc: 48 89 75 f0 mov %rsi,-0x10(%rbp)
4e0: 89 55 ec mov %edx,-0x14(%rbp)
4e3: 89 4d e8 mov %ecx,-0x18(%rbp)
4e6: 44 89 45 e4 mov %r8d,-0x1c(%rbp)
4ea: f3 0f 11 45 e0 movss %xmm0,-0x20(%rbp)
4ef: 8b 7d ec mov -0x14(%rbp),%edi
4f2: 8b 75 e8 mov -0x18(%rbp),%esi
4f5: 8b 55 e4 mov -0x1c(%rbp),%edx
4f8: f3 0f 10 45 e0 movss -0x20(%rbp),%xmm0
4fd: e8 00 00 00 00 callq 502 <Java_org_libsdl_app_SDLActivity_onNativeResize+0x32>
502: 48 83 c4 20 add $0x20,%rsp
506: 5d pop %rbp
507: c3 retq
508: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
50f: 00

But I can't find same method on libSDL.so.
Also running app gives me error:

java.lang.UnsatisfiedLinkError: No implementation found for void org.libsdl.app.SDLActivity.onNativeResize

Now I don't know how to solve this problem. Is there any thing I am missing?

This really doesn't give us much to go on. Any number of things could be going on. It would probably be more useful to have the full, verbose build logs so that we can actually see what is going on.

Did you check that the symbol has the proper visibility? Did you ensure that the object file is being included in the actual link? Did you ensure that you are not building with -ffunction-sections and -Xlinker --gc-sections? Is the object file that you are referencing here being consumed by the DSO as a direct object rather than as part of a static archive? If it is the latter, are you marking the entire archive for preservation?

Hi @compnerd, Thank you for looking into problem but after doing whole build process from start problem got resolved. Sorry for all this noise.:sweat_smile:

Terms of Service

Privacy Policy

Cookie Policy