cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jorgemarsal
Newbie
Newbie
1,704 Views
Registered: ‎09-25-2013

Crash when loading shared libraries on Zynq

Hi all,

 

I'm trying to run a program that uses dynamic libraries on the ZC702 board. I'm running Ubuntu (http://www.wiki.xilinx.com/Ubuntu+on+Zynq).

 

This is the library (lib.c):

 

#include <stdio.h>

void func() {
  printf("hello from lib\n");
}

 

This is the main program (test.c):

 

#include <stdio.h>

void func();

int main() {
  printf("hello from main\n");
  func();
}

 

And this is the way I'm generating the libraries (Makefile):

 

all: test_dynamic test_static

test_dynamic : test.c libtest.so
arm-xilinx-linux-gnueabi-gcc -o test_dynamic test.c -ltest -L.
test_static : test.c libtest.a
arm-xilinx-linux-gnueabi-gcc -o test_static test.c libtest.a
libtest.so: lib.c
arm-xilinx-linux-gnueabi-gcc -fPIC -shared -o libtest.so lib.c
lib.o: lib.c
arm-xilinx-linux-gnueabi-gcc -c -o lib.o lib.c

libtest.a: lib.o
arm-xilinx-linux-gnueabi-ar rcs libtest.a lib.o

 

To run the programs:

 

$ make

$ ./test_static

hello from main
hello from lib

 

$ export LD_LIBRARY_PATH=.

$ ./test_dynamic

... crashes silently ...

 

The static version is working fine but the dynamic version crashes while loading the library, before entering main.

 

Am I doing something wrong in the library generation process? If so, can you explain how to generate dynamic libraries that work on Zynq?

 

I've attached the source code and Makefile for your convenience.

 

Thanks

0 Kudos
0 Replies