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

[wasi] Enabling icu in wasi.proj breaks tests #81560

Closed
radical opened this issue Feb 2, 2023 · 3 comments · Fixed by dotnet/icu#312 or #81694
Closed

[wasi] Enabling icu in wasi.proj breaks tests #81560

radical opened this issue Feb 2, 2023 · 3 comments · Fixed by dotnet/icu#312 or #81694
Assignees
Labels
arch-wasm WebAssembly architecture area-Build-mono os-wasi Related to WASI variant of arch-wasm
Milestone

Comments

@radical
Copy link
Member

radical commented Feb 2, 2023

Based on #81052

With this patch to include the icu files in the runtime pack:

diff --git a/src/mono/wasi/wasi.proj b/src/mono/wasi/wasi.proj
index 836c68ae497..6ee8c2ccbb5 100644
--- a/src/mono/wasi/wasi.proj
+++ b/src/mono/wasi/wasi.proj
@@ -7,8 +7,8 @@

   <PropertyGroup>
     <!-- TODOWASI: icu support -->
-    <!--<ICULibDir Condition="'$(MonoWasmThreads)' != 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'wasi-wasm', 'native', 'lib'))</ICULibDir>-->
-    <!--<ICULibDir Condition="'$(MonoWasmThreads)' == 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'wasi-wasm-threads', 'native', 'lib'))</ICULibDir>-->
+    <ICULibDir Condition="'$(MonoWasmThreads)' != 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'wasi-wasm', 'native', 'lib'))</ICULibDir>
+    <ICULibDir Condition="'$(MonoWasmThreads)' == 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'wasi-wasm-threads', 'native', 'lib'))</ICULibDir>
     <WasmEnableSIMD Condition="'$(WasmEnableSIMD)' == ''">false</WasmEnableSIMD>
     <FilterSystemTimeZones Condition="'$(FilterSystemTimeZones)' == ''">false</FilterSystemTimeZones>
     <WasmObjDir>$(ArtifactsObjDir)wasm</WasmObjDir>
@@ -148,10 +148,10 @@
           DependsOnTargets="GenerateWasiPropsAndRspFiles;GenerateManagedToNative;BundleTimeZones">

     <ItemGroup>
-      <!--<ICULibNativeFiles Include="$(ICULibDir)/libicuuc.a;-->
-                                  <!--$(ICULibDir)/libicui18n.a;-->
-                                  <!--$(ICULibDir)/libicudata.a" />-->
-      <!--<ICULibFiles Include="$(ICULibDir)/*.dat" />-->
+      <ICULibNativeFiles Include="$(ICULibDir)/libicuuc.a;
+                                  $(ICULibDir)/libicui18n.a;
+                                  $(ICULibDir)/libicudata.a" />
+      <ICULibFiles Include="$(ICULibDir)/*.dat" />
     </ItemGroup>
     <PropertyGroup>
       <PInvokeTableFile>$(ArtifactsObjDir)wasm/pinvoke-table.h</PInvokeTableFile>

.. building a test project with:
./dotnet.sh build /bl src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj /p:Configuration=Release /p:TargetOS=wasi / p:TargetArchitecture=wasm /t:Test -p:WasmBuildNative=true -p:EnableAggressiveTrimming=true fails with:

  Performing WASI SDK build: "/workspaces/runtime/src/mono/wasi/wasi-sdk//bin/clang" @/workspaces/runtime/artifacts/obj/System.Buffers.Tests/Release/net8.0/wasi-wasm/wasm/for-publish/clang-compile.rsp
wasm-ld : error : /workspaces/runtime/artifacts/bin/microsoft.netcore.app.runtime.wasi-wasm/Release/runtimes/wasi-wasm/native/libicudata.a: archive has no index; run ranlib to add one [/workspaces/runtime/src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj]
wasm-ld : error : /workspaces/runtime/artifacts/bin/microsoft.netcore.app.runtime.wasi-wasm/Release/runtimes/wasi-wasm/native/libicui18n.a: archive has no index; run ranlib to add one [/workspaces/runtime/src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj]
wasm-ld : error : /workspaces/runtime/artifacts/bin/microsoft.netcore.app.runtime.wasi-wasm/Release/runtimes/wasi-wasm/native/libicuuc.a: archive has no index; run ranlib to add one [/workspaces/runtime/src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj]
clang-14 : error : linker command failed with exit code 1 (use -v to see invocation) [/workspaces/runtime/src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj]
/workspaces/runtime/src/mono/wasi/build/WasiApp.Native.targets(440,5): error MSB3073: The command ""/workspaces/runtime/src/mono/wasi/wasi-sdk//bin/clang" @/workspaces/runtime/artifacts/obj/System.Buffers.Tests/Release/net8.0/wasi-wasm/wasm/for-publish/clang-compile.rsp" exited with code 1. [/workspaces/runtime/src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj]

cc @pavelsavara @mkhamoyan

@radical radical added the arch-wasm WebAssembly architecture label Feb 2, 2023
@radical radical added this to the 8.0.0 milestone Feb 2, 2023
@ghost
Copy link

ghost commented Feb 2, 2023

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

