Hi,
I'm building static and shared libs (.a & .sl) with these make options:
Code:
SHLIB=libname.sl
CC=cc
AR=ld
ARFLAGS=-Bdynamic -shared -warn-common -warn-constructors -warn-multiple-gp -warn-once -o
INC=../src
DEFS=-DPOSIX -DANSI
CFLAGS=-Wall -Wno-unused -fpic -shared -I. -I$(INC) $(DEFS)
$(SHLIB): $(OBJS)
rm -f $(SHLIB)
$(AR) $(ARFLAGS) $(SHLIB) $(OBJS)
debug.o: $(SRC)/debug.c $(HEADERS)
$(CC) -c $(CFLAGS) $(SRC)/debug.c
...
But after I build my test program and run it, I get a segmentation fault. The program works fine with the static libs.
On Solaris, the LD_LIBRARY_PATH environment variable is used to specify where the shared libs are. As far as I can tell, Linux uses LIBRARY_PATH. Is that right, or do I need something else?
Do I need any other link options, or should I get rid of any that I have...?
This is how my test program is built:
Code:
CC=cc
CFLAGS=-Wall -DPOSIX -DANSI
SHLIBS=-L$$SHLIB_PATH
ivpslibs: scp.o rproc.o sstubs.o smain.o
$(CC) -shared -o ivpslibs scp.o rproc.o sstubs.o smain.o $(SHLIBS)
sstubs.o: sstubs.c ivp.h
$(CC) $(CFLAGS) -c $(INCS) sstubs.c
...
I don't know if it's a problem with how I build the shared lib or the test program or both?