Vsim error loading DPI shared object file using standard C lib functions, undefined symbol

I am trying to compile standard libpng C functions into a shared object suitable for calling through the DPI. I can successfully (no errors or warnings) compile my C code and generate a shared object file, but when I try loading it into the simulator using the ‘vsim -svlib path_to_so/libpng.so’ option, i get this error.

Loading ./…/…/…/…/…/shared/tb/png/libpng.so

** Error: (vsim-3197) Load of “./…/…/…/…/…/shared/tb/png/libpng.so” failed: ./…/…/…/…/…/shared/tb/png/libpng.so: undefined symbol: inflateReset.

** Fatal: (vsim-3748) Failed to load DPI object file “./…/…/…/…/…/shared/tb/png/libpng.so” while trying to resolve ‘mti_Command’.

FATAL ERROR while loading design

libpng.so is my shared object file encapsulating the libpng functions i want to call in questasim.
The inflateReset function is a standard zlib function (png uses zlib as it’s compression engine), which is installed in the normal place (/usr/lib64 and /lib64) on our 64 bit Red-Hat linux servers.

I’ve verified that the path to libpng.so is correct and the file has correct read and execute permissions. I’ve also tried explicitly putting the lib64 path in my LD_LIBRARY_PATH env variable and get the exact same error.

Anyone out there have any idea what I might be doing wrong?
Thanks,
gary

In reply to gtakushi:

Forgot to mention that I am using the -lm option to the gcc link command as recommended by the Questa User’s Manual.

Heres the relevant parts of my makefile for building libpng.so.

CC = /apps/mentor/questa_10.3d_1/questasim/gcc-4.5.0-linux_x86_64/bin/gcc
CFLAGS += -fPIC
LDFLAGS = -lm
DYNAMIC = -shared -Bsymbolic
SOURCES = png.c pngerror.c
pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c
pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c
png_dpi_test.c

OBJS = $(SOURCES:.c=.o)

.c.o:
(CC) (CFLAGS) (DPIINC) (DEBUG) -c < -o @

libpng.(SO_EXT): (OBJS)
(CC) (LDFLAGS) (DYNAMIC) -o @ $^

I opened an SR for this on supportnet.mentor.com and the AE who picked up the ticket quickly figured out what was wrong. I was missing the -lz linker option.

Thanks to Vijay Arputharaj for figuring this out.

In reply to gtakushi:

In reply to gtakushi:
Forgot to mention that I am using the -lm option to the gcc link command as recommended by the Questa User’s Manual.
Heres the relevant parts of my makefile for building libpng.so.
CC = /apps/mentor/questa_10.3d_1/questasim/gcc-4.5.0-linux_x86_64/bin/gcc
CFLAGS += -fPIC
LDFLAGS = -lm
DYNAMIC = -shared -Bsymbolic
SOURCES = png.c pngerror.c
pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c
pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c
png_dpi_test.c
OBJS = (SOURCES:.c=.o) .c.o: (CC) (CFLAGS) (DPIINC) (DEBUG) -c < -o @ libpng.(SO_EXT): (OBJS) (CC) (LDFLAGS) (DYNAMIC) -o @ ^

What Is DPIINC & DEBUG mean in the above code ?

Thanks