www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/12/08/11:05:24

From: khan AT xraylith DOT wisc DOT edu (Mumit Khan)
Subject: b16/17: ld doesn't see main() in a library
8 Dec 1996 11:05:24 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <9612081826.AA00539.cygnus.gnu-win32@modi.xraylith.wisc.edu>
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

I've been testing g77 port under both b16 and b17, and in both cases, ld
refuses to see main() in libf2c.a. I have to do the following to make it
work:
    
    % g77 -o foo.exe foo.f main.o

where main.o is extracted from libf2c.

The following doesn't help either (and it shouldn't if the above fails):

    % g77 -o foo.exe foo.f /abs/path/to/libf2c.a

    % nm -p /abs/path/to/libf2c.a | grep main
    00000100 T _main
             U ___main
    % nm -p main.o | grep main
    00000100 T _main
             U ___main

If I don't specify main.o on the command line, I get the following
(expected when there is no main defined anywhere) error:

========================

[khan AT dhaka /src/win32/binary-io-test:926] env
PATH=${PATH}:/src/gnu/win32-b17/lib/gcc-lib/i486-cygwin32/cygnus-2.7.2-961023
/src/gnu/win32-b17/bin/i486-cygwin32-g77 -v -o bwrite.exe bwrite.f
 /src/gnu/win32-b17/bin/i486-cygwin32-gcc -v -o bwrite.exe -xf77 bwrite.f
-xnone -lf2c -lm Reading specs from
/src/gnu/win32-b17/lib/gcc-lib/i486-cygwin32/cygnus-2.7.2.f.1-961023/specs
gcc version cygnus-2.7.2-961023
 /src/gnu/win32-b17/lib/gcc-lib/i486-cygwin32/cygnus-2.7.2.f.1-961023/f771
bwrite.f -fset-g77-defaults -quiet -dumpbase bwrite.f -version -fversion
-o /tmp/cca17744.s GNU F77 version cygnus-2.7.2-961023 (i486-cygwin32)
compiled by GNU C version 2.7.2+repo.  GNU Fortran Front End version
0.5.18 compiled: Dec  8 1996 02:14:25

/src/gnu/win32-b17/lib/gcc-lib/i486-cygwin32/cygnus-2.7.2.f.1-961023/../../../../i486-cygwin32/bin/as -o /tmp/cca177441.o /tmp/cca17744.s
 /src/gnu/win32-b17/lib/gcc-lib/i486-cygwin32/cygnus-2.7.2.f.1-961023/ld
-o bwrite.exe
/src/gnu/win32-b17/lib/gcc-lib/i486-cygwin32/cygnus-2.7.2.f.1-961023/../../../../i486-cygwin32/lib/crt0.o
-L/src/gnu/win32-b17/lib/gcc-lib/i486-cygwin32/cygnus-2.7.2.f.1-961023
-L/src/gnu/win32-b17/lib/gcc-lib/i486-cygwin32/cygnus-2.7.2.f.1-961023/../../../../i486-cygwin32/lib /tmp/cca177441.o -lf2c -lm -lgcc -lcygwin -lkernel32
-lgcc
/src/gnu/win32-b17/lib/gcc-lib/i486-cygwin32/cygnus-2.7.2.f.1-961023/../../../../i486-cygwin32/lib/libcygwin.a(libcmain.o): In function `main':
/src/gnu/win32/src-b17/i486-cygwin32/winsup/libcmain.cc:30: undefined
reference to `WinMain AT 16'
collect2: ld returned 1 exit status

========================

Note that the order of libraries is the correct one -- -lf2c -lcygwin, so
I'm not sure what the problem is here.

fyi, I'm cross-compiling from a linux RH 4.0 box.

Any ideas how I can work around it?

Thanks
Mumit -- khan AT xraylith DOT wisc DOT edu
http://www.xraylith.wisc.edu/~khan/
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019