Skip to content

[rcore][drm] Link failure for eglGetPlatformDisplay() on Mali GPUs with stripped EGL symbol tables #5777

@KamilloDev

Description

@KamilloDev

Issue description

When compiling raylib 6.0 with PLATFORM=PLATFORM_DRM on devices with Mali GPUs (specifically Mali-G52), the build fails with:

/usr/bin/ld: /usr/local/lib/libraylib.a(rcore.o): in function `InitPlatform':
rcore.c:(.text+0x1dfa4): undefined reference to `eglGetPlatformDisplay'
collect2: error: ld returned 1 exit status

Root Cause
In src/platforms/rcore_drm.c, the #if defined(EGL_VERSION_1_5) check is a compile-time preprocessor check. Since libegl1-mesa-dev defines EGL_VERSION_1_5 in its headers, the preprocessor always takes the top branch and compiles a direct call to eglGetPlatformDisplay.
However, the Mali driver ships libEGL.so as a stripped binary, the function physically exists in the binary but the symbol table is removed, so the linker cannot resolve it by name at link time even though it would work at runtime.

This can be confirmed with:

nm /usr/lib/aarch64-linux-gnu/libEGL.so
# nm: no symbols

strings /usr/lib/aarch64-linux-gnu/libEGL.so.1 | grep eglGetPlatformDisplay
# eglGetPlatformDisplay

Because of this the existing #else fallback to eglGetDisplay never makes it into the compiled binary at all, the preprocessor removes it before compilation.

Workaround

Until fixed, patching rcore_drm.c line 1417 to use eglGetDisplay directly works:
platform.device = eglGetDisplay((EGLNativeDisplayType)platform.gbmDevice);

Environment

Device: Powkiddy RGB30
GPU: Mali-G52
OS: dArkOS (Debian Trixie based)
EGL: Mesa 25.0.7 (pkg-config --modversion egl reports 1.5)

Code Example

#include "raylib.h"

int main(void)
{
    InitWindow(720, 720, "raylib example - basic window");

    while (!WindowShouldClose())
    {
        BeginDrawing();
            ClearBackground(RAYWHITE);
            DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
        EndDrawing();
    }

    CloseWindow();

    return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions