Operating System - HP-UX
1753297 Members
7204 Online
108792 Solutions
New Discussion юеВ

Re: not able to link shared library

 
sushant keerti
Advisor

not able to link shared library

Hi,
We are using nmake utility to compile and build our application (on hp-ux 11.23 IPF).
We are trying to link third party software SHARED libraries (TUXEDO) to build our application.
Please find the nmake file we are using below

In the nmake file the -lutrace (lbutrace.sl) is the TUXEDO shared library which we are trying to link. Runtime it is failing ( saying library not found).
But if we use the while path like /opt/tuxedo/tuxedo9.1/lib/libutrace.sl instead of -lutrace it works.
Is there any flag that can be used to link shared libraries?. The same nmake file works fine in hp-ux 11.0 PA machine

=============================================
.SOURCE.C : .

.SOURCE.h : ../../../../../../develop/mis/src/include \
../../../../../../develop/include \
/opt/tuxedo/tuxedo9.1/include \
$(VROOT)/develop/mis/src/lib/SC/SCincl \
/appdev/mis/misdev/sushant/perfmon_temp/inc \
$(TUXDIR)/include

.SOURCE.a : ../../../../../../develop/lib \
../../../../../../lib \
$(VROOT)/develop/mis/src/lib/SC \
/appdev/mis/misdev/ccp2/userprofile.PB148/lib/prod_up

.SOURCE.sl : $(VROOT)/develop/lib \
/opt/tuxedo/tuxedo9.1/lib

/* --------------- Default Variables --------------- */

if "$(PURIFY)" == "ON"
CC = purify /opt/aCC/bin/aCC
TARGET = mistop.cgi.purify
else
CC = /opt/aCC/bin/aCC
TARGET = mistop.cgi
end

INSTALL_DIR = ../../../../../../develop/cgi-bin

CFILES1 = \
mistop.C

OFILES1 = $(CFILES1:C|\.C|\.o)

LIBS = \
-lutrace \
-lSC++

implicit_template_definition_warning=
CCFLAGS = \
-g0 -mt +DD64 -DOS_UNIX_HP -DMIS_T3 -v -Wl,+s \
$(CFLAGS) -Wl,+s -L/opt/tuxedo/tuxedo9.1/lib -W,L/usr/lib/hpux64

incdirs = $(VPATH:/:/ /G:X=$(VOFFSET):X=$(*.SOURCE.h))
uniqdirs = $(incdirs:I=$(incdirs))
Ioptions = $(VPATH:?$(uniqdirs:/^/-I/G)?$(*.SOURCE.h:/^/-I/G)?)

LDFLAGS = \
$(Ioptions) -I- $(Ioptions)

/* --------------- Assertions --------------- */

.ERROR : .MAKE
error 3 Make of $(TARGET) failed.

finish : start $(INSTALL_DIR)/$(TARGET)
:
: +++++ $(TARGET) installed in $(INSTALL_DIR) +++++
:


start :
:
: ----- Attempting to make $(TARGET) -----
:

$(INSTALL_DIR)/$(TARGET) : $(OFILES1) $(LIBS)
rm -f $(<)
CC="$(CC)" CFLAGS="$(CCFLAGS) $(Ioptions)" LDFLAGS="$(LDFLAGS)" buildclient -v -o $(INSTALL_DIR)/$(TARGET) -f "$(*)" -l "
-Wl,-L../../../../../../develop/lib -Wl,-L../../../../../../lib -Wl,-L$(VROOT)/develop/mis/src/lib/SC -Wl,-L/appdev/mis/misdev
/ccp2/userprofile.PB148/lib/prod_up -Wl,+s -L/$(TUXDIR)/lib, -Wl,-L/usr/lib/hpux64 $(LIBS)"
if [ ! -x $(<) ]
then
exit 1
fi

==========================================
2 REPLIES 2
Steven E. Protter
Exalted Contributor

Re: not able to link shared library

Shalom,

Check the SHLIB_PATH variable.

Make sure the required library is the first one found on that path.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dennis Handly
Acclaimed Contributor

Re: not able to link shared library

It would be helpful if you didn't show us your makefile but only the actual link line.

For dld the paths with -L are also used at runtime. You can change this by using LD_LIBRARY_PATH or SHLIB_PATH. You can also embed the path with -Wl,+b,paths.