C LINK_MAX error in make when trying to build library, APUE book

Hi. I'm trying to build the libmisc.a library with the source code for "Advanced Programming in the UNIX environment". I have the 1992 edition. http://www.kohala.com/start/apue.html . This library is required to compile the example C files. I get this error when I cd to /home/stevens/lib.44 and type 'gmake'.
Code:
make[2]: Entering directory `/usr/home/stevens/apue/lib.44'
gcc  -O -c pathconf.c -o pathconf.o
pathconf.c: In function '_do_pathconf':
pathconf.c:23:40: error: 'LINK_MAX' undeclared (first use in this function); did you mean 'LINE_MAX'?
   23 |         case _PC_LINK_MAX:      return(LINK_MAX);
      |                                        ^~~~~~~~
      |                                        LINE_MAX
pathconf.c:23:40: note: each undeclared identifier is reported only once for each function it appears in
*** Error code 1

Stop.
make[2]: stopped in /usr/home/stevens/apue/lib.44
gmake[1]: *** [Makefile:50: svr4] Error 1
gmake[1]: Leaving directory '/usr/home/stevens/apue/lib.44'
gmake: *** [Makefile:24: all] Error 2

>>
make also produces the same error. What's the best way to fix this so I can build this library to compile the example source code?
 
You can try to comment this line or to replace return(LINK_MAX); with return(-1);; either way some examples would likely not work.
 
I have doubts it makes sense nowadays to use this stuff, it's really ages old, and looking at this lib.44, it's actually for 386BSD (!)

That said, just leave out pathconf (remove pathconf.o from the Makefile). It seems to be a replacement implementation of pathconf(2) and I don't see why it should be replaced at all...
 
have doubts it makes sense nowadays to use this stuff, it's really ages old,

Yes, it's more to work through the exercises at the end of each chapter, because a lot of them require you to modify / run the code on your system. So I removed pathconf.o from the Makefile but now I get some new errors when I gmake/make:
Code:
sleep.c: In function 'sleep':
sleep.c:18:27: warning: assignment to 'void (*)(int)' from incompatible pointer type 'void (*)(void)' [-Wincompatible-pointer-types]
   18 |         newact.sa_handler = sig_alrm;
      |                           ^
gcc  -O -c sleepus.c -o sleepus.o
gcc  -O -c spipe.c -o spipe.o
gcc  -O -c strerror.c -o strerror.o
strerror.c:3:18: error: conflicting types for 'sys_errlist'; have 'char *[]'
    3 | extern char     *sys_errlist[];
      |                  ^~~~~~~~~~~
In file included from strerror.c:1:
/usr/include/stdio.h:406:27: note: previous declaration of 'sys_errlist' with type 'const char * const[]'
  406 | extern const char * const sys_errlist[];
      |                           ^~~~~~~~~~~
strerror.c:4:17: error: conflicting type qualifiers for 'sys_nerr'
    4 | extern int      sys_nerr;
      |                 ^~~~~~~~
In file included from strerror.c:1:
/usr/include/stdio.h:405:18: note: previous declaration of 'sys_nerr' with type 'int'
  405 | extern const int sys_nerr;
      |                  ^~~~~~~~
*** Error code 1

Stop.
make[2]: stopped in /usr/home/stevens/apue/lib.44
gmake[1]: *** [Makefile:50: svr4] Error 1
gmake[1]: Leaving directory '/usr/home/stevens/apue/lib.44'
gmake: *** [Makefile:24: all] Error 2

>>
There are only a few more .c / .o files in the directory.. everything else has compiled/linked. So if I can fix these errors I think the library will build. However I'm lost here on how to fix these new errors.
 
Back
Top