Repository navigation
Closed
Labels
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I cannot build a project after upgrading to .NET 8, and it seems it is related to "wasm-tools"?
> [build 19/20] RUN dotnet build "--project--.csproj" -c Release -o /app/build:
29.72 /src/--path--/Pages/Confirm/ConfirmPage.razor(81,29): warning CS8602: Dereference of a possibly null reference. [/src/--path--.csproj]
29.72 emcc : error : '/usr/share/dotnet/packs/Microsoft.NET.Runtime.Emscripten.3.1.34.Node.linux-x64/8.0.0/tools/bin/node /usr/share/dotnet/packs/Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.linux-x64/8.0.0/tools/emscripten/src/compiler.js /tmp/tmpv5fivgad.json --symbols-only' failed (returned 127) [/src/--path--.csproj]
29.72 /usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/8.0.0/Sdk/WasmApp.Native.targets(513,5): error MSB3073: The command "emcc "@/usr/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/8.0.0/runtimes/browser-wasm/native/src/emcc-default.rsp" -msimd128 "@/usr/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/8.0.0/runtimes/browser-wasm/native/src/emcc-link.rsp" "@/src/--path--/obj/Release/net8.0/wasm/for-build/emcc-link.rsp"" exited with code 1. [/src/--path--/--path--.csproj]
29.72 emcc : error : '/usr/share/dotnet/packs/Microsoft.NET.Runtime.Emscripten.3.1.34.Node.linux-x64/8.0.0/tools/bin/node /usr/share/dotnet/packs/Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.linux-x64/8.0.0/tools/emscripten/src/compiler.js /tmp/tmphjdr3gmv.json --symbols-only' failed (returned 127) [/src/--path--.csproj]
29.72 /usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/8.0.0/Sdk/WasmApp.Native.targets(513,5): error MSB3073: The command "emcc "@/usr/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/8.0.0/runtimes/browser-wasm/native/src/emcc-default.rsp" -msimd128 "@/usr/share/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.browser-wasm/8.0.0/runtimes/browser-wasm/native/src/emcc-link.rsp" "@/src/--path--/obj/Release/net8.0/wasm/for-build/emcc-link.rsp"" exited with code 1. [/src/--path--.csproj]
Docker file:
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
#EXPOSE 80
#EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
# Setup xarn
RUN apt-get update
RUN apt-get install -y python3
RUN apt-get install ca-certificates curl gnupg -yq
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update
RUN apt-get install -y nodejs
RUN apt-get install -y apt-transport-https
#RUN apt-get --assume-yes install yarn
RUN dotnet workload install wasm-tools
RUN dotnet workload install wasm-experimental
# Build
COPY ["src", "src/"]
COPY [".git", ".git/"]
WORKDIR "/"
## RUN dotnet nuget add source ... (omit)
RUN dotnet restore "src/--path--/project.csproj"
COPY . .
WORKDIR "/src/--path--"
RUN dotnet build "project.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "project.csproj" -c Release -o /app/publish
# Build final image
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "project.dll"]
Expected Behavior
No response
Steps To Reproduce
Upgrade existing app to .NET with enabled features which require (or required?) wasm-tools.
If i comment on the two lines with wasm-tools it builds. Also "release" mode seems to work in local windows env.
Exceptions (if any)
No response
.NET Version
No response
Anything else?
No response
Reacted by Kamil Mrzygłód
Activity
kmrzyglod commentedon Nov 17, 2023
@jirisykora83 I have similar issue but in the logs I see also some more detailed error:
/usr/share/dotnet/packs/Microsoft.NET.Runtime.Emscripten.3.1.34.Node.linux-x64/8.0.0/tools/bin/node: error while loading shared libraries: libatomic.so.1: cannot open shared object file: No such file or directoryAfter adding install of this library to Dockerfile
RUN apt-get install -y libatomic1project is building without errorjirisykora83 commentedon Nov 17, 2023
Thank you, I tested it and it indeed resolved my issue. I leave this is open as .NET team can decided if this is by design
javiercn commentedon Nov 30, 2023
@lewing FYI
lewing commentedon Nov 30, 2023
cc @baronfel
baronfel commentedon Nov 30, 2023
@lewing what kind of dependencies does the packaged node in the wasm tools workloads have from the OS perspective? We could ask the @dotnet/dotnet-docker-contrib team to consider adding those to the SDK base image.
lewing commentedon Nov 30, 2023
based on the issue here we're just missing libatomic it does seem a little odd that the packaged node isn't pulling it in. @directhex and ideas?
directhex commentedon Nov 30, 2023
We should do what @baronfel suggested, and get
libatomic1added to the Docker images which might try to runnode.This is a small price we paid to increase our support matrix to cover older distributions than we did under .NET 7.
Node will add libatomic to its list of linked libraries when built with Clang - https://github.com/nodejs/node/blob/v18.x/node.gyp#L124-L126
Upstream Node 18.x is built against GCC/libstdc++ 8.5.0; we use Clang/libc++ 16.x. That's why the upstream packages don't include a
libatomic1dependency. Building & linking our self-built Clang/libc++ was required, because the .NET 8 target Linux distribution only has GCC/libstdc++ 5.3.1, which doesn't include support for C++17 (a prerequisite for emsdk).lbussell commentedon Dec 7, 2023
@directhex, this only applies to .NET 8, right? And does this mean that the dependency on
libatomic1could change depending on which distro we're running on (due to different versions of Clang/GCC/Node)? I don't follow this completely - where are we building our own version of Clang or Node?directhex commentedon Dec 7, 2023
Sina-Soltani commentedon Jan 31, 2024
Is this issue solved?
I have the similar issue when I'm trying to use Docker and publish the Blazor Web Assembly project which is using .NET8.
This is the error when I'm using the
dotnet publishcommand:I tried to add the bellow command to install the suggested dotnet global tool before using the
dotnet publish.RUN dotnet workload install wasm-toolsBut then comes another error:
directhex commentedon Jan 31, 2024
It's complaining it can't find python. Does your docker image include a python executable? Upstream behaviour with emsdk is to bundle Python on Windows and Mac, but rely on whatever's in the distribution image on Linux, and we followed that
Sina-Soltani commentedon Jan 31, 2024
I'm using the normal dotnet SDK that is suggested by Microsoft.
Here is the complete Dockerfile:
directhex commentedon Jan 31, 2024
@lbussell is Python in
mcr.microsoft.com/dotnet/sdk:8.0?Sina-Soltani commentedon Feb 1, 2024
The problem is solved.
I was starting the docker image inside Jetbrains Rider by clicking on the green play button inside the Dockerfile.
Somehow it leads to the issue that I've sent here.
The solution was simply building the docker image using a command prompt or terminal.
No Python or whatever packages were needed for
dotnet publish. Just thedotnet/sdk:8.0was enough.harveytriana commentedon Feb 28, 2024
Hi Sina - Can you share the Dockerfile with us. I work in Visual Studio, and I haven't found the solution to the issue.
Sina-Soltani commentedon Feb 28, 2024
Hi, this is my Dockerfile:
lewing commentedon Apr 13, 2024
@directhex @baronfel is this still needed and if so what are the next steps
lbussell commentedon Apr 15, 2024
No. We don't have a sample showing how to build a Blazor WASM app with .NET Docker images (which would involve installing Python). It is tracked by dotnet/dotnet-docker#5070.
@lewing I think the core issue described by the OP is fixed, since .NET SDK Dockerfiles now include
libatomic. That was tracked by dotnet/dotnet-docker#5033.