* Re: gcc linking problem - badly installed?
@ 2001-08-16 6:32 Eric Moyer
2001-08-16 6:40 ` Christopher Faylor
0 siblings, 1 reply; 7+ messages in thread
From: Eric Moyer @ 2001-08-16 6:32 UTC (permalink / raw)
To: cygwin
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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gcc linking problem - badly installed?
2001-08-16 6:32 gcc linking problem - badly installed? Eric Moyer
@ 2001-08-16 6:40 ` Christopher Faylor
0 siblings, 0 replies; 7+ messages in thread
From: Christopher Faylor @ 2001-08-16 6:40 UTC (permalink / raw)
To: cygwin
On Thu, Aug 16, 2001 at 09:29:56AM -0400, Eric Moyer wrote:
>First, a restatement of your problem:
>
>ld and gcc fail at linking .o files.
>Particularly for hello world.
There is a very simple answer to this question: Don't use 'ld' to link
your files.
So, either:
gcc -o test_c.exe test_c.c
or
gcc -c test_c.c
gcc -o test_c.exe test_c.o
cgf
>------ 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/
--
cgf@cygnus.com Red Hat, Inc.
http://sources.redhat.com/ http://www.redhat.com/
--
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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gcc linking problem - badly installed?
2001-08-19 2:14 ` Astrid Burghard
@ 2001-08-19 13:42 ` Christopher Faylor
0 siblings, 0 replies; 7+ messages in thread
From: Christopher Faylor @ 2001-08-19 13:42 UTC (permalink / raw)
To: cygwin; +Cc: Astrid.Burghard
On Sun, Aug 19, 2001 at 11:14:25AM +0200, Astrid Burghard wrote:
>Tim Prince wrote:
>> The gcc and g77 commands invoke the correct link and library
>> specifications, if properly installed. There is no way that the
>> ld command by itself will know what to do. crt0.o appears in /lib
>> in my installation.
>
>Thanks for your answer.
>
>I found crt0.o in /Progs/Cygwin/usr/lib and I guess,
>my gcc doesn't find it. I found in gcc.info-21, node
>drivers, that a macro named STANDARD_STARTFILE_PREFIX
>should tell gcc, where to look for crt0.o. But compi-
>lation of
>
>#define STANDARD_PREFIX "/Progs/Cygwin/usr/lib"
>#include <stdio.h>
>main() { printf( "%s\n", "Hello world!" ); }
>
>gave the known error message:
>
>/PROGS/CYGWIN/USR/BIN/ld: cannot open crt0.o: No such file or directory
>collect2: ld returned 1 exit status
>
>How to tell gcc where to search for the startfiles?
You probably unset whatever environment variables you have set which are confusing
gcc.
cgf
--
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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gcc linking problem - badly installed?
2001-08-14 12:33 ` Tim Prince
@ 2001-08-19 2:14 ` Astrid Burghard
2001-08-19 13:42 ` Christopher Faylor
0 siblings, 1 reply; 7+ messages in thread
From: Astrid Burghard @ 2001-08-19 2:14 UTC (permalink / raw)
To: cygwin
Tim Prince wrote:
> The gcc and g77 commands invoke the correct link and library
> specifications, if properly installed. There is no way that the
> ld command by itself will know what to do. crt0.o appears in /lib
> in my installation.
Thanks for your answer.
I found crt0.o in /Progs/Cygwin/usr/lib and I guess,
my gcc doesn't find it. I found in gcc.info-21, node
drivers, that a macro named STANDARD_STARTFILE_PREFIX
should tell gcc, where to look for crt0.o. But compi-
lation of
#define STANDARD_PREFIX "/Progs/Cygwin/usr/lib"
#include <stdio.h>
main() { printf( "%s\n", "Hello world!" ); }
gave the known error message:
/PROGS/CYGWIN/USR/BIN/ld: cannot open crt0.o: No such file or directory
collect2: ld returned 1 exit status
How to tell gcc where to search for the startfiles?
Thank you again
Enno (c/o Astrid)
--
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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gcc linking problem - badly installed?
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
1 sibling, 1 reply; 7+ messages in thread
From: Tim Prince @ 2001-08-14 12:33 UTC (permalink / raw)
To: Astrid Burghard, cygwin
----- Original Message -----
From: "Astrid Burghard" <Astrid.Burghard@t-online.de>
To: <cygwin@cygwin.com>
Sent: Tuesday, August 14, 2001 9:57 AM
Subject: gcc linking problem - badly installed?
> Hi,
>
> I am new to this list, so please excuse me and
> give me a hint if this topic was treated here
> before.
>
> I tried some simple C and F77 "hello world"
> programmes to get compiled and linked by "gcc"
> and "gcc -c" + "ld". The .o was created by
> "gcc -c" without error message, but both direct
> executable creation with "gcc" and linking the
> .o by "ld" failed, giving different error
> messages. The .log I appenden at the bottom of
> the email. Does anyone have an idea what is
> going wrong?
>
> Thanks in advance
>
> Enno.
>
> ------------------ start of
log ----------------------------------------
> + cat test_c.c
> /*---------------- test_c.c ----------
start -------------------------*/
> #include <stdio.h>
> main()
> {
> printf( "%s\n", "Hello world!" );
> }
> /*---------------- test_c.c ----------
end ---------------------------*/
> + 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'
> + cat test_f.f
> *----------------- test_f.f ----------
start ---------------------------
> program testf
> print*, 'Hello world!'
> end
> *----------------- test_f.f ----------
end -----------------------------
> + gcc test_f.o
> /PROGS/CYGWIN/USR/BIN/ld: cannot open crt0.o: No such file or
directory
> collect2: ld returned 1 exit status
> + gcc -c test_f.f
> + ld test_f.o
> ld: warning: cannot find entry symbol _mainCRTStartup;
defaulting to 00401000
> test_f.o(.text+0x23):test_f.f: undefined reference to `s_wsle'
> test_f.o(.text+0x3c):test_f.f: undefined reference to `do_lio'
> test_f.o(.text+0x44):test_f.f: undefined reference to `e_wsle'
> test_f.o(.text+0x53):test_f.f: undefined reference to `s_stop'
>
The gcc and g77 commands invoke the correct link and library
specifications, if properly installed. There is no way that the
ld command by itself will know what to do. crt0.o appears in /lib
in my installation.
--
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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gcc linking problem - badly installed?
2001-08-14 9:57 Astrid Burghard
@ 2001-08-14 10:23 ` Larry Hall (RFK Partners, Inc)
2001-08-14 12:33 ` Tim Prince
1 sibling, 0 replies; 7+ messages in thread
From: Larry Hall (RFK Partners, Inc) @ 2001-08-14 10:23 UTC (permalink / raw)
To: Astrid Burghard, cygwin
At 12:57 PM 8/14/2001, Astrid Burghard wrote:
>Hi,
>
>I am new to this list, so please excuse me and
>give me a hint if this topic was treated here
>before.
When you have a question that you think may be something
that has been covered before, its a good idea to check the
FAQ, documentation, and email archives for related information.
I mention this FYI only.
>I tried some simple C and F77 "hello world"
>programmes to get compiled and linked by "gcc"
>and "gcc -c" + "ld". The .o was created by
>"gcc -c" without error message, but both direct
>executable creation with "gcc" and linking the
>.o by "ld" failed, giving different error
>messages. The .log I appenden at the bottom of
>the email. Does anyone have an idea what is
>going wrong?
>
If ld can't find crt0.o, your Cygwin installation is incorrect. Please
rerun setup and make sure you install *all* packages and that the
installation completes successfully. If you do this and still have the
same problem, please send the setup.log file and the results of
cygcheck -s -r -v (if possible) to the list for analysis.
Larry Hall lhall@rfk.com
RFK Partners, Inc. http://www.rfk.com
118 Washington Street (508) 893-9779 - RFK Office
Holliston, MA 01746 (508) 893-9889 - FAX
--
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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* gcc linking problem - badly installed?
@ 2001-08-14 9:57 Astrid Burghard
2001-08-14 10:23 ` Larry Hall (RFK Partners, Inc)
2001-08-14 12:33 ` Tim Prince
0 siblings, 2 replies; 7+ messages in thread
From: Astrid Burghard @ 2001-08-14 9:57 UTC (permalink / raw)
To: cygwin
Hi,
I am new to this list, so please excuse me and
give me a hint if this topic was treated here
before.
I tried some simple C and F77 "hello world"
programmes to get compiled and linked by "gcc"
and "gcc -c" + "ld". The .o was created by
"gcc -c" without error message, but both direct
executable creation with "gcc" and linking the
.o by "ld" failed, giving different error
messages. The .log I appenden at the bottom of
the email. Does anyone have an idea what is
going wrong?
Thanks in advance
Enno.
------------------ start of log ----------------------------------------
+ cat test_c.c
/*---------------- test_c.c ---------- start -------------------------*/
#include <stdio.h>
main()
{
printf( "%s\n", "Hello world!" );
}
/*---------------- test_c.c ---------- end ---------------------------*/
+ 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'
+ cat test_f.f
*----------------- test_f.f ---------- start ---------------------------
program testf
print*, 'Hello world!'
end
*----------------- test_f.f ---------- end -----------------------------
+ gcc test_f.o
/PROGS/CYGWIN/USR/BIN/ld: cannot open crt0.o: No such file or directory
collect2: ld returned 1 exit status
+ gcc -c test_f.f
+ ld test_f.o
ld: warning: cannot find entry symbol _mainCRTStartup; defaulting to 00401000
test_f.o(.text+0x23):test_f.f: undefined reference to `s_wsle'
test_f.o(.text+0x3c):test_f.f: undefined reference to `do_lio'
test_f.o(.text+0x44):test_f.f: undefined reference to `e_wsle'
test_f.o(.text+0x53):test_f.f: undefined reference to `s_stop'
--
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/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2001-08-19 13:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-16 6:32 gcc linking problem - badly installed? Eric Moyer
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
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).