ptitSeb / box64

Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices
https://box86.org
MIT License
3.89k stars 286 forks source link

RIVE box64 + gl4es SIGSEGV libc.so.6 #1151

Closed Cebion closed 10 months ago

Cebion commented 11 months ago

Hey ptitseb!

I'm testing box64 on my rk3326 chipset on AmberELEC after good results i had with box86. I previously did some tests with box64 on world of goo where both the i386 aswell as the amd64 binaries were present. But could not get it to run then. Now i tried this one. Maybe you have an idea what's going on.

Box64 and gl4es built from latest commit.

GL4ES via -DNOX11=ON -DGLX_STUBS=ON -DEGL_WRAPPER=ON -DGBM=ON Box64 via -DARM64=ON -DARM_DYNAREC=ON

Game run via

# Setup GL4ES
export LIBGL_ES=2
export LIBGL_GL=21
export LIBGL_FB=4

# Setup Box64
#export BOX64_ALLOWMISSINGLIBS=1
export BOX64_LOG=1
export BOX64_DLSYM_ERROR=1
export BOX64_SHOWSEGV=1
export BOX64_SHOWBT=1
export BOX64_ROLLING_LOG=1

export SDL_VIDEO_GL_DRIVER="$GAMEDIR/box64/native/libGL.so.1"
$GAMEDIR/box64/box64 gamedata/RIVE.bin.x86_64

LDD of the binary

cebion@Cebion-LT:/mnt/c/linuxgames/rive/data/x86_64$ ldd RIVE.bin.x86_64
        linux-vdso.so.1 (0x00007ffc7d979000)
        libopenal.so.1 => /mnt/c/linuxgames/rive/data/x86_64/./lib64/libopenal.so.1 (0x00007f316c594000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f316c55c000)
        libSDL2-2.0.so.0 => /mnt/c/linuxgames/rive/data/x86_64/./lib64/libSDL2-2.0.so.0 (0x00007f316c230000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f316c04e000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f316beff000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f316bee2000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f316bcf0000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f316bce6000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f316bce0000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f316c802000)

Log:

