Description
Description
Trying to test statically linking a basic hello world app on Ubuntu 20.04 and found that it throws a seg fault inside the globalization code.
Reproduction Steps
(On Ubuntu 20.04.4 LTS x64)
dotnet new console
dotnet add package Microsoft.Dotnet.ILCompiler --prerelease
dotnet publish -r linux-x64 -c Release /p:StaticallyLinked=true --self-contained
./bin/Release/net7.0/linux-x64/native/HelloWorld
Expected behavior
Output "Hello, World!"
Actual behavior
Thread 1 "HelloWorld" received signal SIGSEGV, Segmentation fault.
0x00007fffd74b6603 in void std::call_once<void (&)()>(std::once_flag&, void (&)()) () from /lib/x86_64-linux-gnu/libicuuc.so.66
(gdb) bt
#0 0x00007fffd74b6603 in void std::call_once<void (&)()>(std::once_flag&, void (&)()) () from /lib/x86_64-linux-gnu/libicuuc.so.66
#1 0x00007fffd74b63b4 in icu_66::umtx_initImplPreInit(icu_66::UInitOnce&) () from /lib/x86_64-linux-gnu/libicuuc.so.66
#2 0x00007fffd74e79cb in ?? () from /lib/x86_64-linux-gnu/libicuuc.so.66
#3 0x00007fffd52c0a60 in ulocdata_getCLDRVersion_66 () from /lib/x86_64-linux-gnu/libicui18n.so.66
#4 0x0000000000476de2 in ValidateICUDataCanLoad () at /__w/1/s/src/native/libs/System.Globalization.Native/pal_icushim.c:375
#5 GlobalizationNative_LoadICU () at /__w/1/s/src/native/libs/System.Globalization.Native/pal_icushim.c:471
#6 0x0000000000633c5c in S_P_CoreLib_System_Globalization_GlobalizationMode_Settings___cctor ()
#7 0x00000000006209a9 in S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner__EnsureClassConstructorRun ()
#8 0x00000000006208b9 in S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner__CheckStaticClassConstructionReturnNonGCStaticBase ()
#9 0x00000000005cd103 in S_P_CoreLib_System_Globalization_CultureData__CreateCultureWithInvariantData ()
#10 0x00000000005cd1ca in S_P_CoreLib_System_Globalization_CultureData__get_Invariant ()
#11 0x00000000005ddf7c in S_P_CoreLib_System_Globalization_TextInfo___cctor ()
#12 0x00000000006209a9 in S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner__EnsureClassConstructorRun ()
#13 0x00000000006208a9 in S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner__CheckStaticClassConstructionReturnGCStaticBase ()
#14 0x000000000064cd17 in System_Console_System_Text_EncodingHelper__GetCharset ()
#15 0x000000000064cc29 in System_Console_System_Text_EncodingHelper__GetEncodingFromCharset ()
#16 0x0000000000645c09 in System_Console_System_ConsolePal__GetConsoleEncoding ()
#17 0x0000000000644cf4 in System_Console_System_Console__get_OutputEncoding ()
#18 0x0000000000644d9b in System_Console_System_Console__CreateOutputWriter ()
#19 0x0000000000644f43 in System_Console_System_Console___get_Out_g__EnsureInitialized_26_0 ()
#20 0x0000000000644e80 in System_Console_System_Console__WriteLine_12 ()
#21 0x00000000006e9f1f in __managed__Main ()
#22 0x00000000004058d9 in main (argc=1, argv=0x7fffffffe478) at /__w/1/s/src/coreclr/nativeaot/Bootstrap/main.cpp:205
Regression?
No response
Known Workarounds
Either disable globalization with <InvariantGlobalization>true</InvariantGlobalization>
or don't statically link (remove /p:StaticallyLinked=true
argument)
Configuration
dotnet version: 7.0.100-preview.3.22179.4
OS: Ubuntu 20.04.4 LTS
Architecture: x64
Other information
Reproduces on Ubuntu, but not AmazonLinux2. Ubuntu has libicuuc.so.66
but AmazonLinux2 has libicuuc.so.50
We can take a look at this, but were wondering if it was already known.
Metadata
Metadata
Assignees
Type
Projects
Status