Hi,
I having an issue while compiling a C program in USS (z/OS) machine.
I was able to create objest files (.o) from source (.c) files but when I try to create a binary file from the object files I am getting the below error.
$ cc util.o sock.o app.o -lnsl -o ptf
FSUM3067 The archive library nsl (libnsl.a) cannot be found.
Sorry, I am not much familiar with -lnsl is. I used it because, the same option is used while compiling the program in other unix boxes too.
When I remove the -lnsl option, I get the below errors
$ cc util.o sock.o app.o -o ptf
IGD01008I ALLOCATION SET TO SCTEMPD M0610
IGD01010I ALLOCATION SET TO SGTEMPD STORAGE GROUP
IGD01008I ALLOCATION SET TO SCTEMPD M0610
IGD01010I ALLOCATION SET TO SGTEMPD STORAGE GROUP
IEW2763S DE07 FILE ASSOCIATED WITH DDNAME /0000004 CANNOT BE OPENED BECAUSE THE
FILE DOES NOT EXIST OR CANNOT BE CREATED.
IEW2302E 1031 THE DATA SET SPECIFIED BY DDNAME /0000004 COULD NOT BE FOUND, AND
THUS HAS NOT BEEN INCLUDED.
IEW2763S DE07 FILE ASSOCIATED WITH DDNAME /0000005 CANNOT BE OPENED BECAUSE THE
FILE DOES NOT EXIST OR CANNOT BE CREATED.
IEW2302E 1031 THE DATA SET SPECIFIED BY DDNAME /0000005 COULD NOT BE FOUND, AND
THUS HAS NOT BEEN INCLUDED.
IEW2456E 9207 SYMBOL ntohl UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM THE
DESIGNATED CALL LIBRARY.
IEW2456E 9207 SYMBOL htonl UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM THE
DESIGNATED CALL LIBRARY.
IEW2456E 9207 SYMBOL htons UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM THE
DESIGNATED CALL LIBRARY.
FSUM3065 The LINKEDIT step ended with return code 8.
Hi,
I have added the arpa/inet.h header file and removed the -lnsl option.
Now, I am left with the below errors
$ cc util.o sock.o app.o -o ptf
IGD01008I ALLOCATION SET TO SCTEMPD M0610
IGD01010I ALLOCATION SET TO SGTEMPD STORAGE GROUP
IGD01008I ALLOCATION SET TO SCTEMPD M0610
IGD01010I ALLOCATION SET TO SGTEMPD STORAGE GROUP
IEW2763S DE07 FILE ASSOCIATED WITH DDNAME /0000004 CANNOT BE OPENED BECAUSE THE
FILE DOES NOT EXIST OR CANNOT BE CREATED.
IEW2302E 1031 THE DATA SET SPECIFIED BY DDNAME /0000004 COULD NOT BE FOUND, AND
THUS HAS NOT BEEN INCLUDED.
IEW2763S DE07 FILE ASSOCIATED WITH DDNAME /0000005 CANNOT BE OPENED BECAUSE THE
FILE DOES NOT EXIST OR CANNOT BE CREATED.
IEW2302E 1031 THE DATA SET SPECIFIED BY DDNAME /0000005 COULD NOT BE FOUND, AND
THUS HAS NOT BEEN INCLUDED.
FSUM3065 The LINKEDIT step ended with return code 8.
From the error, its obvious that you need the libnsl.a because code links against some routines from that lib. What I would suggest is that find that library (using find) and explicitly specify the lib in the compile option (with -L) to see if it works.
find / -type f -iname "libnsl.a"
From this if you get any results then do
$ cc util.o sock.o app.o -lnsl -o ptf -L<YOUR_RESULT>
If you are not able to find libnsl.a then locate it from similar architecture of compile it on your machine.
If you read my link, at least some of those missing "routines" are actually macros and need no library, just headers. I'm not sure there is an lnsl for zos.