Closed jsturtevant closed 1 week ago
Thank you for the report. I can reproduce the problem.
cannot open C:\\repos\\wasi-sdk\\bin\\wasm-ld: no such file or directory
The longest path in the response file has < 260 chars and is invariant of project's location - it seems it is not directly connected with long path issues, e.g. browser on AOT https://github.com/dotnet/runtime/issues/103625.
C:/Program Files/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.wasi-wasm/9.0.0-preview.7.24405.7/runtimes/wasi-wasm/native/libmono-component-diagnostics_tracing-stub-static.a
From some reason when I specify the linker (originally we run with -Wl
option that tells Clang to pass an argument to the linker, which is wasm-ld, i.e. LLD targeting WASM), by changing from
<Exec Command=""$(WasiClang)" "@$(_WasmLinkRsp)"" />
to
<Exec Command=""$(WasiClang)" -fuse-ld=$(WASI_SDK_PATH)\bin\wasm-ld.exe "@$(_WasmLinkRsp)"" />
it starts working. Is it possible that clang does not know that linker for windows should have .exe
extension? @radekdoulik
As a fix I will add conditional execution depending on the OS, unless you have a better suggestion.
Checking the short path scenario I am not that sure the proposed fix makes sense - project in short path location does not have the problem with linker extension.
Differences between long and short path scenario:
C:\Users\Public\projects\tests1\really\log\file\path\mess\up\clang\MonoApp
74 chars - NOT OK
End of search list.
"C:\\repos\\wasi-sdk\\bin\\wasm-component-ld" "@C:\\Users\\USER~1\\AppData\\Local\\Temp\\response-ebfeef.txt"
Arguments passed via response file:
"-m" "wasm32" "--wasm-ld-path" "C:\\repos\\wasi-sdk\\bin\\wasm-ld" "-LC:/repos/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasip2"
C:\Users\Public\projects\tests\really\log\file\path\mess\up\clang\MonoApp
73 chars - OK
End of search list.
"C:\\repos\\wasi-sdk\\bin\\wasm-component-ld" -m wasm32 --wasm-ld-path "C:\\repos\\wasi-sdk\\bin\\wasm-ld" -LC:/repos/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasip2
To make sure it's Windows only problem I checked Linux and it's not failing in /workspaces/long-path-test-for-the-windows-issue-to-see-if-linux-also-has-problems/another-directory-just-to-make-sure/MonoApp
(126 chars).
To check how if it's a regression I checked wasi-sdk 23
. It is not getting to the linking step, it's failing on compilation step:
Failed to compile C:\Users\user\source\repos\runtime-fork\.dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.wasi-wasm\9.0.0-preview.7.24405.7\runtimes\wasi-wasm\native\src\synthetic-pthread.c -> C:\Users\user\source\repos\issue-106845-wasi-long-path-windows\loong\obj\De
bug\net9.0\wasi-wasm\wasm\for-build\synthetic-pthread.o
Description
When creating a wasi mono project following https://github.com/dotnet/runtime/tree/main/src/mono/wasi#prototype-wasi-support in preview 7 if the path the project is installed on is long then it fails to build with error:
Reproduction Steps
mkdir projects\component\test\really\log\file\path\mess\up\clang\
use project file:
Expected behavior
project to build
Actual behavior
fails to build.
Regression?
no I don't think so
Known Workarounds
move to shorter path
Configuration
.NET v9.0.100-preview.7.24407.12
Other information
this might be an issue with wasi-sdk or clang project, but I couldn't reproduce it with a simple c program and build script
Found when adding dotnet mono support to https://github.com/bytecodealliance/componentize-dotnet and adding the project file to the
~\projects\componentize-dotnet\test\WasmComponentSdkTest\testapps\MonoApp
folder