Subject: Getting Started, 'errno' problem
From: [email-masked] (Stephen E. Schweibinz)

23 Oct 1998 12:49:28 -0700
Message-ID: <[email-masked]>
To: [email-masked]

Hello,

I am trying to port some C code from Unix to NT.  I have
just installed Cygwin32 Beta19 (cdk.exe).  I then installed
the b19.1-update (new-cygwin19_dll.gz).  Lastly, I replaced
the Cygwin32 compiler with the egcs-1.1 compiler
(egcs-1.1-cygb19.tar.gz).  

After each step, I have tried compiling but I continue
to get the same problems.  1) Failure to recognize where
gcc.exe is located (gcc: permission denied) and 2)
undefined reference to 'errno'

To fix problem 1, I had to add the explicit path to gcc.exe
in my make file even though the PATH environment variable 
points to the same location.
In my make file, I had to change
CC = gcc -ansi -pedantic -fpcc-struct-return

to the following:
CC = C:/Cygnus/B19/H-i386-cygwin32/bin/gcc -ansi -pedantic etc.

I put the above in this message because it may relate to my
second problem which is hanging me up.

When I try to run 'make', I keep getting an undefined reference
to 'errno'.

libpbm.a(libpbm1.o)(.text+0x4e8):libpbm1.c: undefined reference to `errno'
collect2: ld returned 1 exit status
make: *** [pbmmerge] Error 1

I have tried to include references to many different libraries
by adding a flag such as -lc to reference libc.a at the point
where the code can't find 'errno'.

$(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c $(OBJECTS) $(LIBPBM) -lc

I am not sure which library 'errno' is a part of so I tried 
referencing just about all of them.

Including -lc or -lg produces the following error:

C:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\
egcs-2.91.57\..\..\..\..\i386-cygwin32\lib/libcygwin.a(l
ibccrt0.o)(.data+0x0):libccrt0.cc: multiple definition of
`_impure_ptr'
C:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\
egcs-2.91.57\..\..\..\..\i386-cygwin32\lib/libg.a
(impure.o)(.data+0x2ec):impure.c: first defined here
collect2: ld returned 1 exit status
make: *** [pbmmerge] Error 1

My PATH environment variable includes the following:

PATH='/Cygnus/B19/H-i386-cygwin32/bin:/WINNT/system32:
/WINNT:/arcexe72/lib:/arcexe72/bin:/NET/MIT:/perl/bin:
..:/WIN32APP/TOOLKIT:/bin:/program files/devstudio/
sharedide/bin/ide:/program files/devstudio/sharedide/bin
:/program files/devstudio/vc/bin'

Also, GCC_EXEC_PREFIX was automatically set to
GCC_EXEC_PREFIX='C:\Cygnus\B19\H-i386-cygwin32\lib\gcc-lib\'

I should note that the code compiles fine on a Sun 
machine...so I think my problem might be with my PATH
or setting up other environment variables.

Thanks for any feedback in advance,

Steve Schweibinz

__________
/*******************************************************

   Stephen E. Schweibinz
   Planning Support Systems Group
   Dept. of Urban Studies and Planning
   MIT
   [email-masked]
   http://www.vcp.com

*******************************************************/

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".