-
Notifications
You must be signed in to change notification settings - Fork 160
Open
Labels
Description
Hi,
We've recently discovered an issue while using ClearScript version 7.2.0.
When trying to use ClearScript in an Alpine Docker Image, the following error occurs:
Unhandled exception. System.TypeLoadException: Cannot load ClearScript V8 library. Load failure information for ClearScriptV8.linux-x64.so:
/app/runtimes/linux-x64/native/ClearScriptV8.linux-x64.so: Unable to load shared library '/app/runtimes/linux-x64/native/ClearScriptV8.linux-x64.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /app/runtimes/linux-x64/native/ClearScriptV8.linux-x64.so)
Adding the glibc compatability layer to try and solve this causes the following error:
terminate called after throwing an instance of 'std::system_error'
what(): No error information
Going back to version 7.0.0 with the glibc compatability layer works in an Alpine image without issues. Maybe this was caused by the following change in 7.1?:
Switched to static linking of C/C++ libraries to broaden Linux support
Steps to reproduce
Create simple C# project using ClearScript 7.2.0
static void Main(string[] args)
{
var engine = new V8ScriptEngine();
engine.AddHostType("Console", typeof(Console));
engine.Evaluate("Console.WriteLine('Hello from JS')");
}
Build/Publish project (dotnet build && dotnet publish)
Build Docker image with:
- Alpine base (such as
mcr.microsoft.com/dotnet/aspnet:5.0-alpine) - Alpine's glibc compatability layer (
RUN apk add gcompat) - Copy dotnet publish output and set the entrypoint to simple app
Run the Docker image and output should be the error shown above
gbd3-en and petergodec