delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/12/22/12:03:27

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.4 required=5.0 tests=AWL,BAYES_50,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,TW_RW,TW_WX,TW_YG,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <op.vn4ivhqs5o90vo@orion>
References: <30467239 DOT post AT talk DOT nabble DOT com> <AANLkTikCqUhVfD71CGGn6WsTASAgYVmjX2SBLoy+XgWb AT mail DOT gmail DOT com> <AANLkTinCuy-W_qdv5oR8GY664qCfPPeJ7M6jR3oSDSSK AT mail DOT gmail DOT com> <AANLkTi=oe9uXBpKQE1iyz2PB90F0ymVBB8vbrhKftYRm AT mail DOT gmail DOT com> <op DOT vn4byplj5o90vo AT orion> <AANLkTi=7ttVmyTupCkao16dPapL9Q0vPwe3c87Q-Xkd2 AT mail DOT gmail DOT com> <op DOT vn4c2ibb5o90vo AT orion> <AANLkTimgzBw-yeCOCFoBk8O54_K-1tdor-Nd+FhsEzUt AT mail DOT gmail DOT com> <op DOT vn4ivhqs5o90vo AT orion>
Date: Wed, 22 Dec 2010 18:03:03 +0100
Message-ID: <AANLkTimCp63K6WTO1tAjvyUfahVgQpYB2U9DAv=FjxE+@mail.gmail.com>
Subject: Re: mingw-targeted cross-compiler question
From: Kai Tietz <ktietz70 AT googlemail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

2010/12/22  <lemkemch AT t-online DOT de>:
> On Wed, 22 Dec 2010 15:36:01 +0100, Kai Tietz <ktietz70 AT googlemail DOT com>
> wrote:
>
>> 2010/12/22 =A0<lemkemch AT t-online DOT de>:
>>>
>>> On Wed, 22 Dec 2010 15:11:18 +0100, Kai Tietz <ktietz70 AT googlemail DOT com>
>>> wrote:
>>>
>>>> 2010/12/22 =A0<lemkemch AT t-online DOT de>:
>>>>>
>>>>> On Wed, 22 Dec 2010 14:13:15 +0100, Fr=E9d=E9ric Bron
>>>>> <frederic DOT bron AT m4x DOT org>
>>>>> wrote:
>>>>>
>>>>>>>>> I checked the Make file, it used this flag:
>>>>>>>>> gcc -mno-cygwin -g -Wl,--add-stdcall-alias -Wl,--export-all-symbo=
ls
>>>>>>>>> ...
>>>>>>>>
>>>>>>>> replace gcc by gcc-3
>>>>>>>> gcc 4 is now the default on cygwin but the cross compiler is not
>>>>>>>> supported for that version.
>>>>>>>> Fr=E9d=E9ric
>>>>>>>
>>>>>
>>>>> Well, I don't know but I'd really like to know what is the replacement
>>>>> these days for
>>>>>
>>>>> gcc -mno-cygwin -mwindows x.c
>>>>>
>>>>> I tried
>>>>>
>>>>> i686-w64-mingw32-gcc -mwindows =A0-m32 x.c
>>>>>
>>>>> but get
>>>>>
>>>>> x.c:35:13: error: expected '=3D', ',', ';', 'asm' or '__attribute__'
>>>>> before
>>>>> 'WinMain'
>>>>>
>>>>> and that also for all other option combinations that made sense to me.
>>>>>
>>>>> Thanks,
>>>>> Michael
>>>>
>>>> Btw the -m32 is superflous for the i686-w64-mingw32 cross-compiler, as
>>>> it just produces 32-bit and has no 64-bit capabilities builtin.
>>>> Could you show please your x.c file, as the message you get is a
>>>> compiler error already. I would assume that you missed to include some
>>>> header, or you were defining something which cause here the harm.
>>>
>>> Well, the program compiles just fine with the old gcc-3 -mno-cygwin but
>>> anyway, here's a stripped down version:
>>>
>>>
>>> #define WINVER 0x0500
>>> #include <windows.h>
>>>
>>> int STDCALL WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int
>>> nShow) {
>>> =A0return 0;
>>> }
>>>
>>>
>>> =A0orion> i686-w64-mingw32-gcc -mwindows -m32 xx.c
>>> xx.c:4:13: error: expected '=3D', ',', ';', 'asm' or '__attribute__' be=
fore
>>> 'WinMain'
>>> =A0orion> gcc-3 -mno-cygwin -mwindows -m32 xx.c
>>> =A0orion>
>>>
>>>
>>
>> Well, the issue is STDCALL. We don't define this macro. Sorry, can
>> find a single hint on that in msdn. Use here instead the standard
>> WINAPI and it builds on all compilers you are using.
>
> Thanks, that fixed it. =A0Don't know where I got that STDCALL from,
> it certainly wasn't my invention. =A0However, the size of the executable
> for that noop program went up from about 21kb to about 100kb. =A0cygcheck
> lists the same dlls:
>
> =A0orion> gcc-3 -mno-cygwin -mwindows -m32 xx.c
> =A0orion> ls -ls a.exe
> 24 -rwxr-x--- 1 michael None 21347 Dec 22 17:18 a.exe
> =A0orion> cygcheck ./a.exe
> d:\cygwin\home\michael\a.exe
> =A0C:\WINDOWS\system32\msvcrt.dll
> =A0 =A0C:\WINDOWS\system32\KERNEL32.dll
> =A0 =A0 =A0C:\WINDOWS\system32\ntdll.dll
> =A0orion> i686-w64-mingw32-gcc -mwindows -m32 xx.c
> =A0orion> ls -ls a.exe
> 100 -rwxr-x--- 1 michael None 100582 Dec 22 17:21 a.exe
> =A0orion> cygcheck ./a.exe
> d:\cygwin\home\michael\a.exe
> =A0C:\WINDOWS\system32\KERNEL32.dll
> =A0 =A0C:\WINDOWS\system32\ntdll.dll
> =A0C:\WINDOWS\system32\msvcrt.dll
>
> Why would that be?
>
> Michael
>
>
> --
> Problem reports: =A0 =A0 =A0 http://cygwin.com/problems.html
> FAQ: =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 http://cygwin.com/faq/
> Documentation: =A0 =A0 =A0 =A0 http://cygwin.com/docs.html
> Unsubscribe info: =A0 =A0 =A0http://cygwin.com/ml/#unsubscribe-simple
>
>

This is caused by debugging information. Simply strip executable and
it should shrink.

Kai

--
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

- Raw text -


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