This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: mingw binaries from the wiki


Salvatore Filippone wrote:

> Neither do I (I never use any kind of Windows, actually...)
> Anyway, I'm told the error is
> 
> gfortran: CreateProcess: No such file or directory

That is in fact the tell-tale symptom of the _access() issue that
triggers on Vista.

> >From the mailing lists this is something that was seen in the past, but
> I am not sure I understand what the problem was, nor the solution, other
> than look for glitches in the install process; moreover it is not clear
> whether the questions raised in the past apply to Vista as well.
> What can I do to give more information? Thanks

To summarize the problem:

The implementation of access[1] that the Microsoft C library (MSVCRT)
provides has for a long time documented that it only checks for
existance as well as read/write access -- the check for executability
(X_OK) is ignored.  MS in fact doesn't even define or document as
supported any of the {R,W,X,F}_OK defines but instead instructs[2] the
use of numeric constants, none of which include the equivalent of the
X_OK bit, i.e. 1.  This sort of makes sense as Windows does not
traditionally have an 'x' bit to check as on *nix, although it can
certainly be simulated using NTFS ACLs.

In versions of MSVCRT prior to the one shipped with Vista, calling
access() with X_OK set in the mode parameter was invalid but benign. 
However, starting with Vista any call to access containing that bit
returns an invalid parameter error regardless of whether the file exists
or not.

There are a fair number of usages of access() with X_OK sprinkled about
in libiberty and the gcc drivers (collect2.c and gcc.c.)  The problem
with removing them is that gcc overloads the meaning of X_OK to also
mean to append the host's executable suffix to the filename being
searched for, so it's not just a simple matter of removing X_OK or
defining it to 0 in the gcc sources.

The MinGW team came up with a workaround.  In versions of mingw-runtime
>= 3.12, you can define __USE_MINGW_ACCESS and calls to access() will be wrapped with a static inline function that passes (mode & ~X_OK) to the MSVCRT access() function, which allows the Vista version to work similarly to all previous ones.  Thus, if you want to build a gcc that works with Vista not suffer from this you need to e.g.

make BOOTCFLAGS="-O2 -D__USE_MINGW_ACCESS" CFLAGS="-O2
-D__USE_MINGW_ACCESS"

Alternatively you could simply edit the include/io.h file and enable the
workaround unconditionally, but then you'd have to remember to do that
every time you update the mingw-runtime package.

Brian

[1] http://www.opengroup.org/onlinepubs/009695399/functions/access.html
[2] http://msdn2.microsoft.com/en-us/library/1w06ktdy.aspx


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