@Peter0x44 wrote in
https://forge.sourceware.org/gcc/gcc-TEST/pulls/172#issue-415:
> The gfortran detection logic in libgomp's configure uses "test -x" to check
> whether the $GFORTRAN program is executable. However, "test -x" only succeeds
> for absolute or relative paths that name an existing file; it fails for bare
> program names (e.g. "x86_64-w64-mingw32-gfortran") that are found via $PATH
> lookup.
The latter is -- in my current understanding -- an invalid assumption:
`GFORTRAN` is passed into libgomp `configure` via the top-level build system's
`GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/gcc/gfortran
-B$$r/$(HOST_SUBDIR)/gcc/`, and `$$r/$(HOST_SUBDIR)/gcc/gfortran` always an
absolute path, via `` r=`${PWD_COMMAND}` ``. It should never be found "via
$PATH lookup".
How are you `configure`ing your cross-compiler, could it be that it doesn't
(effectively) include `--enable-languages=fortran`? Because, in that case,
you'd get: `GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) [TARGET]-gfortran`, and
with that:
> This causes FC to be incorrectly set to "no" in cross-compilation
> environments where $GFORTRAN is a bare command name rather than a full path.
> As a result, the Fortran OpenMP module (omp_lib.mod) is never installed, and
> programs that "use omp_lib" fail with:
>
> Fatal Error: Cannot open module file 'omp_lib.mod' for reading
... this behavior is correct, as libgomp doesn't have a Fortran compiler
available (as of the current GCC build).
It's not possible to use an external Fortran compiler; GCC target libraries are
only to be built using the compilers of the current GCC build.
> The fix adds a "command -v" fallback for testing whether a command is
> available on $PATH.
So, that seems very dubious to be.
> The bug was introduced in r0-98199-g2122aa973ed (2010-01-26)
No, that commit just changed the `test -x` check from the full `"$GFORTRAN"`
"path" (which includes compiler flags) to just its
`$$r/$(HOST_SUBDIR)/gcc/gfortran` part.
> so the Fortran OpenMP module has been missing from cross-compiled installs
> for 16 years.
Quite likely even longer! Because, `test -x "x86_64-w64-mingw32-gfortran
[compiler flags here]"` is generally `false`.
Please first clarify how you're `configure`ing your cross-compiler.
--
https://forge.sourceware.org/gcc/gcc-TEST/pulls/172#issuecomment-6635