On Thu, 2 Apr 2026 22:16:26 GMT, Ashay Rane <[email protected]> wrote:
>> After your change, the linker reports following arguments: >> >> /out:conftest.exe >> -libpath:c:\progra~1\micros~1\18\community\vc\tools\msvc\14.50.35717\atlmfc\lib\x64 >> -libpath:c:\progra~1\micros~1\18\community\vc\tools\msvc\14.50.35717\lib\x64 >> -libpath:. >> -libpath:. >> -libpath:. >> conftest.obj >> >> >> HEAD of master works as following. I guess it implies path resolution is >> wrong on WSL. >> >> /out:conftest.exe >> -libpath:c:\progra~1\micros~1\18\community\vc\tools\msvc\14.50.35717\atlmfc\lib\x64 >> -libpath:c:\progra~1\micros~1\18\community\vc\tools\msvc\14.50.35717\lib\x64 >> -libpath:c:\progra~2\wi3cf2~1\netfxsdk\4.8\lib\um\x64 >> -libpath:c:\progra~2\wi3cf2~1\10\lib\100261~1.0\ucrt\x64 >> -libpath:c:\progra~2\wi3cf2~1\10\lib\100261~1.0\um\x64 >> conftest.obj > > @YaSuenag Thanks for letting me know about the WSL issue and for diving into > the details. And thanks also to @erikj79 for pointing out that not all > references to C: occur with the intent of reading/writing files or > directories. Indeed, the zeal to get rid of all hardcoded references wasn't > helpful. :) > > I've added a commit that gets rid of the `SYSTEMROOT` environment variable, > whose absence on WSL2 was the root of the issue. Here's the full commit > message that explains the details. > >> The key reason that the previous patch broke the build on WSL but not >> Cygwin and MSys2 was that on WSL, `SYSTEMROOT` (and related environment >> variables like `SYSTEMDRIVE`) are not set, whereas the previous patch >> was heavily reliant on these environment variables to find the drive >> letter. With `SYSTEMROOT` absent on WSL, fixpath.sh received invalid >> paths as arguments, causing it to output invalid paths like ":", thus >> ultimately breaking the build in strange ways. >> >> As Erik Joelsson pointed out, the build discovers the path to cmd.exe >> early in the process using the `PATH` env var alone (Cygwin, MSys2, and >> WSL all inherit the full Windows PATH). With the location of cmd.exe >> reliably discovered no matter the environment, we can now infer the >> drive letter and other Windows paths from the path to cmd.exe instead of >> using environment-specific variables. >> >> This patch effectively rewrites the previous commit using the path to >> cmd.exe alone. Of course, if we aren't able to detect the path to >> cmd.exe, everything in this patch will fail, but in that case, the build >> fails early, clearly indicating that there are bigger problems: >> >> ``` >> configure: error: Incorrect Windows/wsl2 setup. Could not locate cmd.exe >> configure exiting with result code 1 >> ``` >> >> Thanks to Yasumasa Suenaga for discovering the problem. Validated that >> this build works on Cygwin, WSL2, Linux, and macOS. > > I'll update the PR description to reflect the change. @raneashay The latest commit works fine on my WSL 1. Thank you for fixing! BTW is it ok not to fix test/jdk/java/awt/Dialog/FileDialogUIUpdate.java ? Your first commit has a change for it, but it has gone now... ------------- PR Comment: https://git.openjdk.org/jdk/pull/30523#issuecomment-4181314568
