dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.37k stars 4.75k forks source link

Couldn't find a valid ICU package installed on the system. #60439

Open qyangaa opened 4 years ago

qyangaa commented 4 years ago

Problem encountered on https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/run Operating System: linux

I followed https://github.com/dotnet/core/blob/master/Documentation/build-and-install-rhel6-prerequisites.md#troubleshooting to install the package and change library path. But still doesn't work.

dotnet run
Process terminated. Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.
   at System.Environment.FailFast(System.String)
   at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
   at System.Globalization.GlobalizationMode..cctor()
   at System.Globalization.CultureData.CreateCultureWithInvariantData()
   at System.Globalization.CultureData.get_Invariant()
   at System.Globalization.CultureInfo..cctor()
   at System.String.ToLowerInvariant()
   at System.Text.EncodingHelper.GetCharset()
   at System.Text.EncodingHelper.GetEncodingFromCharset()
   at System.ConsolePal.GetConsoleEncoding()
   at System.Console+<>c.<get_OutputEncoding>b__19_0()
   at System.Threading.LazyInitializer.EnsureInitializedCore[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef, System.Object ByRef, System.Func`1<System.__Canon>)
   at System.Threading.LazyInitializer.EnsureInitialized[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef, System.Object ByRef, System.Func`1<System.__Canon>)
   at System.Console.get_OutputEncoding()
   at System.Console.CreateOutputWriter(System.IO.Stream)
   at System.Console+<>c.<get_Out>b__26_0()
   at System.Threading.LazyInitializer.EnsureInitializedCore[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef, System.Object ByRef, System.Func`1<System.__Canon>)
   at System.Threading.LazyInitializer.EnsureInitialized[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef, System.Object ByRef, System.Func`1<System.__Canon>)
   at System.Console.get_Out()
   at System.Console.WriteLine(System.String)
   at myApp.Program.Main(System.String[])
mairaw commented 4 years ago

@dagood @leecow can you help with this issue?

dagood commented 4 years ago

@tarekgh may be able to help.

tarekgh commented 4 years ago

@qyangaa this means the ICU library is not correctly installed on your system.

could you please send the output of the execution steps https://github.com/dotnet/core/blob/master/Documentation/build-and-install-rhel6-prerequisites.md?rgh-link-date=2020-08-04T23%3A33%3A28Z#troubleshooting?

jmp75 commented 4 years ago

@tarekgh If I may; I encountered the very same problem, using Debian 11 (currently the 'testing' version). This is following installation instructions as close as possible, using "snap" as per the debian dotnet install doc. I would have preferred using debian packages but this does not yet work for Debian 11 (actually, complained about not being able to find the libicu dependency to install).

~/src/myApp$ dotnet --version
3.1.402
~/src/myApp$ which dotnet
/snap/bin/dotnet
~/src/myApp$ snap list
Name               Version    Rev   Tracking       Publisher    Notes
core               16-2.46.1  9993  latest/stable  canonical✓   core
core18             20200724   1885  latest/stable  canonical✓   base
dotnet-runtime-31  3.1.8      9     latest/stable  dotnetcore✓  -
dotnet-sdk         3.1.402    98    3.1/stable     dotnetcore✓  classic

locate libicu | grep snap shows the presence of "libicu" files such as "/snap/dotnet-sdk/98/usr/lib/x86_64-linux-gnu/libicudata.so.60". Not sure this is what we are after, or if the debian package manager.

aptitude search libicu shows that libicu-dev and libicu67 are installed, and I appear to have all the right dependencies as per the dotnet install on debian - dependencies.

FWIW ss a longtime .NET/mono developer but not active with it for a few years, I am a bit confused by the experience re-acquainting myself with the latest ecosystem.

tarekgh commented 4 years ago

@qyangaa @jmp75 could you please follow the issue https://github.com/dotnet/runtime/issues/43052 which is tracking fixing same issue (I guess)?

dagood commented 4 years ago

https://github.com/dotnet/runtime/issues/43052 is specifically about this:

I would have preferred using debian packages but this does not yet work for Debian 11 (actually, complained about not being able to find the libicu dependency to install).

The rest of the comment seems to be about an issue with the .NET Snap, which I'm not very familiar with.

tarekgh commented 4 years ago

The rest of the comment seems to be about an issue with the .NET Snap, which I'm not very familiar with.

Do you know who can help with it?

CC @safern

jmp75 commented 4 years ago

I got an installation working with the ICU working after noticing that reply and prior discussions. I thought at first read what was referred to was compilation from source but this is not and much simpler a process, so may be worth expanding here. This refers to the Manual Install option.

Steps:

Downloading the "Binaries" tarball for the SDK x64 of .NET core 3.1 tar zxf dotnet-sdk-3.1.402-linux-x64.tar.gz -C "$HOME/dotnet"

nano ~/.bashrc then adding

export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet

All seem to work well this way, dotnet run or direct binary invocation. I am actually unclear as to exactly why the 'missing ICU' goes away installing this way, but will take it as is.

dagood commented 4 years ago

I am actually unclear as to exactly why the 'missing ICU' goes away installing this way

As long as you have some version of the libicu binaries installed (from version 50 to 255 currently), .NET Core will find it and use it. The Debian package is just more restrictive because it has a list of specific package dependencies rather than a numeric range.

xiangzhai commented 3 years ago

:mips-interest

xiangzhai commented 3 years ago

Hi @qyangaa

export CLR_ICU_VERSION_OVERRIDE="50.2"

If your RHEL icu version is 50.2, it is able to run yum info icu for double check the version.

