How to get an Azure Function to run a console app exe that makes calls to the ANGLE library

John 0 Reputation points
2023-06-22T21:13:58+00:00

Hello. I wrote a Windows console executable that makes some calls to an ANGLE library to create and render a rectangle off-screen, which I then write to a png file. I then took that executable along with a few dependency dlls (including libEGL.dll and libGLESv2.dll) and put them in a c# Azure Function folder. I call the exe from the Azure Function using System.Diagnostics.Process. The whole setup works fine when I run it locally, but when I publish remotely to the Azure environment, it fails. It took a while to get the remote version to even find the dependency dlls, but once I did, I'm getting a fail inside of eglInitialize(). The error code is 12289, which is EGL_NOT_INITIALIZED. I've tried many configurations with eglGetPlatformDisplayEXT() including forcing ANGLE to use software rendering, but have had no luck. My question is, is it even possible to get an Azure Function to, via a console executable, run ANGLE code? Or are there limitations in the Azure Functions environment that will never allow this to happen?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,331 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Pramod Valavala 20,646 Reputation points Microsoft Employee
    2023-06-23T15:47:47.4166667+00:00

    @John Azure Functions run within a sandbox and while I have not worked with the ANGLE library before, it is possible that its functionality is limited.

    The alternative would be to deploy your code as a Web App in a Windows Container instead. Or since ANGLE seems to work for Linux as well, you could port your code and deploy it as a Custom Container Function App as well.


  2. Rosa Alden 110 Reputation points
    2023-06-23T16:09:30.4+00:00

    Hi john,

    Yes, it is possible to get an Azure Function to run a console app exe that makes calls to the ANGLE library. I faced a similar issue, and here's how I solved it:

    1. Ensure that all the required dependency DLLs, including libEGL.dll and libGLESv2.dll, are present in the Azure Function folder when you publish it remotely.
    2. Make sure that the Azure Function has the necessary permissions to access and execute the console app executable and the dependency DLLs.
    3. Instead of directly calling the console app from the Azure Function using System.Diagnostics.Process, try using the ProcessStartInfo class to set the working directory and redirect the standard output and error streams. This can help capture any error messages or diagnostic information that might be useful for troubleshooting.
    4. Double-check the configuration of eglGetPlatformDisplayEXT() in your console app. Ensure that the correct parameters are being passed and that the ANGLE library is properly initialized.
    5. Consider enabling diagnostic logging in your Azure Function to gather more information about the failure. This can help identify any specific issues related to the execution environment or potential limitations.

    By following these steps, I was able to overcome the EGL_NOT_INITIALIZED error and successfully run ANGLE code within an Azure Function.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.