Library not found CANNOT LINK EXECUTABLE Android using CodeSourcery toolchain

1k Views Asked by At

I am trying to create a c program for my android device,. It use dlopen and dlsym to open a function in shared library. Im compiling with arm-none-linux-gnueabi. My helo.c program look like this:

helo.c

#include "stdio.h"
#include "dlfcn.h"

void main(int argc, char ** argv) {

    void *handle=0;void *func=0;  


    handle = dlopen("sharedlib.so", 1);  
    if (handle == 0) {
        printf("Failed openning lib\n");
        return;
    }

    func = dlsym(handle, "hello_world_");
    if (func == 0) {
         printf("Failed func\n");
        return;
    }

    dlclose(handle);

}

Iam compiling on this way:

arm-none-linux-gnueabi-gcc -w  -g3 -O0  -ggdb hello.c  -o  hello -ldl -Wl,--dynamic-linker=/system/bin/linker

But when I try to running on my device I get this error

link_image[1936]:  1983 could not load needed library 'libdl.so.2' for helo (reloc_library[1285]:  1983 cannot locate '__cxa_finalize'...)CANNOT LINK EXECUTABLE

Any idea

0

There are 0 best solutions below