AnsweredAssumed Answered

application linked with shared libraries

Question asked by dbutter on Aug 7, 2013
Latest reply on Jun 4, 2014 by dbutter

Hi,

 

For my application I need to use shared libraries on uClinux/blackfin. I have build the kernel and usespace with support for FDPIC/shared, but I cannot get a simple hello world (dynamically linked) to run. I'm using buildroot/kernel/toolchain checked out from about 1-week ago.The target is a BF537.

 

Here is an example:

 

/* testlib.c --- */

/* Code: */

#include <stdio.h>

int hello()

{

  printf("hello from shared library\n");

  return 0;

}

/* testlib.c ends here */

 

/* test.c --

/* Code: */

#include <stdio.h>

int hello();

 

int main()

{

  hello();

  return 0;

}

/* test.c ends here */

 

Then I build it as follows:

 

db@dbl:/opt/nfs$ bfin-linux-uclibc-gcc -Wall -c testlib.c

db@dbl:/opt/nfs$ bfin-linux-uclibc-gcc -Wall -o libtest.so testlib.o -shared -Wl,-soname,libtest.so

db@dbl:/opt/nfs$ bfin-linux-uclibc-gcc -Wall -c test.c

db@dbl:/opt/nfs$ bfin-linux-uclibc-gcc -o test test.o -L. -ltest

db@dbl:/opt/nfs$ bfin-linux-uclibc-ldd ./test

checking sub-depends for 'libtest.so'

checking sub-depends for 'not found'

checking sub-depends for 'not found'

    libtest.so => libtest.so (0x00000000)

    libgcc_s.so.1 => not found (0x00000000)

    libc.so.0 => not found (0x00000000)

    not a dynamic executable

 

So I made sure the referenced libraries are in a standard path (/lib) on target and run "test" on target:

 

root:/opt/nfs> ./test

sh: can't execute './test': No such file or directory

 

What am I missing here?

 

Thanks!

--

Regards, Devin

Outcomes