./Box64.sh
No sudo present.
BOX64 using "/roms/ports/box64/box64/native/libGL.so.1" as libGL.so.1
Show Segfault signal even if a signal handler is present
Show a Backtrace when a Segfault signal is caught
Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL SHA1 SHA2 PageSize:4096 Running on Cortex-A35 with 4 Cores
Params database has 14 entries
BOX64: Didn't detect 48bits of address space, considering it's 39bits
Counted 28 Env var
BOX64 LIB PATH: /roms/ports/box64/box64/native/:/usr/lib/aarch64-linux-gnu/:/usr/lib/:/roms/ports/box64/libs/:/usr/lib/:/usr/lib/pulseaudio/:/usr/lib32/:/roms/ports/box64/box64/x64/:/roms/ports/box64/box64/native/:/roms/ports/box64/libs/x64/:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/
BOX64 BIN PATH: ./:bin/:/usr/bin/:/usr/sbin/:/usr/local/bin/:/usr/bin/:/storage/bin/
Looking for gamedata/RIVE.bin.x86_64
Rename process to "RIVE.bin.x86_64"
Using native(wrapped) libopenal.so.1
Using native(wrapped) libpthread.so.0
Using native(wrapped) libSDL2-2.0.so.0
Using native(wrapped) libdl.so.2
Using native(wrapped) libm.so.6
Using native(wrapped) librt.so.1
Using emulated /roms/ports/box64/box64/x64/libstdc++.so.6
Using emulated /roms/ports/box64/box64/x64/libgcc_s.so.1
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
Using native(wrapped) libutil.so.1
LIBGL: Initialising gl4es
LIBGL: v1.1.5 built on Dec 20 2023 23:25:08
LIBGL: using GBM
LIBGL: Using GLES 2.0 backend
LIBGL: loaded: libGLESv2.so
LIBGL: loaded: libEGL.so
LIBGL: loaded: libgbm.so
LIBGL: loaded: libdrm.so
LIBGL: Using GLES 2.0 backend
LIBGL: GBM on card /dev/dri/card0 is Available
LIBGL: Hardware Full NPOT detected and used
LIBGL: Extension GL_EXT_blend_minmax  detected and used
LIBGL: FBO are in core, and so used
LIBGL: PointSprite are in core, and so used
LIBGL: CubeMap are in core, and so used
LIBGL: BlendColor is in core, and so used
LIBGL: Blend Subtract is in core, and so used
LIBGL: Blend Function and Equation Separation is in core, and so used
LIBGL: Texture Mirrored Repeat is in core, and so used
LIBGL: Extension GL_OES_mapbuffer  detected
LIBGL: Extension GL_OES_element_index_uint  detected and used
LIBGL: Extension GL_OES_packed_depth_stencil  detected and used
LIBGL: Extension GL_OES_depth24  detected and used
LIBGL: Extension GL_OES_rgb8_rgba8  detected and used
LIBGL: Extension GL_EXT_texture_format_BGRA8888  detected and used
LIBGL: Extension GL_OES_depth_texture  detected and used
LIBGL: Extension GL_OES_texture_stencil8  detected and used
LIBGL: Extension GL_EXT_texture_rg  detected and used
LIBGL: Extension GL_EXT_color_buffer_float  detected and used
LIBGL: Extension GL_EXT_color_buffer_half_float  detected and used
LIBGL: high precision float in fragment shader available and used
LIBGL: Max vertex attrib: 16
LIBGL: Extension GL_OES_standard_derivatives  detected and used
LIBGL: Extension GL_ARM_shader_framebuffer_fetch detected and used
LIBGL: Extension GL_OES_get_program_binary  detected and used
LIBGL: Number of supported Program Binary Format: 1
LIBGL: Max texture size: 8192
LIBGL: Max Varying Vector: 15
LIBGL: Texture Units: 16/16 (hardware: 16), Max lights: 8, Max planes: 6
LIBGL: Max Color Attachments: 1 / Draw buffers: 1
LIBGL: Hardware vendor is ARM
LIBGL: sRGB surface supported
LIBGL: EGLImage to Texture2D supported
LIBGL: EGLImage to RenderBuffer supported
LIBGL: Targeting OpenGL 2.1
LIBGL: Not trying to batch small subsequent glDrawXXXX
LIBGL: try to use VBO
LIBGL: glXMakeCurrent FBO workaround enabled
LIBGL: FBO workaround for using binded texture enabled
LIBGL: Force texture for Attachment color0 on FBO
LIBGL: Hack to trigger a SwapBuffers when a Full Framebuffer Blit on default FBO is done
LIBGL: glX Will try to recycle EGL Surface
LIBGL: Current folder is:/storage/roms/ports/box64/gamedata
LIBGL: Loaded a PSA with 15 Precompiled Programs
Call to dlopen("/roms/ports/box64/box64/native/libGL.so.1"/0x376622a0, 101)
Using native(wrapped) libGL.so.1
dlopen: New handle 0x4 (/roms/ports/box64/box64/native/libGL.so.1), dlopened=1
Calling getGLProcAddress[0x7fb3cf6090]("glGetString") => Last calls
30347|PltResolver "SDL_ConvertSurface" => return 0x38065670
30347|0xba582e: Calling SDL_ConvertSurface (/usr/lib/libSDL2-2.0.so.0)(0x38065670, 0x380656E0, 0x0, ...) => return 0x38066120
30347|PltResolver "SDL_FreeSurface" => return 0x38066120
30347|0xba5839: Calling SDL_FreeSurface (/usr/lib/libSDL2-2.0.so.0)(0x38065670, 0x380656E0, 0x0, ...) => return 0x38066120
30347|0xba5843: Calling free (gamedata/RIVE.bin.x86_64)(0x7FA9E71010, 0x380656E0, 0x0, ...) => return 0x38066120
30347|PltResolver "SDL_SetWindowIcon" => return 0x38066120
30347|0xa88bf6: Calling SDL_SetWindowIcon (/usr/lib/libSDL2-2.0.so.0)(0x37DE5C90, 0x38066120, 0x0, ...) => return 0x38066120
30347|0xa88bfe: Calling SDL_FreeSurface (/usr/lib/libSDL2-2.0.so.0)(0x38066120, 0x38066120, 0x0, ...) => return 0x38066120
30347|0xa88e3f: Calling free (gamedata/RIVE.bin.x86_64)(0x37DE6D70, 0x1007FEF80, 0x37DE6D80, ...) => return 0x0
30347|PltResolver "SDL_GL_CreateContext" => return 0x1
30347|0xa8a938: Calling SDL_GL_CreateContext (/usr/lib/libSDL2-2.0.so.0)(0x37DE5C90, 0x1007FEF80, 0x37DE6D80, ...) => return 0x38033328
30347|PltResolver "SDL_GL_SetSwapInterval" => return 0x38033328
30347|0xa8a945: Calling SDL_GL_SetSwapInterval (/usr/lib/libSDL2-2.0.so.0)(0x1, 0x1007FEF80, 0x37DE6D80, ...) => return 0x0
30347|PltResolver "SDL_GL_GetProcAddress" => return 0x0
30347|0xbbb3ab: Calling my2_SDL_GL_GetProcAddress (gamedata/RIVE.bin.x86_64)(0xC1FC57, 0x1007FEF80, 0x37DE6D80, ...) => return
30347|0xba5818: Calling SDL_CreateRGBSurfaceFrom (/usr/lib/libSDL2-2.0.so.0)(0x7FA9E71010, 0x100, 0x100, ...) => return 0x38065670
NativeBT: gamedata/RIVE.bin.x86_64() [0x34a0f164]
NativeBT: linux-vdso.so.1(__kernel_rt_sigreturn+0) [0x7fb4a0d680]
NativeBT: /usr/lib/libc.so.6(+0x7c744) [0x7fb48ac744]
NativeBT: /usr/lib/libc.so.6(gsignal+0x14) [0x7fb48694c4]
NativeBT: /usr/lib/libSDL2-2.0.so.0(+0x131808) [0x7fb3de1808]
NativeBT: linux-vdso.so.1(__kernel_rt_sigreturn+0) [0x7fb4a0d680]
NativeBT: gamedata/RIVE.bin.x86_64() [0x34a15a24]
NativeBT: gamedata/RIVE.bin.x86_64() [0x34f316d4]
NativeBT: gamedata/RIVE.bin.x86_64() [0x34e8abac]
NativeBT: gamedata/RIVE.bin.x86_64() [0x349f4834]
NativeBT: [0x7fa9e20fe8]
EmulatedBT: ??? [0x606c0]
EmulatedBT: /storage/roms/ports/box64/gamedata/RIVE.bin.x86_64(ogl_LoadFunctions+4b) [0xbbb3ab]
EmulatedBT: ??? [(nil)]
30347|SIGSEGV @0x7fb48ac744 (???(/usr/lib/libc.so.6+0x7c744)) (x64pc=0x606d3/???:"???", rsp=0x1007fefe8, stack=0x100000000:0x100800000 own=(nil) fp=0x38033328), for accessing 0x768b (code=-6/prot=0), db=(nil)((nil):(nil)/(nil):(nil)/???:clean, hash:0/0) handler=(nil)
RSP-0x20:0x0000000000000010 RSP-0x18:0x0000000037df8168 RSP-0x10:0x000000003767b790 RSP-0x08:0x0000000000000144
RSP+0x00:0x0000000000bbb3ab RSP+0x08:0x0000000000001002 RSP+0x10:0x0000000000000000 RSP+0x18:0x0000000000000000
RAX:0x0000000000000000 RCX:0x00000000005d3fd0 RDX:0x0000000037de6d80 RBX:0x00000001007ff570
RSP:0x00000001007fefe8 RBP:0x0000000038033328 RSI:0x00000001007fef80 RDI:0x0000000000c1fc57
 R8:0x0000000000000400  R9:0x00000000000000ff R10:0x000000000000000c R11:0x0000000000000018
