Description
#.NET Custom Runtime issues with libicu
Custom runtimes are typically used to run newer versions of .NET then supported in the Lambda Managed runtimes. When deploying a .NET Lambda function using Custom Runtimes, the function may fail due to issues with the libicu
library. This problem manifests differently depending on the Amazon Linux version and architecture:
On Amazon Linux 2 with ARM64 architecture:
The function fails with the following error:
Cannot get symbol ucol_setMaxVariable_50 from libicui18n
Error: /lib64/libicui18n.so.50: undefined symbol: ucol_setMaxVariable_50
Aborted
This is due to .NET requiring version 53 and above of the native dependency libicu
and Amazon Linux 2 has version 50. We are looking at getting the version of libicu updated in Amazon Linux 2.
On Amazon Linux 2023 (all architectures):
The function fails because libicu is not present on the system at all. https://docs.aws.amazon.com/linux/al2023/ug/amzn2-al2023-ami.html
To workaround this issue, you can include a newer version of libicu in your Lambda function that will unblock custom runtimes. To include libicu with your .NET Lambda function, include the following snippet in your csproj or fsproj file.
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="68.2.0.6" />
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.6" />
</ItemGroup>