delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/12/23/23:53:43

From: b DOT dautrevaux AT usa DOT net (Bernard DAUTREVAUX)
Subject: RE: c++ and -mno-cygwin
23 Dec 1998 23:53:43 -0800 :
Message-ID: <01BE2EAE.86D1DBC0.b.dautrevaux.cygnus.gnu-win32@usa.net>
Reply-To: "b DOT dautrevaux AT usa DOT net" <b DOT dautrevaux AT usa DOT net>
Mime-Version: 1.0
To: "'Serguei DACHIAN'" <Serguei DOT Dachian AT univ-lemans DOT fr>,
"gnu-win32 AT cygnus DOT com" <gnu-win32 AT cygnus DOT com>

> -----Original Message-----
> From:	Serguei DACHIAN [SMTP:Serguei DOT Dachian AT univ-lemans DOT fr]
> Sent:	Wednesday, December 23, 1998 03:38
> To:	gnu-win32 AT cygnus DOT com
> Subject:	c++ and -mno-cygwin
>
> Hi everybody.
>
> Trying to compiling the simplest c++ program "Hello world"
>  > #include <iostream.h>
>  >
>  > int main ()
>  > {
>  >    cout << "Hello world." << endl;
>  >    return 0;
>  > }
> with the flag "-mno-cygwin" (just lile "g++ -mno-cygwin hello.cpp") fails
> with lots of undefined references in "libstdc++.a".  Apparently it is
> impossible to use this flag with g++/c++, but only with gcc.  Is it a bug or
> an intention??? Is there any workarround [ except rewriting the program in C
> :-))) ].
>

Hi, Serguei

You just ran into the most annoying (although curable) problem of CygWin-B20.1: 
there is a -mno-cygwin switch that correctly select Mingw32 header files 
(warning: this was not true with B20; you need B20.1) and do not link in 
libcygwin.a, so that your program will not need cygwin.dll.

HOWEVER, the other libXXX.a that you will link with may need cygwin.dll! the 
-mno-cygwin flag should select another set of libraries compiled also with the 
-mno-cygwin flag set. The problem is that these libraries are not provided, 
neither do gcc look in another directory when -mno-cygwin is given at link time 
(it only do not pass -lcygwin to the linker).

You could patch the specs file so that -mno-cygwin will look in other 
directories if you have specified -mno-cygwin, or simply add a -L switch to 
select this directory.

Now you must got the Mingw32-egcs-1.1 package (from Mumit site I think; there 
used to be a version at 
"ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/egcs-1.1/egcs-1.1-mi  
ngw32.zip" but I don't know if its up to date) to have the correct libraries 
and that should work fine: the libstdc++ there (as well as libmoldnames and 
others) are compiled to look in CRTDLL instead of CYGWIN.DLL...

If you download using th elink above, you will get the full egcs-1.1 mingw32 
compiler (to be used with B19 I think); just extract the libraries and place 
them in some convenient place and you should be working OK. I used to work this 
way, but now I've recompiled the libraries I need in my environment (I need to 
use MSVCRT.dll instead of CRTDLL.dll as Mumit binaries do, and I had to patch a 
bit some code), so I'm not sure if you can still use the header files from 
B20.1 or need to also use Mumit's header files from the same .zip as the 
libraries.

Regards,

			Bernard

PS: Cygwin maintainers, could you please provide not only Mingw32 headers but 
also the corresponding libraries, and allow to select between CRTDLL and MSVCRT 
by some switch in the compiler (personally I've patched the specs file to 
create a -use-msvcrt flag for this); there's already some support built in the 
header files and a lot of people would be pleased to be able to use MSVCRT, 
which does not have some of the annoying MSDOS limitations, like truncating the 
total command-line+environment passed to a subprocess at 1024 bytes!).

This would avoid some traffic on the mailing list and some headaches to a lot 
of people (mainly on undefined symbols at link but also, and that's weirder, 
hard to understand crashes when there is some DLL conflicts).

> Thanks in advance for any help.
>
> Serguei.
> ___________________________________________________________________________
> Serguei DACHIAN
> Laboratoire de Statistique et Processus,
> Universite du Maine, Av. Olivier Messiaen
> 72085 Le Mans CEDEX 9, FRANCE
> Tel.   : +33 (0)2 43 83 37 18
> Fax.   : +33 (0)2 43 83 35 79
> E-mail : Serguei DOT Dachian AT univ-lemans DOT fr
> WWW    : http://www.univ-lemans.fr/sciences/statist/cvs/thesard.html#dachian
>
> -
> For help on using this list (especially unsubscribing), send a message to
> "gnu-win32-request AT cygnus DOT com" with one line of text: "help"


------------------------------------------------------------------------------
Bernard Dautrevaux
Microprocess Ingéniérie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel: +33 (0) 1 47 68 80 80
Fax: +33 (0) 1 47 88 97 85
e-mail: b. dautrevaux AT usa DOT net
------------------------------------------------------------------------------


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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