Issue Details

Based on #81052

With this patch to include the icu files in the runtime pack:

diff --git a/src/mono/wasi/wasi.proj b/src/mono/wasi/wasi.proj
index 836c68ae497..6ee8c2ccbb5 100644
--- a/src/mono/wasi/wasi.proj
+++ b/src/mono/wasi/wasi.proj
@@ -7,8 +7,8 @@

   <PropertyGroup>
     <!-- TODOWASI: icu support -->
-    <!--<ICULibDir Condition="'$(MonoWasmThreads)' != 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'wasi-wasm', 'native', 'lib'))</ICULibDir>-->
-    <!--<ICULibDir Condition="'$(MonoWasmThreads)' == 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'wasi-wasm-threads', 'native', 'lib'))</ICULibDir>-->
+    <ICULibDir Condition="'$(MonoWasmThreads)' != 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'wasi-wasm', 'native', 'lib'))</ICULibDir>
+    <ICULibDir Condition="'$(MonoWasmThreads)' == 'true'">$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'wasi-wasm-threads', 'native', 'lib'))</ICULibDir>
     <WasmEnableSIMD Condition="'$(WasmEnableSIMD)' == ''">false</WasmEnableSIMD>
     <FilterSystemTimeZones Condition="'$(FilterSystemTimeZones)' == ''">false</FilterSystemTimeZones>
     <WasmObjDir>$(ArtifactsObjDir)wasm</WasmObjDir>
@@ -148,10 +148,10 @@
           DependsOnTargets="GenerateWasiPropsAndRspFiles;GenerateManagedToNative;BundleTimeZones">

     <ItemGroup>
-      <!--<ICULibNativeFiles Include="$(ICULibDir)/libicuuc.a;-->
-                                  <!--$(ICULibDir)/libicui18n.a;-->
-                                  <!--$(ICULibDir)/libicudata.a" />-->
-      <!--<ICULibFiles Include="$(ICULibDir)/*.dat" />-->
+      <ICULibNativeFiles Include="$(ICULibDir)/libicuuc.a;
+                                  $(ICULibDir)/libicui18n.a;
+                                  $(ICULibDir)/libicudata.a" />
+      <ICULibFiles Include="$(ICULibDir)/*.dat" />
     </ItemGroup>
     <PropertyGroup>
       <PInvokeTableFile>$(ArtifactsObjDir)wasm/pinvoke-table.h</PInvokeTableFile>

.. building a test project with:
./dotnet.sh build /bl src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj /p:Configuration=Release /p:TargetOS=wasi / p:TargetArchitecture=wasm /t:Test -p:WasmBuildNative=true -p:EnableAggressiveTrimming=true fails with:

  Performing WASI SDK build: "/workspaces/runtime/src/mono/wasi/wasi-sdk//bin/clang" @/workspaces/runtime/artifacts/obj/System.Buffers.Tests/Release/net8.0/wasi-wasm/wasm/for-publish/clang-compile.rsp
wasm-ld : error : /workspaces/runtime/artifacts/bin/microsoft.netcore.app.runtime.wasi-wasm/Release/runtimes/wasi-wasm/native/libicudata.a: archive has no index; run ranlib to add one [/workspaces/runtime/src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj]
wasm-ld : error : /workspaces/runtime/artifacts/bin/microsoft.netcore.app.runtime.wasi-wasm/Release/runtimes/wasi-wasm/native/libicui18n.a: archive has no index; run ranlib to add one [/workspaces/runtime/src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj]
wasm-ld : error : /workspaces/runtime/artifacts/bin/microsoft.netcore.app.runtime.wasi-wasm/Release/runtimes/wasi-wasm/native/libicuuc.a: archive has no index; run ranlib to add one [/workspaces/runtime/src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj]
clang-14 : error : linker command failed with exit code 1 (use -v to see invocation) [/workspaces/runtime/src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj]
/workspaces/runtime/src/mono/wasi/build/WasiApp.Native.targets(440,5): error MSB3073: The command ""/workspaces/runtime/src/mono/wasi/wasi-sdk//bin/clang" @/workspaces/runtime/artifacts/obj/System.Buffers.Tests/Release/net8.0/wasi-wasm/wasm/for-publish/clang-compile.rsp" exited with code 1. [/workspaces/runtime/src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj]

cc @pavelsavara @mkhamoyan

Author: radical
Assignees: -
Labels:

arch-wasm

Milestone: 8.0.0

@radical radical added the os-wasi Related to WASI variant of arch-wasm label Feb 2, 2023
@mkhamoyan mkhamoyan self-assigned this Feb 3, 2023
@mkhamoyan
Copy link
Contributor

test

Interesting when I copy lib files from my icu build to runtime/artifacts/bin/microsoft.netcore.app.runtime.wasi-wasm/Release/runtimes/wasi-wasm/native/ test is passing.

@mkhamoyan
Copy link
Contributor

Will close once icu packages will be updated and tested on runtime.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Feb 6, 2023
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Feb 6, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Mar 9, 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 os-wasi Related to WASI variant of arch-wasm
Projects
None yet
2 participants