R12:0x0000000037e02cf0 R13:0x00000001007ff4d0 R14:0x00000001007ff6e0 R15:0x00000001007ff430
ES:0x002b CS:0x0033 SS:0x002b DS:0x002b FS:0x0043 GS:0x0053
./Box64.sh: line 55: 30347 Segmentation fault      $GAMEDIR/box64/box64 gamedata/RIVE.bin.x86_64

And log without any libGL.so.1 On the rk3326 we don't have opengl everywhere so only opengles up to 3

/roms/ports # ./Box64.sh
No sudo present.
BOX64 using "/roms/ports/box64/box64/native/libGL.so.1" as libGL.so.1
Show Segfault signal even if a signal handler is present
Show a Backtrace when a Segfault signal is caught
Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL SHA1 SHA2 PageSize:4096 Running on Cortex-A35 with 4 Cores
Params database has 14 entries
BOX64: Didn't detect 48bits of address space, considering it's 39bits
Counted 28 Env var
BOX64 LIB PATH: /roms/ports/box64/box64/native/:/usr/lib/aarch64-linux-gnu/:/usr/lib/:/roms/ports/box64/libs/:/usr/lib/:/usr/lib/pulseaudio/:/usr/lib32/:/roms/ports/box64/box64/x64/:/roms/ports/box64/box64/native/:/roms/ports/box64/libs/x64/:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/
BOX64 BIN PATH: ./:bin/:/usr/bin/:/usr/sbin/:/usr/local/bin/:/usr/bin/:/storage/bin/
Looking for gamedata/RIVE.bin.x86_64
Rename process to "RIVE.bin.x86_64"
Using native(wrapped) libopenal.so.1
Using native(wrapped) libpthread.so.0
Using native(wrapped) libSDL2-2.0.so.0
Using native(wrapped) libdl.so.2
Using native(wrapped) libm.so.6
Using native(wrapped) librt.so.1
Using emulated /roms/ports/box64/box64/x64/libstdc++.so.6
Using emulated /roms/ports/box64/box64/x64/libgcc_s.so.1
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
Using native(wrapped) libutil.so.1
Call to dlopen("/roms/ports/box64/box64/native/libGL.so.1"/0x669082a0, 101)
Using native(wrapped) libGL.so.1
dlopen: New handle 0x4 (/roms/ports/box64/box64/native/libGL.so.1), dlopened=1
Calling getGLProcAddress[0x7f7e186090]("glGetString") => Last calls
30581|PltResolver "SDL_ConvertSurface" => return 0x6708F050
30581|0xba582e: Calling SDL_ConvertSurface (/usr/lib/libSDL2-2.0.so.0)(0x6708F050, 0x66E5C4D0, 0x0, ...) => return 0x6708F590
30581|PltResolver "SDL_FreeSurface" => return 0x6708F590
30581|0xba5839: Calling SDL_FreeSurface (/usr/lib/libSDL2-2.0.so.0)(0x6708F050, 0x66E5C4D0, 0x0, ...) => return 0x6708F590
30581|0xba5843: Calling free (gamedata/RIVE.bin.x86_64)(0x7F77671010, 0x66E5C4D0, 0x0, ...) => return 0x6708F590
30581|PltResolver "SDL_SetWindowIcon" => return 0x6708F590
30581|0xa88bf6: Calling SDL_SetWindowIcon (/usr/lib/libSDL2-2.0.so.0)(0x66E5C580, 0x6708F590, 0x0, ...) => return 0x6708F590
30581|0xa88bfe: Calling SDL_FreeSurface (/usr/lib/libSDL2-2.0.so.0)(0x6708F590, 0x6708F590, 0x0, ...) => return 0x6708F590
30581|0xa88e3f: Calling free (gamedata/RIVE.bin.x86_64)(0x6708FE10, 0x1007FEF80, 0x6708FE20, ...) => return 0x0
30581|PltResolver "SDL_GL_CreateContext" => return 0x1
30581|0xa8a938: Calling SDL_GL_CreateContext (/usr/lib/libSDL2-2.0.so.0)(0x66E5C580, 0x1007FEF80, 0x6708FE20, ...) => return 0x6719D228
30581|PltResolver "SDL_GL_SetSwapInterval" => return 0x6719D228
30581|0xa8a945: Calling SDL_GL_SetSwapInterval (/usr/lib/libSDL2-2.0.so.0)(0x1, 0x1007FEF80, 0x6708FE20, ...) => return 0x0
30581|PltResolver "SDL_GL_GetProcAddress" => return 0x0
30581|0xbbb3ab: Calling my2_SDL_GL_GetProcAddress (gamedata/RIVE.bin.x86_64)(0xC1FC57, 0x1007FEF80, 0x6708FE20, ...) => return
30581|0xba5818: Calling SDL_CreateRGBSurfaceFrom (/usr/lib/libSDL2-2.0.so.0)(0x7F77671010, 0x100, 0x100, ...) => return 0x6708F050
NativeBT: gamedata/RIVE.bin.x86_64() [0x34a0f164]
NativeBT: linux-vdso.so.1(__kernel_rt_sigreturn+0) [0x7f7ee9b680]
NativeBT: /usr/lib/libc.so.6(+0x7c744) [0x7f7ed3c744]
NativeBT: /usr/lib/libc.so.6(gsignal+0x14) [0x7f7ecf94c4]
NativeBT: /usr/lib/libSDL2-2.0.so.0(+0x131808) [0x7f7e271808]
NativeBT: linux-vdso.so.1(__kernel_rt_sigreturn+0) [0x7f7ee9b680]
NativeBT: gamedata/RIVE.bin.x86_64() [0x34a15a24]
NativeBT: gamedata/RIVE.bin.x86_64() [0x34f316d4]
NativeBT: gamedata/RIVE.bin.x86_64() [0x34e8abac]
NativeBT: gamedata/RIVE.bin.x86_64() [0x349f4834]
NativeBT: [0x7f77620fe8]
EmulatedBT: ??? [0x606c0]
EmulatedBT: /storage/roms/ports/box64/gamedata/RIVE.bin.x86_64(ogl_LoadFunctions+4b) [0xbbb3ab]
EmulatedBT: ??? [(nil)]
30581|SIGSEGV @0x7f7ed3c744 (???(/usr/lib/libc.so.6+0x7c744)) (x64pc=0x606d3/???:"???", rsp=0x1007fefe8, stack=0x100000000:0x100800000 own=(nil) fp=0x6719d228), for accessing 0x7775 (code=-6/prot=0), db=(nil)((nil):(nil)/(nil):(nil)/???:clean, hash:0/0) handler=(nil)
RSP-0x20:0x0000000000000010 RSP-0x18:0x00000000670a5e98 RSP-0x10:0x0000000066921790 RSP-0x08:0x0000000000000144
RSP+0x00:0x0000000000bbb3ab RSP+0x08:0x0000000000001002 RSP+0x10:0x0000000000000000 RSP+0x18:0x0000000000000000
RAX:0x0000000000000000 RCX:0x00000000005d3fd0 RDX:0x000000006708fe20 RBX:0x00000001007ff570
RSP:0x00000001007fefe8 RBP:0x000000006719d228 RSI:0x00000001007fef80 RDI:0x0000000000c1fc57
 R8:0x0000000000000400  R9:0x00000000000000ff R10:0x000000000000000c R11:0x0000000000000018
