Re: [tkined] building scotty 2.1.10 on HP-UX 10.20 - SOLVED!

George Smith (gbs@swdc.stratus.com)
Fri, 8 Jan 1999 11:30:23 -0800 (PST)

Problem SOLVED!

Thanks to all the people that sent suggestions. And thanks to a tip
from Will Lauer who pointed me in the direction of understanding the
dependency of tnm.sl upon /usr/lib/libl.1.

The tnm.sl shared lib does depend upon /usr/lib/libl.1 because of this
target in the Makefile:

tnm$(SHLIB_SUFFIX): $(TNM_OBJS)
$(SHLIB_LD) $(TNM_OBJS) -o tnm$(SHLIB_SUFFIX) $(LIBS) $(OSIMIS_LIBS) $(M
SQL_LIBS) $(GDMO_LIBS)

The value of $(GDMO_LIBS) is:

# Linker switch(es) to use to link with the gdmo library archive (the
# configure script will try to set this value automatically, but you
# can override it).
GDMO_LIBS = -ll

So when the linker builds the tnm.sl share library, it builds in a
dependency upon /usr/lib/libl.1. When scotty runs, it dynamically loads
tnm.sl which must then load /usr/lib/libl.1. However, that doesn't seem
to work. The very frustrating and misleading error message would result:

$ ./scotty
initialization failed: couldn't load file "/usr/public/lib/tnm2.1.10.sl"
: no such file or directory

I thought about this for awhile, trying this and that, not really getting
anywhere and just by chance surfed over to the scotty web site. I noticed
a link to a "porting.notes" document and clicked on it. Under the HP-UX
section was this note:

>Some people reported that they experienced runtime linker problems
>under HP 10.20 which were resolved by removing -lrpcsvc and -ll from
>the LIBS variable in the Makefile.

Aha! I edited the Makefile and removed these two libs, did a make which
made a new tnm.sl and scotty, copied them into place, and it worked!
Hallelujah! Now, scotty would run:

$ ./scotty
%

But I wondered why the -ll was there and wondered if removing these libs
would cause any other problems. I played around with a LOT of combinations
of linker options, using +b and +s, enabling the SHLIB_PATH variable,
and changing the order of searching and where to search, and the value
of SHLIB_PATH. If the -ll was included on the link line for tnm.sl,
nothing would work. It seems, that at least for HP-UX 10.20, if an
executable loaded a shared lib, and that shared lib depended on another
shared lib, it couldn't find it.

However... if I put the -ll on the scotty link line, then everything
would still link and it WORKED FINE!!! So, with tnm.sl depending on
/usr/lib/libl.1 then scotty would get initialization errors. With
scotty depending on /usr/lib/libl.1, all was fine.

Maybe the Makefile authors might consider changing which target gets
the $(GDMO_LIBS) symbol. That is, instead of this:

tnm$(SHLIB_SUFFIX): $(TNM_OBJS)
$(SHLIB_LD) $(TNM_OBJS) -o tnm$(SHLIB_SUFFIX) $(LIBS) $(OSIMIS_LIBS) $(M
SQL_LIBS) $(GDMO_LIBS)

Take away $(GDMO_LIBS) from the tnm.sl target and put it on the scotty
target like so:

scotty: tnm$(SHLIB_SUFFIX) ntping straps scotty.o
$(LD) $(LD_FLAGS) $(LD_SEARCH_FLAGS) -o scotty scotty.o $(TCL_LIB_SPEC)
$(LIBS) $(DL_LIBS) $(GDMO_LIBS) -lm

(Of course this really must be changed in Makefile.in).

At any rate, I'M HAPPY! Scotty is now working and I can proceed with
actually using it to test our SNMP agent. Again, thanks to all the
helpful people on this list.

