* gcc invoked from make on cygwin strips symbols from object file
@ 2011-09-20 10:51 André Kwakernaak
2011-09-20 14:22 ` Marco atzeri
0 siblings, 1 reply; 3+ messages in thread
From: André Kwakernaak @ 2011-09-20 10:51 UTC (permalink / raw)
To: cygwin
cccHi all,
I'm porting an application from a Linux environment to Cygwin. During this process I encountered the following: it seems that invoking gcc from a Makefile behaves differently over gcc being invoked directly from the command line. When ggc is invoked from within a Makefile, symbols are stripped from the object file. When gcc is invoked with exactly the same arguments, the symbols remain in the object file.
I've made a small test case, narrowing the problem down.
Consider a C file containing the following:
cyg
#include <stdio.h>
void hello()
{
printf("Hello world\n");
}
and a Makefile:
hello.o:
gcc -c hello.c
clean:
rm -f *.o *.d *.exe
When I run make an object file is build. The output of "nm hello.o" displays:
00000000 b .bss
00000000 d .data
00000000 t .text
If I run "gcc -c hello.c" directly from the command line I get object file for which nm displays:
00000000 b .bss
00000000 d .data
00000000 r .rdata
00000000 t .text
00000000 T _hello
U _printf
As you can see in the latter case the expected symbols are in the object file. Why are they missing when using the Makefile? I can't get my head around it.
I'm on Cygin 1.7.9, gcc 3.4.4, make 3.81
Any help is greatly appreciated.
André Kwakernaak
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gcc invoked from make on cygwin strips symbols from object file
2011-09-20 10:51 gcc invoked from make on cygwin strips symbols from object file André Kwakernaak
@ 2011-09-20 14:22 ` Marco atzeri
2011-09-20 14:50 ` André Kwakernaak
0 siblings, 1 reply; 3+ messages in thread
From: Marco atzeri @ 2011-09-20 14:22 UTC (permalink / raw)
To: cygwin
On 9/19/2011 2:01 PM, André Kwakernaak wrote:
> cccHi all,
>
> I'm porting an application from a Linux environment to Cygwin. During this process I encountered the following: it seems that invoking gcc from a Makefile behaves differently over gcc being invoked directly from the command line. When ggc is invoked from within a Makefile, symbols are stripped from the object file. When gcc is invoked with exactly the same arguments, the symbols remain in the object file.
>
> I've made a small test case, narrowing the problem down.
>
> Consider a C file containing the following:
> cyg
> #include<stdio.h>
>
> void hello()
>
> {
>
> printf("Hello world\n");
>
> }
>
> and a Makefile:
> hello.o:
> gcc -c hello.c
>
> clean:
> rm -f *.o *.d *.exe
>
> When I run make an object file is build. The output of "nm hello.o" displays:
> 00000000 b .bss
> 00000000 d .data
> 00000000 t .text
this looks unlikely as hello.c miss the definition of printf
>
> If I run "gcc -c hello.c" directly from the command line I get object file for which nm displays:
> 00000000 b .bss
> 00000000 d .data
> 00000000 r .rdata
> 00000000 t .text
> 00000000 T _hello
> U _printf
>
> As you can see in the latter case the expected symbols are in the object file.
> Why are they missing when using the Makefile? I can't get my head
around it.
>
> I'm on Cygin 1.7.9, gcc 3.4.4, make 3.81
>
> Any help is greatly appreciated.
>
> André Kwakernaak
is make the cygwin one ?
$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i686-pc-cygwin
$ which make
/usr/bin/make
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gcc invoked from make on cygwin strips symbols from object file
2011-09-20 14:22 ` Marco atzeri
@ 2011-09-20 14:50 ` André Kwakernaak
0 siblings, 0 replies; 3+ messages in thread
From: André Kwakernaak @ 2011-09-20 14:50 UTC (permalink / raw)
To: cygwin
Marco,
Thank you very much. You pointed me in the one direction I did not yet investigate. I'm really embarrassed by what I just found out.
Here's what happened. There was a second installation of Cygwin on this development machine... I did not know about this installation. The installation I used did not have make installed at at all.. The PATH variable included the bin directory of the second Cygwin installation. So I was using make of another cygwin installation. Removing the second installation and installing make solved the problem.
This took me 2 days...
Regards,
André Kwakernaak
>
> this looks unlikely as hello.c miss the definition of printf
>
>
> is make the cygwin one ?
>
> $ make --version
> GNU Make 3.81
> Copyright (C) 2006 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.
> There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
> PARTICULAR PURPOSE.
>
> This program built for i686-pc-cygwin
>
> $ which make
> /usr/bin/make
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-19 13:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-20 10:51 gcc invoked from make on cygwin strips symbols from object file André Kwakernaak
2011-09-20 14:22 ` Marco atzeri
2011-09-20 14:50 ` André Kwakernaak
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).