https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79867
Bug ID: 79867 Summary: [cygwin] LD_LIBRARY_PATH ignored, contaminating (nearly?) all test results Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: testsuite Assignee: unassigned at gcc dot gnu.org Reporter: daniel.santos at pobox dot com Target Milestone: --- Running the testsuite resulted in 15,308 instances of the error message "cyggfortran-4.dll: cannot open shared object file: No such file or directory" (similar for libatomic). I could see in the log file that LD_LIBRARY_PATH was set correctly and that the file did exist in that path. After much experimentation, wailing, gnashing of teeth and a few emails to the Cygwin list (https://cygwin.com/ml/cygwin/2017-03/msg00059.html) I learned that LD_LIBRARY_PATH is *not* used in Cygwin. (I presume because there's no practical way to get the Windows kernel to use it when loading libraries.) I couldn't even debug it with gdb because the link failure happened before the image's entry point was even called. This means that when we run the testsuite on Cygwin and we're expecting to test using what we have built, but are actually linking in libgcc, libgfortran, libstdc++, etc. from the environment and NOT from the build tree, so that any Cygwin-specific regression in those libraries that arise between a.) the release that is installed and b.) the version being tested will not be exposed by any normal execution of the testsuite. I'm still fairly green with DejaGnu and Tcl/expect, but perhaps the solution is to 1. Add a platform-abstracted mechanism to DejaGnu for altering the executable and library search paths, and 2. Deprecate and replace all usage (reading or modifying) of the LD_LIBRARY_PATH, SHLIB_PATH and PATH environment variables in tests. Then on Cygwin, DejaGnu can internally track the executable and library search paths separately as they are modified and set the PATH environment variable accordingly. It would also be nice to have an interim hack for running tests on Cygwin.