[comp.sys.hp] libc.a libresolv.a and strncasecomp

jsadler@misty.boeing.com (Jim Sadler) (11/20/90)

The bsd version of ftpd has a call to strncasecmp().  On a sun this is
in the libresolv.a library.  The HP does not have this library, most of
the routines in the Sun library are in the /lib/libc.a on the HP. When I
look at the libc.a nm shows:

Symbols from /lib/libc.a[ruserpass.o]:

Name                    Value   Scope  Type    Subspace

$global$            |          |undef |data   |
__filbuf            |          |undef |code   |


			Stuff deleted.


getlong             |      1856|sdef  |entry  |$CODE$
catch               |      2480|static|entry  |$CODE$
strcasecmp          |      2504|static|entry  |$CODE$
strncasecmp         |      2608|static|entry  |$CODE$
$THIS_DATA$         |1073741824|static|data   |$DATA$
$THIS_BSS$          |1073742448|static|data   |$BSS$

My first question is why does the linker give:

ld: Unsatisfied symbols:
   strncasecmp (code)

My second question is how do I get around this ?

The reason I'm using the BSD version of ftpd is that it's been modified
to provide the logging that we need.

jim sadler
206-234-9009	email	uunet!bcstec!jsadler | jsadler@misty.boeing.com

This service is brought to you by the computing mafia of Boeing (BCS).
Oh ya
None of the above is an opinion of The Boeing Co.  (If they found out 
that we had opinions they would probally create a new divison to figure 
out to hire opinionless employee's)

dhandly@hpcllz2.HP.COM (Dennis Handly) (11/21/90)

>/ jsadler@misty.boeing.com (Jim Sadler) / 10:01 am  Nov 19, 1990 /
>The bsd version of ftpd has a call to strncasecmp().
>When I look at the libc.a nm shows:

>Symbols from /lib/libc.a[ruserpass.o]:
>Name                    Value   Scope  Type    Subspace
>$global$            |          |undef |data   |
>__filbuf            |          |undef |code   |
   ...
>getlong             |      1856|sdef  |entry  |$CODE$
>catch               |      2480|static|entry  |$CODE$
>strcasecmp          |      2504|static|entry  |$CODE$
>strncasecmp         |      2608|static|entry  |$CODE$

When you use nm, you should pipe it to:  
nm ???         | fgrep -v static | fgrep -v undef

>My first question is why does the linker give:
>ld: Unsatisfied symbols:    strncasecmp (code)

If you remove the static functions/data, you'll see why the linker doesn't
see it.  These functions/data are only available to ruserpass and any other
functions in that object file, ruserpass.o.

>My second question is how do I get around this ?

?? Does HP have any special BSD libraries??

raf@hpfcdc.HP.COM (Rick Ferreri) (11/22/90)

> / hpfcdc:comp.sys.hp / jsadler@misty.boeing.com (Jim Sadler) / 11:01 am  Nov 19, 1990 /
> 
> The bsd version of ftpd has a call to strncasecmp().  On a sun this is
> in the libresolv.a library.  The HP does not have this library, most of
> the routines in the Sun library are in the /lib/libc.a on the HP. When I
> look at the libc.a nm shows:
> 
> Symbols from /lib/libc.a[ruserpass.o]:
> 
> Name                    Value   Scope  Type    Subspace
> 
> $global$            |          |undef |data   |
> __filbuf            |          |undef |code   |
> 
> 
> 			Stuff deleted.
> 
> 
> getlong             |      1856|sdef  |entry  |$CODE$
> catch               |      2480|static|entry  |$CODE$
> strcasecmp          |      2504|static|entry  |$CODE$
> strncasecmp         |      2608|static|entry  |$CODE$
> $THIS_DATA$         |1073741824|static|data   |$DATA$
> $THIS_BSS$          |1073742448|static|data   |$BSS$
> 
> My first question is why does the linker give:
> 
> ld: Unsatisfied symbols:
>    strncasecmp (code)

The strncasecmp that you see when you nm libc.a is a "static entry" not an
"extern entry".  It cannot be reached externally.  In other words, the 
ruserpass() source code has a static routine named "strncasecmp()" that it
uses internally.  There is, however, a strncasecmp() entry point in 
/usr/lib/libBSD.a which should do the trick for you.  Try linking with this
library too.

The ruserpass() code most likely has its own local version of strncasecmp()
since there is no libc entry point for strncasecmp() and there is no 
guarantee that the person using the ruserpass() routine will link in 
libBSD.a.

> 
> My second question is how do I get around this ?

Again.  Try linking in libBSD.a.

> 
> The reason I'm using the BSD version of ftpd is that it's been modified
> to provide the logging that we need.
> 
> jim sadler
> 206-234-9009	email	uunet!bcstec!jsadler | jsadler@misty.boeing.com
> 
> This service is brought to you by the computing mafia of Boeing (BCS).
> Oh ya
> None of the above is an opinion of The Boeing Co.  (If they found out 
> that we had opinions they would probally create a new divison to figure 
> out to hire opinionless employee's)
> ----------

Hope this helps.

Rick Ferreri

#include <standard disclaimer>

raf@hpfcdc.HP.COM (Rick Ferreri) (11/22/90)

Ooops.  Good thing I put in the disclaimer.  It has come to my attention that
libBSD.a does not have the strncasecmp() entry point.  It turns out that the
libBSD.a on the system that I work on is not the "stock" libBSD.a and does 
have this entry point (but this isn't the true 7.0 libBSD.a).

> > 
> > My second question is how do I get around this ?
> 
> Again.  Try linking in libBSD.a.

So, with this new information, I suppose the best way to get around it is
to write your own strncasecmp() (maybe convert the characters in both 
strings to lower case and then call strncmp() - or better yet, just compare
them at the same time that you convert them to the same case).

Sorry to get your hopes up.

Rick Ferreri

#include <standard disclaimer>

jsadler@misty.boeing.com (Jim Sadler) (11/22/90)

i'd like to thank the many people who answered my question.

So, Thanks !!!!!!

jim

jsadler@misty.boeing.com (Jim Sadler) (11/28/90)

>/ misty:comp.sys.hp / raf@hpfcdc.HP.COM (Rick Ferreri) /  8:20 am  Nov 21, 1990 /
>> / hpfcdc:comp.sys.hp / jsadler@misty.boeing.com (Jim Sadler) / 11:01 am  Nov 19, 1990 /
>> 
>> 
>> My first question is why does the linker give:
>> 
>> ld: Unsatisfied symbols:
>>    strncasecmp (code)
>
>The strncasecmp that you see when you nm libc.a is a "static entry" not an
>"extern entry".  It cannot be reached externally.  In other words, the 

	Thanks for the info.
>
>> 
>> My second question is how do I get around this ?
>
>Again.  Try linking in libBSD.a.

	Nope.  It's not in 7.0 libBSD.a.  I've been told it will be in
	8.0 but that's at least 5-6 months away for us customer types.
>
>> 
>> The reason I'm using the BSD version of ftpd is that it's been modified
>> to provide the logging that we need.
>> 
>
>Hope this helps.
>
>Rick Ferreri
>
>#include <standard disclaimer>
>----------