[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

building and using a shared library







I am trying to compile and use a shared library on an ETRAX LX 100 board.



to build an object I use

%.o : $%.c
      $(CC) $(CFLAGS) ... -fPIC  objectname.c

To link the shared library I use the following command.

libshared.so : $(SETOFOBJECTS)
      $(LD) -shared -soname libshared.so -o libshared.so $(SETOFOBJECTS)

The library is built:

I can use
nm-cris libshared.so
and get a printout of the symbols in the library

I now try to build a program that uses the shared library as follows

progname : $(PROGNAME)
      $(CC) .... -c <progname.c>
      $(CC)  -o progname progname.o $(LDFLAGS) -L . -lshared

I get the following message
./libshared.so: could not read symbols : Invalid operation

collect2 : ld return 1 exit status

Why does this happen?

Mark Schapira