sigemptyset() NDK UnsatisfiedLinkError dlopen()

ぐ巨炮叔叔 提交于 2020-02-05 08:32:46

问题


A certain C-code in my Android NDK application, calls the sigemptyset() function defined in the signal.h. I am building my project using the NDK-r9.

My library file called "libnative-service.so" is built fine, after the c-code is compiled. But on running the application i get the following error regarding the refernce to sigemptyset().

Am i missing something ??

09-22 15:13:09.102: E/art(3718): dlopen("/data/app-lib/com.project/libnative-service.so", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "sigemptyset" referenced by "libnative-service.so"...
09-22 15:13:09.103: D/AndroidRuntime(3718): Shutting down VM
09-22 15:13:09.106: E/AndroidRuntime(3718): FATAL EXCEPTION: main
09-22 15:13:09.106: E/AndroidRuntime(3718): Process: com.project, PID: 3718
09-22 15:13:09.106: E/AndroidRuntime(3718): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "sigemptyset" referenced by "libnative-service.so"...

回答1:


This function appears to be declared inline:

static __inline__ int sigemptyset(sigset_t *set)
{
    memset(set, 0, sizeof *set);
    return 0;
}

So it should already be resolved in the compiled library, and not a dependency to be filled by runtime linking. If it is unresolved, it would seem that your library has not built correctly.

Did you perhaps link against the wrong headers? If you used a non-ndk signal.h you might not be compiling usage of this function correctly.



来源:https://stackoverflow.com/questions/25975291/sigemptyset-ndk-unsatisfiedlinkerror-dlopen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!