This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

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

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 ( 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" National Institute for Water and Atmospheric Research (NIWA)

-- Unsubscribe info: Problem reports: Documentation: FAQ:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]