delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/12/22/18:28:32

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Message-ID: <41CA0303.4040203@niwa.co.nz>
Date: Thu, 23 Dec 2004 12:28:03 +1300
From: Mark Hadfield <m DOT hadfield AT niwa DOT co DOT nz>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
MIME-Version: 1.0
To: Cygwin Mailing List <cygwin AT cygwin DOT com>
Subject: g95 executables on Windows require cygwin1.dll on PATH

Hello folks

This is a contribution to a thread on comp.lang.fortran, but I thought 
it might be of interest on the Cygwin mailing list also. My apologies if 
it appears twice.

beliavsky AT aol DOT com wrote:

 > If one creates an executable using g95 on Windows, one needs a DLL to
 > be on the PATH of the machine where the executable is run. I'd guess,
 > but have not checked, that gfortran executables work the same way.


As I understand it, g95 and gfortran are currently available for Windows 
only as Cygwin applications, so the compilers require the Cygwin DLL to run.

(The g95 WWW page offers a "Self-extracting g95 for Windows systems 
without Cygwin" but last time I tried this it installed a g95-Cygwin 
executable, along with the required DLL. As an aside, I believe this is 
a violation of the Cygwin license.)

Cygwin compilers normally create Cygwin executables, ie. executables 
that require the Cygwin DLL to run. But they don't have to. The 
compilers that come with the Cygwin package (gcc, g77 etc.) accept an 
"-mno-cygwin" switch. This causes them to create executables that do 
*not* rely on the Cygwin DLL.

It seems that g95 and gfortran do not currently accept the -mno-cygwin 
switch. When I try it I get:

   g95
     /bin///ld: crt2.o: No such file: No such file or directory

   gfc
     gfc: installation problem, cannot exec 'f951': No such file or 
directory

But I imagine that some time in the future they will both support it. As 
I understand it, gfortran is intended to become part of gcc version 4.0. 
I presume this will eventually find its way into the Cygwin package and 
that "-mno-cygwin" support will be added in this process.

Note that there is another "GNU on Windows" effort, a cousin of Cygwin, 
called MinGW. Its WWW page (http://mingw.sourceforge.net/index.shtml) 
describes it as

   A collection of freely available and freely distributable
   Windows specific header files and import libraries combined
   with GNU toolsets that allow one to produce native Windows
   programs that do not rely on any 3rd-party C runtime DLLs.

I presume gcc 4 (including gfortran) will eventually find its way into 
MinGW as well.

(I do not mean to offend any Cygwin or MinGW people by suggesting that 
this will happen with no effort!)

 > I don't think executables created by g77 or commercial compilers
 > require a DLL in order to run on the target machine.

I don't think there are any commercial compilers using the Cygwin DLL 
because the licensing makes it difficult. But I'm not so sure that 
commercial compilers generally create executables that don't require a 
DLL. Don't CVF executables require a CVF run-time? (I don't know because 
I only ever run them on the machine that created them.)

With g77, as explained above, there is a Cygwin version that normally 
creates Cygwin-dependent executables, but can be told not to, and a 
MinGW version that normally doesn't.

 > Would this DLL requirement would cause problems for production use of
 > g95 and gfortran? Is there a way to add a compiler option so that the
 > needed code from the DLL is automatically inserted in the executable,
 > which could then be run on any Windows machine?


I don't think that inserting the Cygwin run-time code into the 
executable is a feasible route (from a technical or licensing 
standpoint) but avoiding the Cygwin run-time code via the -mno-cygwin" 
switch surely is. It will just need some effort to implement.


-- 
Mark Hadfield            "Ka puwaha te tai nei, Hoea tatou"
m DOT hadfield AT niwa DOT co DOT nz
National Institute for Water and Atmospheric Research (NIWA)


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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