Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm] Having space in path fails builds #92399

Closed
wants to merge 8 commits into from

Conversation

ilonatommy
Copy link
Member

@ilonatommy ilonatommy commented Sep 21, 2023

Investigating #92335.

  • Change wbt -> wbt artifacts e.g. artifacts/bin/Wasm.Build.Tests/Release/net8.0/browser-wasm/wbt/blz_checkfingerprinting_Debug_gqyxbvpe_hfq -> artifacts/bin/Wasm.Build.Tests/Release/net8.0/browser-wasm/wbt artifacts/blz_checkfingerprinting_Debug_gqyxbvpe_hfq
    The change is not in the immediate parent directory but still fails BuildPublishTests.
    Repro:
    publish with AOT on Windows/Linux/iOS.

error (Windows):

C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\8.0.0-rc.2.23479.6\Sdk\WasmApp.Native.targets(682,5
): error : Precompiling failed for C:\repos\with spaces\obj\Release\net8.0\wasm\for-publish\aot
-in\aot-instances.dll with exit code 1. [C:\repos\with spaces\withspaces.csproj]
C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\8.0.0-rc.2.23479.6\Sdk\WasmApp.Native.targets(682,5
): error : Can not open image C:\repos\with [C:\repos\with spaces\withs
paces.csproj]

in the default WasmDedup=true is caused by incorrect argv parsing in driver.c for arguments with spaces.

When dedup disabled or on Linux, error is:

# project path: /workspaces/spaces/with spaces/withSpaces.csproj
/usr/local/dotnet/7.0.306/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.13/Sdk/WasmApp.Native.targets(326,5): error : clang version 15.0.0
/usr/local/dotnet/7.0.306/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.13/Sdk/WasmApp.Native.targets(326,5): error : Target: wasm32-unknown-emscripten
/usr/local/dotnet/7.0.306/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.13/Sdk/WasmApp.Native.targets(326,5): error : Thread model: posix
/usr/local/dotnet/7.0.306/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.13/Sdk/WasmApp.Native.targets(326,5): error : InstalledDir: /usr/local/dotnet/7.0.306/packs/Microsoft.NET.Runtime.Emscripten.3.1.12.Sdk.linux-x64/7.0.13/tools/bin 
/usr/local/dotnet/7.0.306/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.13/Sdk/WasmApp.Native.targets(326,5): error : clang-15: error: no such file or directory: 'spaces/obj/Debug/net7.0/wasm/for-publish' 
/usr/local/dotnet/7.0.306/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.13/Sdk/WasmApp.Native.targets(326,5): error : emcc: error: '/usr/local/dotnet/7.0.306/packs/Microsoft.NET.Runtime.Emscripten.3.1.12.Sdk.linux-x64/7.0.13/tools/bin/clang -target wasm32-unknown-emscripten -DEMSCRIPTEN -D__EMSCRIPTEN_major__=3 -D__EMSCRIPTEN_minor__=1 -D__EMSCRIPTEN_tiny__=12 -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-cxx-exceptions -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/usr/local/dotnet/7.0.306/packs/Microsoft.NET.Runtime.Emscripten.3.1.12.Cache.linux-x64/7.0.13/tools/emscripten/cache/sysroot -Xclang -iwithsysroot/include/compat -O0 -v -DDISABLE_PERFTRACING_LISTEN_PORTS=1 -DENABLE_AOT=1 -DDRIVER_GEN=1 -DLINK_ICALLS=1 -DCORE_BINDINGS -DGEN_PINVOKE=1 -emit-llvm "-I/workspaces/spaces/with spaces/obj/Debug/net7.0/wasm/for-publish" -I/usr/local/dotnet/7.0.306/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/7.0.13/runtimes/browser-wasm/native/include/mono-2.0 -I/usr/local/dotnet/7.0.306/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/7.0.13/runtimes/browser-wasm/native/include/wasm -g3 -c /usr/local/dotnet/7.0.306/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/7.0.13/runtimes/browser-wasm/native/src/corebindings.c -o /tmp/tmpuEU9sy.tmp' failed (returned 1) 

Repro:
run the last line's command from the above error. The problem is on clang's side, even if we wrap included paths into quotations, like this:

/workspaces/runtime/artifacts/bin/dotnet-latest/packs/Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.linux-x64/9.0.0-alpha.1.23523.3/tools/bin/clang -target wasm32-unknown-emscripten -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -wasm-enable-sjlj -mllvm -disable-lsr -DEMSCRIPTEN -Werror=implicit-function-declaration --sysroot=/workspaces/runtime/artifacts/bin/dotnet-latest/packs/Microsoft.NET.Runtime.Emscripten.3.1.34.Cache.linux-x64/9.0.0-alpha.1.23523.3/tools/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -msimd128 -Oz -g3 -fwasm-exceptions -DDISABLE_PERFTRACING_LISTEN_PORTS=1 -DENABLE_AOT=1 -DDRIVER_GEN=1 -DLINK_ICALLS=1 -DGEN_PINVOKE=1 -emit-llvm "-I'/workspaces/runtime/artifacts/bin/Wasm.Build.Tests/Release/net8.0/browser-wasm/wbt artifacts/5rgnklv4_nwg/obj/Release/net8.0/browser-wasm/wasm/for-publish'" -I'/workspaces/runtime/artifacts/bin/dotnet-latest/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/9.0.0-dev/runtimes/browser-wasm/native/include/mono-2.0' -I'/workspaces/runtime/artifacts/bin/dotnet-latest/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/9.0.0-dev/runtimes/browser-wasm/native/include/wasm' -c /workspaces/runtime/artifacts/bin/dotnet-latest/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/9.0.0-dev/runtimes/browser-wasm/native/src/corebindings.c -o /tmp/tmpsavOEM.tmp

