Article View: news.software.nntp
Article #9492Re: NNRPD compile trouble
From: Doug McClure
Date: Sun, 21 Jul 1996 00:00
Date: Sun, 21 Jul 1996 00:00
190 lines
5971 bytes
5971 bytes
Help...I'm running Irix 6.2 on a Challenge S, forced into using cc since
gcc is unrecoverably DOA. All patches are rejecting - no matter how I
try to get them in, and the compile still fails with the errors about
nlist. I'm compiling using n32 and mmap as well. Sorry to hit with such
a giant post, but I get at best
117 % make
cc -I../include -O2 -n32 -c article.c
cc -I../include -O2 -n32 -c group.c
cc -I../include -O2 -n32 -c commands.c
cc -I../include -O2 -n32 -c misc.c
cc -I../include -O2 -n32 -c newnews.c
cc -I../include -O2 -n32 -c nnrpd.c
cc -I../include -O2 -n32 -c post.c
cc -I../include -O2 -n32 -c loadave.c
cc -n32 -o nnrpd article.o group.o commands.o misc.o newnews.o
nnrpd.o post.o loadave.o ../libinn.a
ld32: ERROR 33: Unresolved text symbol "nlist" -- 1st referenced by
loadave.o.
ld32: INFO 60: Output file removed because of error.
cc ERROR: /usr/lib64/cmplrs/ld32 returned non-zero status 1
*** Error code 1 (bu21)
Here is the loadave.c I have manually patched - probably made a mess of
it, I admittedly avoid C:
====================================================================
/* $Revision: 1.4 $
**
*/
#include "nnrpd.h"
#if NNRP_LOADLIMIT > 0
#ifdef linux
int
GetLoadAverage()
{
FILE *ProcLoadAve;
float load;
if ((ProcLoadAve=fopen("/proc/loadavg", "r"))==NULL)
return -1;
if (fscanf(ProcLoadAve,"%f",&load)!=1)
return -1;
fclose(ProcLoadAve);
return (int) (load+0.5);
}
#else
#include <nlist.h>
STATIC struct nlist NameList[] = {
{ "_avenrun" },
#define X_AVENRUN 0
{ NULL }
};
/*
** Get the current load average as an integer.
*/
int
GetLoadAverage()
{
int fd;
int oerrno;
#if defined(FSCALE)
long avenrun[3];
#else
double avenrun[3];
#endif /* defined(FSCALE) */
fd = open("/dev/kmem", 0, 0);
if (fd < 0)
return -1;
#if defined(HPUX)
(void)nlist("/hp-ux", NameList);
#else
#if defined(SUNOS5)
(void)nlist("/dev/ksyms", NameList);
#else
(void)nlist("/vmunix", NameList);
#endif /* defined(SUNOS5) */
#endif /* !defined(HPUX) */
if (NameList[0].n_type == 0
|| lseek(fd, (off_t) NameList[X_AVENRUN].n_value, SEEK_SET) == -1
|| read(fd, (char *)avenrun, sizeof avenrun) != sizeof avenrun) {
oerrno = errno;
(void)close(fd);
errno = oerrno;
return -1;
}
(void)close(fd);
#if defined(FSCALE)
return (int)(avenrun[0] + FSCALE / 2) >> FSHIFT;
#else
return (int)(avenrun[0] + 0.5);
#endif /* defined(FSCALE) */
}
#endif /* linux */
#endif /* NNRP_LOADLIMIT > 0 */
=--------------------------------------------------------------------
Very frustrating since every other aspect of INN compiled perfectly for
once. Ack!
Doug McClure
SCESCAPE
Matthew B. Wood wrote:
>
> Clayton O'Neill (coneill@premier1.premier.net) wrote:
> : On Fri, 19 Jul 1996 02:11:24 GMT, Matthew B. Wood wrote:
> : >gcc -O -o nnrpd article.o group.o commands.o misc.o newnews.o nnrpd.o
> : >post.o loadave.o ../libinn.a
> : >loadave.o(.text+0x3b): undefined reference to `nlist'
> : >make: *** [nnrpd] Error 1
> : >
> : >I have /usr/include/nlist.h, but I can't seem to find it in any of the
> : >libraries. Where is located? I'm surprised this in't in the FAQ!
>
> : The below patch fixes this. This patch is going to be rolled into 1.5.
>
> : --- /usr/local/news/INN/nnrpd/loadave.c Fri Jan 29 10:51:58 1993
> : +++ loadave.c Wed Jul 17 15:36:30 1996
> : @@ -1,8 +1,28 @@
> : -/* $Revision: 1.3 $
> : +/* $Revision: 1.4 $
> : **
> : */
> : #include "nnrpd.h"
> : #if NNRP_LOADLIMIT > 0
> : +#ifdef linux
> : +
> : +/*
> : +** Get the current load average as an integer.
> : +*/
> : +int
> : +GetLoadAverage()
> : +{
> : + FILE *ProcLoadAve;
> : + float load;
> : +
> : + if ((ProcLoadAve=fopen("/proc/loadavg", "r"))==NULL)
> : + return -1;
> : + if (fscanf(ProcLoadAve,"%f", &load)!=1)
> : + return -1;
> : + fclose(ProcLoadAve);
> : + return (int)(load+0.5);
> : +}
> : +
> : +#else
> : #include <nlist.h>
> : STATIC struct nlist NameList[] = {
> : { "_avenrun" },
> : @@ -55,4 +75,5 @@
> : return (int)(avenrun[0] + 0.5);
> : #endif /* defined(FSCALE) */
> : }
> : +#endif /* linux */
> : #endif /* NNRP_LOADLIMIT > 0 */
>
> Thanks, Clayton! I patched it and it compiled. It didn't seem to take
> the automatic patch though:
>
> Patching file loadave.c using Plan A...
> Hunk #1 failed at 1.
> Hunk #2 succeeded at 75 with fuzz 2.
> 1 out of 2 hunks failed--saving rejects to loadave.c.rej
> done
>
> ...So I went ahead and updated it by hand.
>
> Should someone contact the INN FAQ maintainer about this?
>
> --
> Matthew B. Wood mbwood@netcom.com
> "Psychoplasmics: The Ultimate Therapeutic Device"
Technical Details
Message-ID:
<31F1BBB7.2C67@scescape.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<devtrixDurq30.3CB@netcom.com> <slrn4utu7s.h6l.coneill@premier1.premier.net> <devtrixDut02G.42B@netcom.com>Show Full Headers
Complete Article Headers
Message-ID: <31F1BBB7.2C67@scescape.net> Subject: Re: NNRPD compile trouble Date: Sun, 21 Jul 1996 00:00:00 +0000 From: Doug McClure <closer@scescape.net> References: <devtrixDurq30.3CB@netcom.com> <slrn4utu7s.h6l.coneill@premier1.premier.net> <devtrixDut02G.42B@netcom.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 169270877 To: "Matthew B. Wood" <devtrix@netcom.com> Cc: coneill@premier1.premier.net Content-type: text/plain; charset=us-ascii Organization: SCESCAPE Inc. Mime-version: 1.0 Newsgroups: news.software.nntp X-mailer: Mozilla 3.0b5a (X11; U; IRIX 6.2 IP22)