ptitSeb / box64

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

Cannot run linux .x86_64 unity app on raspberry pi CM4 #1245

Closed BasedSnake closed 1 week ago

BasedSnake commented 9 months ago

Greetings all, Me and my team are trying to get a unity application built for linux 64 runnning on a raspberry pi CM4, upon running the following command, we get the following prints and the screen flashes black and the application exits. We tried installing openGL, have also tried building for windows and running through wine, this gives us an error that graphics cannot be initialized because of DirectX11. Thank you in advance.

gravitron@raspberrypi:~/Desktop/test $ sudo ./gravitron.x86_64 MESA_GL_VERSION_OVERRIDE=3.2 PAN_MESA_DEBUG=gl3 Dynarec for ARM64, with extension: ASIMD CRC32 PageSize:4096 Running on Cortex-A72 with 4 Cores Params database has 55 entries Box64 with Dynarec v0.2.7 7781bfcb built on Feb 2 2024 06:24:03 BOX64: Didn't detect 48bits of address space, considering it's 39bits Counted 21 Env var BOX64 LIB PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/ BOX64 BIN PATH: ./:bin/:/usr/local/sbin/:/usr/local/bin/:/usr/sbin/:/usr/bin/:/sbin/:/bin/ Looking for ./gravitron.x86_64 argv[1]="MESA_GL_VERSION_OVERRIDE=3.2" argv[2]="PAN_MESA_DEBUG=gl3" Rename process to "gravitron.x86_64" Using emulated UnityPlayer.so Using native(wrapped) libm.so.6 Using emulated /lib/x86_64-linux-gnu/libgcc_s.so.1 Using native(wrapped) libpthread.so.0 Using native(wrapped) libc.so.6 Using native(wrapped) ld-linux-x86-64.so.2 Using native(wrapped) libdl.so.2 Using native(wrapped) libutil.so.1 Using native(wrapped) librt.so.1 Using native(wrapped) libbsd.so.0 Warning: Global Symbol _ZTH15gDeferredAction not found, cannot apply R_X86_64_GLOB_DAT @0x3f01f1d0d8 ((nil)) in UnityPlayer.so [UnityMemory] Configuration Parameters - Can be set up in boot.config "memorysetup-bucket-allocator-granularity=16" "memorysetup-bucket-allocator-bucket-count=8" "memorysetup-bucket-allocator-block-size=4194304" "memorysetup-bucket-allocator-block-count=1" "memorysetup-main-allocator-block-size=16777216" "memorysetup-thread-allocator-block-size=16777216" "memorysetup-gfx-main-allocator-block-size=16777216" "memorysetup-gfx-thread-allocator-block-size=16777216" "memorysetup-cache-allocator-block-size=4194304" "memorysetup-typetree-allocator-block-size=2097152" "memorysetup-profiler-bucket-allocator-granularity=16" "memorysetup-profiler-bucket-allocator-bucket-count=8" "memorysetup-profiler-bucket-allocator-block-size=4194304" "memorysetup-profiler-bucket-allocator-block-count=1" "memorysetup-profiler-allocator-block-size=16777216" "memorysetup-profiler-editor-allocator-block-size=1048576" "memorysetup-temp-allocator-size-main=4194304" "memorysetup-job-temp-allocator-block-size=2097152" "memorysetup-job-temp-allocator-block-size-background=1048576" "memorysetup-job-temp-allocator-reduction-small-platforms=262144" "memorysetup-allocator-temp-initial-block-size-main=262144" "memorysetup-allocator-temp-initial-block-size-worker=262144" "memorysetup-temp-allocator-size-background-worker=32768" "memorysetup-temp-allocator-size-job-worker=262144" "memorysetup-temp-allocator-size-preload-manager=262144" "memorysetup-temp-allocator-size-nav-mesh-worker=65536" "memorysetup-temp-allocator-size-audio-worker=65536" "memorysetup-temp-allocator-size-cloud-worker=32768" "memorysetup-temp-allocator-size-gfx=262144" Using native(wrapped) libdbus-1.so.3 Using native(wrapped) libX11.so.6 Using native(wrapped) libXext.so.6 Using native(wrapped) libxcb.so.1 Using native(wrapped) libXau.so.6 Using native(wrapped) libXdmcp.so.6 Using native(wrapped) libXcursor.so.1 Using native(wrapped) libXinerama.so.1 Using native(wrapped) libXi.so.6 Using native(wrapped) libXrandr.so.2 Using native(wrapped) libXrender.so.1 Using native(wrapped) libXss.so.1 Using native(wrapped) libXxf86vm.so.1 Using native(wrapped) libudev.so.1