We met the similar issue when porting to MIPS64. Fixed in 5.0.0.

Thanks, Leslie Zhai

ghost commented 3 years ago

Tagging subscribers to this area: @tarekgh, @safern See info in area-owners.md if you want to be subscribed.

Issue Details
Problem encountered on https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/run Operating System: linux I followed https://github.com/dotnet/core/blob/master/Documentation/build-and-install-rhel6-prerequisites.md#troubleshooting to install the package and change library path. But still doesn't work. ``` dotnet run Process terminated. Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. at System.Environment.FailFast(System.String) at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode() at System.Globalization.GlobalizationMode..cctor() at System.Globalization.CultureData.CreateCultureWithInvariantData() at System.Globalization.CultureData.get_Invariant() at System.Globalization.CultureInfo..cctor() at System.String.ToLowerInvariant() at System.Text.EncodingHelper.GetCharset() at System.Text.EncodingHelper.GetEncodingFromCharset() at System.ConsolePal.GetConsoleEncoding() at System.Console+<>c.b__19_0() at System.Threading.LazyInitializer.EnsureInitializedCore[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef, System.Object ByRef, System.Func`1) at System.Threading.LazyInitializer.EnsureInitialized[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef, System.Object ByRef, System.Func`1) at System.Console.get_OutputEncoding() at System.Console.CreateOutputWriter(System.IO.Stream) at System.Console+<>c.b__26_0() at System.Threading.LazyInitializer.EnsureInitializedCore[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef, System.Object ByRef, System.Func`1) at System.Threading.LazyInitializer.EnsureInitialized[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef, System.Object ByRef, System.Func`1) at System.Console.get_Out() at System.Console.WriteLine(System.String) at myApp.Program.Main(System.String[]) ```
Author: qyangaa
Assignees: -
Labels: `area-System.Globalization`, `untriaged`
Milestone: -
tarekgh commented 3 years ago

@safern I recall we have another issue tracking same snap problem. right?

safern commented 3 years ago

Yes we had this one: https://github.com/dotnet/runtime/issues/54148 but it was closed as snap wasn't in our priorities (accordingly to the last message). cc: @NikolaMilosavljevic

daxxog commented 2 years ago

Hi @qyangaa

export CLR_ICU_VERSION_OVERRIDE="50.2"

If your RHEL icu version is 50.2, it is able to run yum info icu for double check the version.

We met the similar issue when porting to MIPS64. Fixed in 5.0.0.

Thanks, Leslie Zhai

I had something similar happen to me on Archlinux, when the icu package was recently updated: https://github.com/archlinux/svntogit-packages/tree/36f4025b3bb8b0832b7ad452afe6bd605e894158/trunk

I did something like: export CLR_ICU_VERSION_OVERRIDE=$(pacman -Q icu | awk '{split($0,a," ");print a[2]}' | awk '{split($0,a,"-");print a[1]}') to fix.

Thanks for the tip!

WildReiserUE commented 2 years ago

Hi @qyangaa

export CLR_ICU_VERSION_OVERRIDE="50.2"

If your RHEL icu version is 50.2, it is able to run yum info icu for double check the version. We met the similar issue when porting to MIPS64. Fixed in 5.0.0. Thanks, Leslie Zhai

I had something similar happen to me on Archlinux, when the icu package was recently updated: https://github.com/archlinux/svntogit-packages/tree/36f4025b3bb8b0832b7ad452afe6bd605e894158/trunk

I did something like: export CLR_ICU_VERSION_OVERRIDE=$(pacman -Q icu | awk '{split($0,a," ");print a[2]}' | awk '{split($0,a,"-");print a[1]}') to fix.

Thanks for the tip!

This work for me! THX!!! But this has to be done before each call to the ICU. It feels like it's being overwritten by something.

nfp0 commented 1 year ago

Hi @qyangaa

export CLR_ICU_VERSION_OVERRIDE="50.2"

If your RHEL icu version is 50.2, it is able to run yum info icu for double check the version. We met the similar issue when porting to MIPS64. Fixed in 5.0.0. Thanks, Leslie Zhai

I had something similar happen to me on Archlinux, when the icu package was recently updated: https://github.com/archlinux/svntogit-packages/tree/36f4025b3bb8b0832b7ad452afe6bd605e894158/trunk

I did something like: export CLR_ICU_VERSION_OVERRIDE=$(pacman -Q icu | awk '{split($0,a," ");print a[2]}' | awk '{split($0,a,"-");print a[1]}') to fix.

Thanks for the tip!

@daxxog This worked for me. Thanks! I'm still being affected by this issue today on Arch. So, in our case, the root cause is on the Arch package? Is there an issue open for it?

bernardbr commented 3 months ago

Hi @qyangaa

export CLR_ICU_VERSION_OVERRIDE="50.2"

If your RHEL icu version is 50.2, it is able to run yum info icu for double check the version. We met the similar issue when porting to MIPS64. Fixed in 5.0.0. Thanks, Leslie Zhai

I had something similar happen to me on Archlinux, when the icu package was recently updated: https://github.com/archlinux/svntogit-packages/tree/36f4025b3bb8b0832b7ad452afe6bd605e894158/trunk

I did something like: export CLR_ICU_VERSION_OVERRIDE=$(pacman -Q icu | awk '{split($0,a," ");print a[2]}' | awk '{split($0,a,"-");print a[1]}') to fix.

Thanks for the tip!

Thank you!

For the Ubuntu, you can do the same:

export CLR_ICU_VERSION_OVERRIDE=$(dpkg -s libicu-dev | grep '^Version:' | awk '{split($2,a,"-"); print a[1]}')