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

run ClearScript in Azure Function on Macos #542

Open
Glareone opened this issue Oct 5, 2023 · 1 comment
Open

run ClearScript in Azure Function on Macos #542

Glareone opened this issue Oct 5, 2023 · 1 comment
Assignees
Labels

Comments

@Glareone
Copy link

Glareone commented Oct 5, 2023

PC: Macbook with Macos M1
Environment:

  • Azure Function SDK 4.2.0, .Net6 and\or .Net7.
  • ConsoleApplication .Net7
  • ClearScript package: Microsoft.ClearScript.osx-arm64: 7.4.3
  • IntelliJ Rider.

Executed code:
using var engine = new V8ScriptEngine(); engine.Execute("");

When I try to run ClearScript in Console App using Microsoft.ClearScript.osx-arm64: 7.4.3 - everything is fine.
But when Im trying to run it in Azure Function - I face the issue "ClearScriptV8.osx-arm64.dylib: Unable to load shared library":

SOLUTION:

  1. Copy ClearScriptV8.osx-arm64.dylib from debug\net6.0\runtimes\osx-arm64\native and paste it in *debug\net6.0* folder as well.
  2. For some reasons in Azure Function environment on Windows and Macos it requires Microsoft.ClearScript.V8.Native.osm-arm64 v.7.4.3 to be installed along with Microsoft.ClearScript.osx-arm64: 7.4.3 (for windows it's ClearScript.V8.Native.win-x64 along with ClearScript.V8)

Stack trace:
System.TypeLoadException: Cannot load ClearScript V8 library. Load failure information for ClearScriptV8.osx-arm64.dylib: /Users/Glareone/Documents/COMPANY_NAME/Azure-Function-CSharp/DSL-Functions/DSL-Parserless2/bin/Debug/net6.0/bin/runtimes/osx-arm64/native/ClearScriptV8.osx-arm64.dylib: Unable to load shared library '/Users/Glareone/Documents/COMPANY_NAME/Azure-Function-CSharp/DSL-Functions/DSL-Parserless2/bin/Debug/net6.0/bin/runtimes/osx-arm64/native/ClearScriptV8.osx-arm64.dylib' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(/Users/Glareone/Documents/COMPANY_NAME/Azure-Function-CSharp/DSL-Functions/DSL-Parserless2/bin/Debug/net6.0/bin/runtimes/osx-arm64/native/ClearScriptV8.osx-arm64.dylib, 0x0001): tried: '/Users/Glareone/Documents/COMPANY_NAME/Azure-Function-CSharp/DSL-Functions/DSL-Parserless2/bin/Debug/net6.0/bin/runtimes/osx-arm64/native/ClearScriptV8.osx-arm64.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/Glareone/Documents/COMPANY_NAME/Azure-Function-CSharp/DSL-Functions/DSL-Parserless2/bin/Debug/net6.0/bin/runtimes/osx-arm64/native/ClearScriptV8.osx-arm64.dylib' (no such file), '/Users/Glareone/Documents/COMPANY_NAME/Azure-Function-CSharp/DSL-Functions/DSL-Parserless2/bin/Debug/net6.0/bin/runtimes/osx-arm64/native/ClearScriptV8.osx-arm64.dylib' (no such file) /Users/Glareone/Documents/COMPANY_NAME/Azure-Function-CSharp/DSL-Functions/DSL-Parserless2/bin/Debug/net6.0/bin/ClearScriptV8.osx-arm64.dylib: Unable to load shared library '/Users/Glareone/Documents/COMPANY_NAME/Azure-Function-CSharp/DSL-Functions/DSL-Parserless2/bin/Debug/net6.0/bin/ClearScriptV8.osx-arm64.dylib' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(/Users/Glareone/Documents/COMPANY_NAME/Azure-Function-CSharp/DSL-Functions/DSL-Parserless2/bin/Debug/net6.0/bin/ClearScriptV8.osx-arm64.dylib, 0x0001): tried: '/Users/Glareone/Documents/COMPANY_NAME/Azure-Function-CSharp/DSL-Functions/DSL-Parserless2/bin/Debug/net6.0/bin/ClearScriptV8.osx-arm64.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/Glareone/Documents/COMPANY_NAME/Azure-Function-CSharp/DSL-Functions/DSL-Parserless2/bin/Debug/net6.0/bin/ClearScriptV8.osx-arm64.dylib' (no such file), '/Users/Glareone/Documents/COMPANY_NAME/Azure-Function-CSharp/DSL-Functions/DSL-Parserless2/bin/Debug/net6.0/bin/ClearScriptV8.osx-arm64.dylib' (no such file) /Users/Glareone/.AzureToolsForIntelliJ/AzureFunctionsCoreTools/v4/4.55.0/ClearScriptV8.osx-arm64.dylib: Unable to load shared library '/Users/Glareone/.AzureToolsForIntelliJ/AzureFunctionsCoreTools/v4/4.55.0/ClearScriptV8.osx-arm64.dylib' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(/Users/Glareone/.AzureToolsForIntelliJ/AzureFunctionsCoreTools/v4/4.55.0/ClearScriptV8.osx-arm64.dylib, 0x0001): tried: '/Users/Glareone/.AzureToolsForIntelliJ/AzureFunctionsCoreTools/v4/4.55.0/ClearScriptV8.osx-arm64.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/Glareone/.AzureToolsForIntelliJ/AzureFunctionsCoreTools/v4/4.55.0/ClearScriptV8.osx-arm64.dylib' (no such file), '/Users/Glareone/.AzureToolsForIntelliJ/AzureFunctionsCoreTools/v4/4.55.0/ClearScriptV8.osx-arm64.dylib' (no such file)    at Microsoft.ClearScript.V8.V8Proxy.LoadNativeLibrary(String baseName, String platform, String architecture, String extension)

@ClearScriptLib
Copy link
Collaborator

Hi @Glareone,

To be honest, we're unfamiliar with the Azure Functions environment. We'll take a closer look, but it could take some time. We're glad you found a workaround.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants