15.3.6.5 LT_CYGPATH

For some cross-compile configurations (where the host platform is Cygwin), the cygpath program is used to convert file names from the build platform notation to the Cygwin form (technically, this conversion is from Windows notation to Cygwin notation; the conversion from the build platform format to Windows notation is performed via other means). However, because the cygpath program is not (and should not be) in the PATH on the build platform, LT_CYGPATH must specify the full build platform file name (that is, the full Unix or MSYS file name) of the cygpath program.

The reason cygpath should not be in the build platform PATH is twofold: first, cygpath is usually installed in the same directory as many other Cygwin executables, such as sed, cp, etc. If the build platform environment had this directory in its PATH, then these Cygwin versions of common Unix utilities might be used in preference to the ones provided by the build platform itself, with deleterious effects. Second, especially when Cygwin-1.7 or later is used, multiple Cygwin installations can coexist within the same Windows instance. Each installation will have separate “mount tables” specified in CYGROOT-N/etc/fstab. These mount tables control how that instance of Cygwin will map Windows file names and paths to Cygwin form. Each installation’s cygpath utility automatically deduces the appropriate /etc/fstab file. Since each CYGROOT-N/etc/fstab mount table may specify different mappings, it matters what cygpath is used.

Note that cygpath is a Cygwin application; to execute this tool from Unix requires a working and properly configured Wine installation, as well as enabling the GNU/Linux binfmt extension. Furthermore, the Cygwin setup.exe tool should have been used, via Wine, to properly install Cygwin into the Wine file system (and registry).

Unfortunately, Wine support for Cygwin is intermittent. Recent releases of Cygwin (1.7 and above) appear to require more Windows API support than Wine provides (as of Wine version 1.2); most Cygwin applications fail to execute. This includes cygpath itself. Hence, it is best not to use the LT_CYGPATH machinery in libtool when performing Unix to Cygwin cross-compiles. Similarly, it is best not to enable the GNU/Linux binfmt support in this configuration, because while Wine will fail to execute the compiled Cygwin applications, it will still exit with status zero. This tends to confuse build systems and test suites (including libtool’s own testsuite, resulting in spurious reported failures). Wine support for the older Cygwin-1.5 series appears satisfactory, but the Cygwin team no longer supports Cygwin-1.5. It is hoped that Wine will eventually be improved such that Cygwin-1.7 will again operate correctly under Wine. Until then, libtool will report warnings as described in see File Name Conversion Failure in these scenarios.

However, LT_CYGPATH is also used for the MSYS to Cygwin cross compile scenario, and operates as expected.