it still splits the input by spaces instead of reading the whole string in the quotation.
Fix:
replacing spaces in _EmccCFlags with "\ " in WasmApp.Native.targets. However, MsBuild does not want to cooperate on that: dotnet/msbuild#3468, dotnet/msbuild#9200

@ilonatommy ilonatommy added arch-wasm WebAssembly architecture area-Build-mono labels Sep 21, 2023
@ghost ghost assigned ilonatommy Sep 21, 2023
@ghost
Copy link

ghost commented Sep 21, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Investigating #92335.

  • Change wbt -> wbt artifacts e.g. artifacts/bin/Wasm.Build.Tests/Release/net8.0/browser-wasm/wbt/blz_checkfingerprinting_Debug_gqyxbvpe_hfq -> artifacts/bin/Wasm.Build.Tests/Release/net8.0/browser-wasm/wbt artifacts/blz_checkfingerprinting_Debug_gqyxbvpe_hfq
    The change is not in the immediate parent directory but still fails BuildPublishTests on Linux .
Author: ilonatommy
Assignees: -
Labels:

arch-wasm, area-Build-mono

Milestone: -

@ilonatommy
Copy link
Member Author

ilonatommy commented Oct 27, 2023

After escaping spaces the response file for AOT publish:

-Oz
-g
-fwasm-exceptions
-DDISABLE_PERFTRACING_LISTEN_PORTS=1
-DENABLE_AOT=1
-DDRIVER_GEN=1
-DLINK_ICALLS=1
-DGEN_PINVOKE=1
-emit-llvm
-I"/workspaces/runtime/artifacts/bin/Wasm.Build.Tests/Release/net8.0/browser-wasm/wbt\ artifacts/ldcthrrl_sml/obj/Release/net8.0/browser-wasm/wasm/for-publish"
-I"/workspaces/runtime/artifacts/bin/dotnet-latest/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/9.0.0-dev/runtimes/browser-wasm/native/include/mono-2.0"
-I"/workspaces/runtime/artifacts/bin/dotnet-latest/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/9.0.0-dev/runtimes/browser-wasm/native/include/wasm"

The error still persists. Interestingly, emcc moves the quotations when passing arguments to clang, preserving the space escape:

error : emcc: error: '/workspaces/runtime/artifacts/bin/dotnet-latest/packs/Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.linux-x64/9.0.0-alpha.1.23523.3/tools/bin/clang -target wasm32-unknown-emscripten -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -wasm-enable-sjlj -mllvm -disable-lsr -DEMSCRIPTEN -Werror=implicit-function-declaration --sysroot=/workspaces/runtime/artifacts/bin/dotnet-latest/packs/Microsoft.NET.Runtime.Emscripten.3.1.34.Cache.linux-x64/9.0.0-alpha.1.23523.3/tools/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -msimd128 -Oz -g3 -fwasm-exceptions -DDISABLE_PERFTRACING_LISTEN_PORTS=1 -DENABLE_AOT=1 -DDRIVER_GEN=1 -DLINK_ICALLS=1 -DGEN_PINVOKE=1 -emit-llvm "-I/workspaces/runtime/artifacts/bin/Wasm.Build.Tests/Release/net8.0/browser-wasm/wbt\ artifacts/ldcthrrl_sml/obj/Release/net8.0/browser-wasm/wasm/for-publish" -I/workspaces/runtime/artifacts/bin/dotnet-latest/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/9.0.0-dev/runtimes/browser-wasm/native/include/mono-2.0 -I/workspaces/runtime/artifacts/bin/dotnet-latest/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/9.0.0-dev/runtimes/browser-wasm/native/include/wasm -c /workspaces/runtime/artifacts/bin/dotnet-latest/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/9.0.0-dev/runtimes/browser-wasm/native/src/driver.c -o /tmp/tmpTWqAsv.tmp' failed

cc @radekdoulik

@radical
Copy link
Member

radical commented Oct 31, 2023

-I"/workspaces/runtime/artifacts/bin/Wasm.Build.Tests/Release/net8.0/browser-wasm/wbt\ artifacts/ldcthrrl_sml/"

Since the path is quoted we shouldn't need to escape space in wbt artifacts.

@ilonatommy
Copy link
Member Author

-I"/workspaces/runtime/artifacts/bin/Wasm.Build.Tests/Release/net8.0/browser-wasm/wbt\ artifacts/ldcthrrl_sml/"

Since the path is quoted we shouldn't need to escape space in wbt artifacts.

In the current state we have
-I"/workspaces/runtime/artifacts/bin/Wasm.Build.Tests/Release/net8.0/browser-wasm/wbt artifacts/ldcthrrl_sml/"
Failing. We will need to figure out something else.

@ilonatommy ilonatommy closed this Nov 1, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Dec 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Build-mono
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants