| www.delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD |
| X-Spam-Check-By: | sourceware.org |
| Message-ID: | <4F034228.4040602@aol.com> |
| Date: | Tue, 03 Jan 2012 13:00:08 -0500 |
| From: | Tim Prince <n8tm AT aol DOT com> |
| Reply-To: | tprince AT computer DOT org |
| User-Agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
| MIME-Version: | 1.0 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: GCC, '-pg' option and 'mcount' undefined |
| References: | <4F033EA9 DOT 8010302 AT alice DOT it> |
| In-Reply-To: | <4F033EA9.8010302@alice.it> |
| x-aol-global-disposition: | G |
| X-AOL-SCOLL-SCORE: | 0:2:366481056:93952408 |
| X-AOL-SCOLL-URL_COUNT: | 0 |
| x-aol-sid: | 3039ac1d29464f0342290796 |
| X-AOL-IP: | 69.133.204.177 |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
On 1/3/2012 12:45 PM, Angelo Graziosi wrote:
> For the sake of completeness, I want to flag the following issue I have
> found on Cygwin.
>
> I have an application that doesn't build on Cygwin (gcc-4.5.3) because
> undefined reference to `_mcount' etc... I have tried to reproduce it
> with this simple example:
>
> $ cat hello.c
> #include <stdio.h>
>
> int main()
> {
> printf("Hello World\n");
> }
>
> $ gcc -c -pg hello.c
> $ gcc hello.o -o hello
> hello.o:hello.c:(.text+0xa): undefined reference to `_mcount'
> hello.o:hello.c:(.text+0xf): undefined reference to `__monstartup'
> collect2: ld returned 1 exit status
>
> If I try the same above example (and the true application) on Mac OS X
> Lion with gcc-4.5.3 or on GNU Linux distributions like Fedora14 (gcc
> 4.5.1), Kubuntu (gcc-4.6.1), Ubuntu (i386, gcc-4.6.1), it works just fine,
>
> $ ./hello
> Hello World
>
> If I want to build the above example on Cygwin, I need to link using the
> same option '-pg',
>
> $ gcc -pg hello.o -o hello
> $ ./hello
> Hello World
>
> Yes, I can patch my true application to use '-pg' option when it needs,
> but I would know if you (Dave?) have other ideas here.
>
It's entirely normal to require the -pg option for linking pg
compilations. You may even get a version of some libraries with pg
profiling enabled.
--
Tim Prince
--
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |