'ld' problem in Interactive UNIX 2.2

Bob_Crosson_x3832 crosson at cam.nist.gov
Wed May 15 05:07:01 AEST 1991


I am running Interactive's UNIX 2.2.  I am trying to compile a
C program using make and keep getting an error from 'ld'.
Below are a file called 'hello.c', a make file for hello.c, and
the results when make processes the make file.  Can anyone tell
me why ld cannot find 'environ'?  I have used 'ar' to dump all
of the library element names from the files /lib/lib*.a and
/usr/lib/lib*.a and cannot find environ.  I am running the
C-shell.  Could that have anything to do with it?
Just 'cc hello.c' produces an a.out that executes correctly.

Thanks in advance for any help.  My e-mail address is

crosson at cam.nist.gov
--------------------------------------------------------------
This is the hello.c file:

#include	<stdio.h>

main() {
  fprintf( stdout, "Hello to you, world\n");
}

--------------------------------------------------------------
# makefile for 'hello.c'

CC		=	/bin/cc
CFLAGS		=	-O
LD		=	/bin/ld
LIBDIR		=	/lib
LLIBDIR		=	/usr/lib
LIBS		=	-Y L,$(LIBDIR) -Y U,$(LLIBDIR)
LDFLAGS		=	-lc

.c.o		:
			$(CC) $(CFLAGS) -c $<

hello		:	hello.o
			$(LD) $(LIBS) -o hello hello.o $(LDFLAGS)

--------------------------------------------------------------
Output from running the make file:

	/bin/cc -O -c hello.c
	/bin/ld -Y L,/lib -Y U,/usr/lib -o hello hello.o -lc
undefined			first referenced
 symbol				    in file
environ				    /lib/libc.a
ld fatal: Symbol referencing errors. No output written to hello
*** Error code 13



More information about the Comp.unix.sysv386 mailing list