delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/08/16/09:42:28

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
To: cygwin AT cygwin DOT com
Date: Thu, 16 Aug 2001 09:29:56 -0400
Subject: Re: gcc linking problem - badly installed?
Message-ID: <20010816.093004.-3754375.0.ii0@juno.com>
X-Mailer: Juno 5.0.33
MIME-Version: 1.0
X-Juno-Line-Breaks: 0-10,12-19,22-36,38-40,45-50
From: Eric Moyer <ii0 AT juno DOT com>

First, a restatement of your problem:

ld and gcc fail at linking .o files.
Particularly for hello world.

------ Excerpt from log -------
+ gcc test_c.o
/PROGS/CYGWIN/USR/BIN/ld: cannot open crt0.o: No such file or directory
collect2: ld returned 1 exit status
+ gcc -c test_c.c
+ ld test_c.o
ld: warning: cannot find entry symbol _mainCRTStartup; defaulting to
00401000
test_c.o(.text+0x1b):test_c.c: undefined reference to `__main'
test_c.o(.text+0x2d):test_c.c: undefined reference to `printf'

------ End excerpt from log -------


**** Potential solution Part 1:
I had a similar problem last week with the linker because I did not have
the right libraries installed.  The minimum packages needed to run GCC
(and g77) are:

 2646 binutils
  775 cygwin
 3455 gcc
  626 w32api

For an extra meg, download:
   34 ash
  564 bash
  406 fileutils
  236 make

(the numbers are the compressed file sizes)

(Re)installing these packages into the same base cygwin directory will
ensure that you have the correct files in /lib

**** Potential Solution Part 2:
But this may not solve your problem completely.  Though I have been
successfully compiling and running programs for a week now.  ld also
fails on my machine when executed as you specify.  gcc also gives similar
errors when executed.  Part of your problem is that you are calling the
linker without including the necessary system startup files.

The following invocation of ld works for me:
$ ld -o test_c.exe /lib/crt0.o test_c.o -lc -lkernel32


--Eric

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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