George Smith said:
> From: George Smith <gbs@swdc.stratus.com>
> Subject: Re: [tkined] building scotty 2.1.10 on HP-UX 10.20 (fwd)
> To: tkined@ibr.cs.tu-bs.de
> Date: Thu, 7 Jan 1999 14:50:20 -0800 (PST)
>
> For those following this saga - and I wan't to thank those who have sent
> suggestions - here is the latest...
>
> I got WDB, HP's port of gdb, from an HP web site and installed it.
> I got DDD, a GUI front end to gdb, and installed it and used them
> to get more data. BTW, using gdb with DDD is FANTASTIC!!! What a
> wonderful set of tools!!! Both with full source and work great.
>
> Anyway, I used them to run scotty and tracked execution to the call
> to shl_load(3x) which was trying to load the tnm shared library.
> It was fun to watch the execution of the Tcl Virtual Machine -
> with DDD it was easy to see the reading of the startup script,
> the compilation and then the execution - cool!
>
> Execution gets to the call to shl_load(3x) in file tclLoadShl.c
> which resides in the tcl8.0.4 source in directory tcl8.0.4/unix.
> The arguments to shl_load(3x) have the correct full path to the tnm
> shared lib. However, shl_load returns with a NULL handle and sets errno
> to ENOENT(2) with is the infamous "no such file or directory"! Yet,
> the full path being passed to shl_load is the correct full path and the
> file is there and chatr(1) reports it as being a shared lib, etc, etc....
>
> I will now investigate why the shl_load() is failing. Maybe the format of the
> tnm2.1.10.sl file is not be what shl_load() wants since if I substitute another
> shared lib file in place tnm2.1.10.sl, ie cp libtk8.0.4.sl to tnm2.1.10.sl,
> then shl_load fails not with ENOENT but with ENOSYM. If and when I get this
> one solved, I'll let the list know.
>
> Again, thanks to those sending suggestions: Ari Reen, P. Davan, Mark Newnham
> and Mullaparthi Chandrashekhar.
>
>
> George Smith said:
> > From: George Smith <gbs@swdc.stratus.com>
> > Subject: Re: [tkined] building scotty 2.1.10 on HP-UX 10.20 (fwd)
> > To: tkined@ibr.cs.tu-bs.de
> > Date: Wed, 6 Jan 1999 14:15:24 -0800 (PST)
> >
> > I've had some time to get back to this problem now and have more data.
> >
> > I had already tried Mullaparthi's idea before but tried several
> > values of SHLIB_PATH and it didn't help. Then I noted that the
> > chatr on tnm2.1.10.sl specifies that SHLIB_PATH is disabled anyway,
> > just as it is on libtk80.sl:
> >
> > $ chatr tnm2.1.10.sl
> > tnm2.1.10.sl:
> > shared library
> > shared library dynamic path search:
> > SHLIB_PATH disabled second
> > embedded path disabled first Not Defined
> > shared library list:
> > dynamic /usr/lib/libl.1
> > static branch prediction disabled
> > data page size: 4K
> > instruction page size: 4K
> >
> > So setting SHLIB_PATH won't help. I used chatr +s to enable SHLIB_PATH
> > and tried various values of SHLIB_PATH and it still had the same error
> > message (see first msg below).
> >
> > I tried an idea from Roy Terry: put some other shared library in place
> > of tnm2.1.10.sl; I used a copy of libtk80.sl and this is what happens:
> >
> > $ ./scotty
> > initialization failed: couldn't load file "/usr/public/lib/tnm2.1.10.sl": unresolved symbol name
> >
> > So this says to me that the "no such file or directory" error message
> > is not referring to /usr/public/lib/tnm2.1.10.sl but to something that
> > that library is trying to find.
> >
> > Any ideas as to what the sequence of events are here? The binary "scotty"
> > is loading "tnm2.1.10.sl" which then trys to load something else. There
> > is /usr/public/lib/tnm2.1.10/pkgIndex.tcl which is what points at
> > /usr/public/lib/tnm2.1.10.sl and there is
> > /usr/public/lib/tnm2.1.10/library/init.tcl which does some manipulation
> > of the auto_path and of a variable $tnm(library). Are there any users
> > of scotty 2.1.10 that have it working on HP-UX 10.20? Advice or pointers
> > appreciated. TIA.
> >
> >
> > Mullaparthi Chandrashekhar said:
> > > Date: Wed, 16 Dec 1998 13:38:02 +0800
> > > From: Mullaparthi Chandrashekhar <chandru@hpsgns1.sgp.hp.com>
> > > To: "George B. Smith" <gbs@swdc.stratus.com>
> > > CC: tkined@ibr.cs.tu-bs.de
> > > Subject: Re: [tkined] building scotty 2.1.10 on HP-UX 10.20
> > >
> > > Hi!,
> > >
> > > You have to setup the SHLIB_PATH env var to point to this directory.
> > > Any application which used shared libraries, needs this env var to be
> > > set. It is the path in which the dynamic loader will search for shared
> > > libraries which an application uses. Try setting this env var to:
> > > export SHLIB_PATH=/usr/public/lib if you are using K-shell.
> > >
> > > You'll also have to add the standard search paths to this.
> > >
> > > hth,
> > > Chandru
> > >
> > > PS: Check out the manpage on dld.sl for more information.
> > >
> > > George Smith wrote:
> > > >
> > > > I downloaded the 2.1.10 version of the scotty package and am anxious
> > > > to get to use this very nice package; however, I am tripping over a
> > > > small problem. I have configured the package and it built fine.
> > > > However, when I try to run the scotty executable, it outputs this:
> > > >
> > > > $ ./scotty
> > > > initialization failed: couldn't load file "/usr/public/lib/tnm2.1.10.sl": no such file or directory
> > >

-- 
George B. Smith                      -=| Unix is user-friendly; it's just a
Ascend San Jose                      -=| little particular about which users
george.smith@ascend.com              -=| it is friendly to.

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.