R12:0x00000000670916c0 R13:0x00000001007ff4d0 R14:0x00000001007ff6e0 R15:0x00000001007ff430
ES:0x002b CS:0x0033 SS:0x002b DS:0x002b FS:0x0043 GS:0x0053
./Box64.sh: line 55: 30581 Segmentation fault      $GAMEDIR/box64/box64 gamedata/RIVE.bin.x86_64
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec
Cebion commented 10 months ago

To get to the ground of this issue I tried to get back to the most simple examples.

For testing I used this simple SDL2 + GLES file


#include <SDL2/SDL.h>

// if we're compiling for iOS (iPhone/iPad)
#ifdef __IPHONEOS__
#   include <SDL2/SDL_opengles.h> // we want to use OpenGL ES
#else
#   include <SDL2/SDL_opengl.h> // otherwise we want to use OpenGL
#endif

int main(int argc, char * argv[])
{
    // Initialize SDL with video
    SDL_Init(SDL_INIT_VIDEO);

    // Create an SDL window
    SDL_Window* window = SDL_CreateWindow("Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_OPENGL);

    // if failed to create a window
    if(!window)
    {
        // we'll print an error message and exit
        std::cerr << "Error failed to create window!\n";
        return 1;
    }

    // Create an OpenGL context (so we can use OpenGL functions)
    SDL_GLContext context = SDL_GL_CreateContext(window);

    // if we failed to create a context
    if(!context)
    {
        // we'll print out an error message and exit
        std::cerr << "Error failed to create a context\n!";
        return 2;
    }

    SDL_Event event;     // used to store any events from the OS
    bool running = true; // used to determine if we're running the game

    glClearColor(1, 0, 0, 1);
    while(running)
    {
        // poll for events from SDL
        while(SDL_PollEvent(&event))
        {
            // determine if the user still wants to have the window open
            // (this basically checks if the user has pressed 'X')
            running = event.type != SDL_QUIT;
        }

        glClear(GL_COLOR_BUFFER_BIT);

        // Swap OpenGL buffers
        SDL_GL_SwapWindow(window);
    }

    // Destroy the context
    SDL_GL_DeleteContext(context);

    // Destroy the window
    SDL_DestroyWindow(window);

    // And quit SDL
    SDL_Quit();

    return 0;
}

I compiled it first in my aarch64 chroot and then tested it on my device. Example works fine and displays a red square. To prepare I compiled the newest box64 commit with -DARM64=ON and -DARM_DYNAREC=ON

Exports for ld_library is set


export BOX64_LD_LIBRARY_PATH="$GAMEDIR/box64/x64":"$GAMEDIR/box64/native":"$GAMEDIR/libs/x64"```

For some reason it fails to load the libGLESv2.so.2
```./Box64.sh
No sudo present.
Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL SHA1 SHA2 PageSize:4096 Running on Cortex-A35 with 4 Cores
Params database has 14 entries
BOX64: Didn't detect 48bits of address space, considering it's 39bits
Counted 24 Env var
BOX64 LIB PATH: /roms/ports/box64/box64/native/:/usr/lib/:/usr/lib/aarch64-linux-gnu/:/roms/ports/box64/libs/:/usr/lib/:/usr/lib/pulseaudio/:/usr/lib32/:/roms/ports/box64/box64/x64/:/roms/ports/box64/box64/native/:/roms/ports/box64/libs/x64/:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/
BOX64 BIN PATH: ./:bin/:/usr/bin/:/usr/sbin/:/usr/local/bin/:/usr/bin/:/storage/bin/
Looking for ./sdl_x64
Rename process to "sdl_x64"
Using native(wrapped) libSDL2-2.0.so.0
Using native(wrapped) libdl.so.2
Using native(wrapped) libm.so.6
Using native(wrapped) librt.so.1
Using native(wrapped) libpthread.so.0
Error loading needed lib libGLESv2.so.2
Using emulated /roms/ports/box64/box64/x64/libstdc++.so.6
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
Using native(wrapped) libutil.so.1
Using native(wrapped) libbsd.so.0
Error loading one of needed lib
Error: Loading needed libs in elf /storage/roms/ports/box64/sdl_x64```

If it saying Error loading needed lib libGLESv2.so.2 does it want to load the x64 lib of libGLESv2.so.2?
Cebion commented 10 months ago

Out of curiosity I tried to do the same test on box86


No sudo present.
Shows details of dlopen / dlsym /dlclose : Yes
BOX86 using "/roms/ports/box86/box86/native/libGL.so.1" as libGL.so.1
Show Segfault signal even if a signal handler is present
Show Backtrace for signals
Dynarec for ARMv8, with extension: HALF FAST_MULT EDSP NEON VFPv4 IDIVA AES PMULL PageSize:4096 Running on Cortex-A35 with 4 Cores
BOX86_LD_LIBRARY_PATH: /roms/ports/box86/box86/x86/:/roms/ports/box86/box86/native/:/roms/ports/box86/libs/x86/
Using default BOX86_PATH: ./:bin/
Counted 23 Env var
Looking for sdl2test_86
Rename process to "sdl2test_86"
Using native(wrapped) libSDL2-2.0.so.0
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) librt.so.1
Using native(wrapped) libbsd.so.0
Using native(wrapped) libm.so.6
Error loading needed lib libGLESv2.so.2
Using emulated /roms/ports/box86/box86/x86/libstdc++.so.6
Error loading one of needed lib
Error: loading needed libs in elf /storage/roms/ports/box86/sdl2test_86```

It seems also box86 has the same issue loading the libmali libGLESv2.so.2 library.
If I load gl4es and point with SDL_VIDEO_GL_DRIVER=libGL.so.1 gl4es picks up the gles library and thus box86 has its library.

TLDR, box86 and box64 fail to find the native libGLESv2.so.2 library without using gl4es.
Not sure if connected to the main issue but may be a problem nonetheless.
Cebion commented 10 months ago

Did some additional tests with LD_DEBUG=libs

It lists all search paths for the other libs just fine but never even attempts to load libgles2.v2

Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL SHA1 SHA2 PageSize:4096       2856:    find library=libtinfo.so.6 [0]; searching
      2856:      search path=/roms/ports/box64/box64/native             (LD_LIBRARY_PATH)
      2856:       trying file=/roms/ports/box64/box64/native/libtinfo.so.6
      2856:      search path=/usr/lib           (system search path)
      2856:       trying file=/usr/lib/libtinfo.so.6
      2856:
      2856:     find library=libc.so.6 [0]; searching
      2856:      search path=/roms/ports/box64/box64/native             (LD_LIBRARY_PATH)
      2856:       trying file=/roms/ports/box64/box64/native/libc.so.6
      2856:      search path=/usr/lib           (system search path)
      2856:       trying file=/usr/lib/libc.so.6
      2856:
      2856:
      2856:     calling init: /lib/ld-linux-aarch64.so.1
      2856:
      2856:
      2856:     calling init: /usr/lib/libc.so.6
      2856:
      2856:
      2856:     calling init: /usr/lib/libtinfo.so.6
      2856:
      2856:
      2856:     initialize program: sh
      2856:
      2856:
      2856:     transferring control: sh
      2856:
      2859:     find library=libm.so.6 [0]; searching
      2859:      search path=/roms/ports/box64/box64/native             (LD_LIBRARY_PATH)
      2859:       trying file=/roms/ports/box64/box64/native/libm.so.6
      2859:      search path=/usr/lib           (system search path)
      2859:       trying file=/usr/lib/libm.so.6
      2859:
      2859:     find library=libc.so.6 [0]; searching
      2859:      search path=/roms/ports/box64/box64/native             (LD_LIBRARY_PATH)
      2859:       trying file=/roms/ports/box64/box64/native/libc.so.6
      2859:      search path=/usr/lib           (system search path)
      2859:       trying file=/usr/lib/libc.so.6
      2859:
      2859:
      2859:     calling init: /lib/ld-linux-aarch64.so.1
      2859:
      2859:
      2859:     calling init: /usr/lib/libc.so.6
      2859:
      2859:
      2859:     calling init: /usr/lib/libm.so.6
      2859:
      2859:
      2859:     initialize program: sed
      2859:
      2859:
      2859:     transferring control: sed
      2859:
      2858:     find library=libc.so.6 [0]; searching
      2858:      search path=/roms/ports/box64/box64/native             (LD_LIBRARY_PATH)
      2858:       trying file=/roms/ports/box64/box64/native/libc.so.6
      2858:      search path=/usr/lib           (system search path)
      2858:       trying file=/usr/lib/libc.so.6
      2858:
      2857:     find library=libsmartcols.so.1 [0]; searching
      2857:      search path=/roms/ports/box64/box64/native             (LD_LIBRARY_PATH)
      2857:       trying file=/roms/ports/box64/box64/native/libsmartcols.so.1
      2857:      search path=/usr/lib           (system search path)
      2857:       trying file=/usr/lib/libsmartcols.so.1
      2857:
      2857:     find library=libc.so.6 [0]; searching
      2857:      search path=/roms/ports/box64/box64/native             (LD_LIBRARY_PATH)
      2857:       trying file=/roms/ports/box64/box64/native/libc.so.6
      2857:      search path=/usr/lib           (system search path)
      2857:       trying file=/usr/lib/libc.so.6
      2857:
      2858:
      2858:     calling init: /lib/ld-linux-aarch64.so.1
      2858:
      2858:
      2858:     calling init: /usr/lib/libc.so.6
      2858:
      2858:
      2858:     initialize program: grep
      2858:
      2858:
      2858:     transferring control: grep
      2858:
      2857:
      2857:     calling init: /lib/ld-linux-aarch64.so.1
      2857:
      2857:
      2857:     calling init: /usr/lib/libc.so.6
      2857:
      2857:
      2857:     calling init: /usr/lib/libsmartcols.so.1
      2857:
      2857:
      2857:     initialize program: lscpu
      2857:
      2857:
      2857:     transferring control: lscpu
      2857:
      2857:
      2857:     calling fini:  [0]
      2857:
      2857:
      2857:     calling fini: /usr/lib/libsmartcols.so.1 [0]
      2857:
      2857:
      2857:     calling fini: /usr/lib/libc.so.6 [0]
      2857:
      2857:
      2857:     calling fini: /lib/ld-linux-aarch64.so.1 [0]
      2857:
      2859:
      2859:     calling fini:  [0]
      2859:
      2859:
      2859:     calling fini: /usr/lib/libm.so.6 [0]
      2859:
      2859:
      2859:     calling fini: /usr/lib/libc.so.6 [0]
      2859:
      2859:
      2859:     calling fini: /lib/ld-linux-aarch64.so.1 [0]
      2859:
      2856:
      2856:     calling fini:  [0]
      2856:
      2856:
      2856:     calling fini: /usr/lib/libtinfo.so.6 [0]
      2856:
      2856:
      2856:     calling fini: /usr/lib/libc.so.6 [0]
      2856:
      2856:
      2856:     calling fini: /lib/ld-linux-aarch64.so.1 [0]
      2856:
Running on Cortex-A35 with 4 Cores
Params database has 14 entries
BOX64: Didn't detect 48bits of address space, considering it's 39bits
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: _pthread_cleanup_push_defer (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: _pthread_cleanup_pop_restore (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.0 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.1 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.2 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.3 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.4 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.5 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.6 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.7 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.8 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.9 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.10 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.11 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.12 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.13 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.14 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.15 (fatal)
      2854:     /roms/ports/box64/box64/box64: error: symbol lookup error: undefined symbol: pthread_kill, version GLIBC_2.16 (fatal)
Counted 25 Env var
BOX64 LIB PATH: /roms/ports/box64/box64/native/:/usr/lib/:/usr/lib/aarch64-linux-gnu/:/roms/ports/box64/libs/:/usr/lib/:/usr/lib/pulseaudio/:/usr/lib32/:/roms/ports/box64/box64/x64/:/roms/ports/box64/box64/native/:/roms/ports/box64/libs/x64/:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/
BOX64 BIN PATH: ./:bin/:/usr/bin/:/usr/sbin/:/usr/local/bin/:/usr/bin/:/storage/bin/
Looking for ./sdl2_test64
Rename process to "sdl2_test64"
      2854:     find library=libSDL2-2.0.so.0 [0]; searching
      2854:      search path=/roms/ports/box64/box64/native             (LD_LIBRARY_PATH)
      2854:       trying file=/roms/ports/box64/box64/native/libSDL2-2.0.so.0
      2854:      search path=/usr/lib           (system search path)
      2854:       trying file=/usr/lib/libSDL2-2.0.so.0
      2854:
      2854:     find library=libasound.so.2 [0]; searching
      2854:      search path=/roms/ports/box64/box64/native             (LD_LIBRARY_PATH)
      2854:       trying file=/roms/ports/box64/box64/native/libasound.so.2
      2854:      search path=/usr/lib           (system search path)
      2854:       trying file=/usr/lib/libasound.so.2
      2854:
      2854:
      2854:     calling init: /usr/lib/libasound.so.2
      2854:
      2854:
      2854:     calling init: /usr/lib/libSDL2-2.0.so.0
      2854:
      2854:     /usr/lib/libSDL2-2.0.so.0: error: symbol lookup error: undefined symbol: SDL_IsJoystickNintendoSwitchPro (fatal)
      2854:     /usr/lib/libSDL2-2.0.so.0: error: symbol lookup error: undefined symbol: SDL_IsJoystickPS4 (fatal)
      2854:     /usr/lib/libSDL2-2.0.so.0: error: symbol lookup error: undefined symbol: SDL_IsJoystickSteamController (fatal)
      2854:     /usr/lib/libSDL2-2.0.so.0: error: symbol lookup error: undefined symbol: SDL_IsJoystickXbox360 (fatal)
      2854:     /usr/lib/libSDL2-2.0.so.0: error: symbol lookup error: undefined symbol: SDL_IsJoystickXboxOne (fatal)
      2854:     /usr/lib/libSDL2-2.0.so.0: error: symbol lookup error: undefined symbol: SDL_IsJoystickHIDAPI (fatal)
      2854:     /usr/lib/libSDL2-2.0.so.0: error: symbol lookup error: undefined symbol: SDL_IsJoystickXInput (fatal)
Using native(wrapped) libSDL2-2.0.so.0
Using native(wrapped) libdl.so.2
Using native(wrapped) libm.so.6
Using native(wrapped) librt.so.1
Using native(wrapped) libpthread.so.0
Error loading needed lib libGLESv2.so.2
Using emulated /roms/ports/box64/box64/x64/libstdc++.so.6
      2854:     ./sdl2_test64: error: symbol lookup error: undefined symbol: _ITM_addUserCommitAction (fatal)
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
      2854:     find library=libutil.so.1 [0]; searching
      2854:      search path=/roms/ports/box64/box64/native             (LD_LIBRARY_PATH)
      2854:       trying file=/roms/ports/box64/box64/native/libutil.so.1
      2854:      search path=/usr/lib           (system search path)
      2854:       trying file=/usr/lib/libutil.so.1
      2854:
      2854:
      2854:     calling init: /usr/lib/libutil.so.1
      2854:
Using native(wrapped) libutil.so.1
Using native(wrapped) libbsd.so.0
Error loading one of needed lib
Error: Loading needed libs in elf /storage/roms/ports/box64/sdl2_test64
Cebion commented 10 months ago

Okay so we only have wrappers for libGL and libGLX and not libGLESv2. Makes sense that it would not work and most desktop apps don't use libGLESv2 directly. I will try with opengl2 apps in combination with gl4es.