ptitSeb commented 9 months ago

Unity3D redirect logs inside /.config/unity3d/COMPANY_NAME/PRODUCT_NAME/Player.log so check there for details.

I might be a need for BOX64_DYNAREC_STRONGMEM=1? Difficult to say without logs.

BasedSnake commented 9 months ago

unfortunately we cannot find the aforementioned directory, any potential other locations or place we didn't look? BOX64_DYNAREC_STRONGMEM=1 did not work either.

ptitSeb commented 9 months ago

The directory I mentionned is a generic template. You need to replace COMPANY_NAME by the actual company name settuped in Unity. Same for PRODUCT_NAME.

BasedSnake commented 9 months ago

We were looking in the wrong directory for it, here it is:

Using emulated /home/gravitron/Desktop/test/gravitron_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so MonoBleedingEdge detected, disable Dynarec BigBlock and enable Dynarec StrongMem Using native(wrapped) libz.so.1 Mono path[0] = '/home/gravitron/Desktop/test/gravitron_Data/Managed' Mono config path = '/home/gravitron/Desktop/test/gravitron_Data/MonoBleedingEdge/etc' Display 0 '0': 1600x1200 (primary device). [Physics::Module] Initialized MultithreadedJobDispatcher with 3 workers. Unable to load player prefs Desktop is 1600 x 1200 @ 0 Hz Using native(wrapped) libGL.so.1 Unable to find a supported OpenGL core profile Failed to create valid graphics context: please ensure you meet the minimum requirements E.g. OpenGL core profile 3.2 or later for OpenGL Core renderer Using native(wrapped) libvulkan.so.1 [Vulkan init] extensions: count=3 [Vulkan init] extensions: name=VK_EXT_debug_report [enabled=0, external=0] [Vulkan init] extensions: name=VK_EXT_debug_utils [enabled=0, external=0] [Vulkan init] extensions: name=VK_KHR_portability_enumeration [enabled=0, external=0]

it seems it has to do with OpenGL, we put the MESA_GL_VERSION_OVERRIDE=3.2 and PAN_MESA_DEBUG=gl3 as arguments. What else could cause this?

Thanks in advance.

ptitSeb commented 9 months ago

Yes, missing opengl stuff. On a PI4, only MESA_GL_VERSION_OVERRIDE=3.2 is usefull. the PAN_MESA_DEBUG one is for Panfrost mesa (so for other boards, like RK3399 or RK3588 based).

I don't think you have opengl activated. Try to use glxinfo -B to see what kind of OpenGL you have. Can't really help you here.

BasedSnake commented 9 months ago

glxinfo -B returns command not found, I assume that means OpenGL is missing?

ptitSeb commented 9 months ago

this comes with sudo apt install mesa-utils iirc. But yeah, looks like you are missing stuffs.

FoteiniS-Verkehrshaus commented 9 months ago

Hello!Did you manage to solve it? I am having the same issue. I built a Linux app through Unity and tried to run it using Box64 in Pi 5. The terminal message I received is exactly the same as in the first comment of this thread. When I checked the OpenGl version typing glxinfo -B I got this warning: v3d support for hw 71 is neither a complete nor a conformant OpenGL implementation. Testing use only Could this be relative? Thank you in advance for any update

BasedSnake commented 9 months ago

Perhaps the warning is relative, we ended up switching to latest ubuntu on pi imager. The only issue we have currently relates to running the application in fullscreen. We get a black screen unless we add -screen-fullscreen 0 as a launch option. I believe our current issue is related to wayland or perhaps the fact that our power supply is 1amp which might be too weak for the GPU to function correctly, but it's "working" for the time being.

FoteiniS-Verkehrshaus commented 8 months ago

Thank you for your reply! I managed to run it with Box64 with terminal command MESA_GL_VERSION_OVERRIDE=3.2 ./YourUnityApp.x86_64 . Fullscreen, the graphics' quality is good but the performance not really. I have already started switching to Ubuntu and I ll test it the following days.

LukeShortCloud commented 1 week ago

Glad to hear you got it working! Feel free to open up a separate GitHub Issue regarding the performance issues if you are still encountering those. Closing as complete.