public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eric Moyer <ii0@juno.com>
To: cygwin@cygwin.com
Subject: Re: gcc linking problem - badly installed?
Date: Thu, 16 Aug 2001 06:32:00 -0000	[thread overview]
Message-ID: <20010816.093004.-3754375.0.ii0@juno.com> (raw)

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/

             reply	other threads:[~2001-08-16  6:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-16  6:32 Eric Moyer [this message]
2001-08-16  6:40 ` Christopher Faylor
  -- strict thread matches above, loose matches on Subject: below --
2001-08-14  9:57 Astrid Burghard
2001-08-14 10:23 ` Larry Hall (RFK Partners, Inc)
2001-08-14 12:33 ` Tim Prince
2001-08-19  2:14   ` Astrid Burghard
2001-08-19 13:42     ` Christopher Faylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010816.093004.-3754375.0.ii0@juno.com \
    --to=ii0@juno.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).