box86 icon indicating copy to clipboard operation
box86 copied to clipboard

Source Dedicated Server (TF2) fails to dlopen `engine_srv.so` due to `libc.so.6`

Open purplebar0 opened this issue 1 year ago • 3 comments

Raspberry Pi 5 running Raspberry Pi OS headlessly, using kernel=kernel8.img in /boot/firmware/config.txt. Box86 has been built manually according to documentation.

Box86 version: Box86 with Dynarec v0.3.5 14b978a5 built on Feb 23 2024 19:42:50

With BOX86_LOG=2, it is revealed that engine_srv.so tries to dlopen libc.so.6 in /lib/arm-linux-gnueabihf.

Full log

Error initializing needed lib engine_srv.so
Warning: Cannot dlopen("engine_srv.so"/0xf72db8cc, 2)
Will remove after failed init engine_srv.so
Free1Library engine_srv.so
Free1Library libsteamnetworkingsockets.so
 return 0x00000000
4303|0x60a98a69: Calling my_dlerror (./srcds_linux) (F72DB8CC, 00000002, 00000400...) => return 0x63260DA0
4303|0x60a98a7f: Calling strstr (/lib/arm-linux-gnueabihf/libc.so.6)("Cannot dlopen("engine_srv.so"/0xf72db8cc, 2)
", "No such file") => return 0x00000000
4303|0x60a98a93: Calling strstr (/lib/arm-linux-gnueabihf/libc.so.6)("Cannot dlopen("engine_srv.so"/0xf72db8cc, 2)
", "image not found") => return 0x00000000
4303|0x600101f7: Calling my___vsnprintf_chk (./srcds_linux) (F72DA4D0, 0000139B, 00000001...) => return 0x00000054
4303|0x60010238: Calling __pthread_setspecific (/lib/arm-linux-gnueabihf/libc.so.6) (00000003, F72DA4C0, 00000001...) => return 0x00000000
4303|0x60aa46e8: Calling my___vsnprintf_chk (./srcds_linux) (F72DA02C, 00000400, 00000001...) => return 0x00000054
4303|0x60a933d7: Calling strlen (/lib/arm-linux-gnueabihf/libc.so.6)(0xf72da02c(" failed to dlopen engine_srv.so error=Cannot dlopen("engine_srv.so"/0xf72db8cc, 2)

")) => return 0x00000054
 failed to dlopen engine_srv.so error=Cannot dlopen("engine_srv.so"/0xf733b8cc, 2)

AppFramework : Unable to load module engine_srv.so!
Unable to load interface VCvarQuery001 from engine_srv.so

I noticed that in the case of Steam, the commonly used workaround is to force Steam Runtime or force SteamOS mode, but SteamCMD is all I got.

Assuming that's what's going on, is it possible to somehow force x86 libc?

I already tried to add this to my box86rc to no avail:

[srcds_linux]
BOX86_EMULATED_LIBS=libc.so.6

Trying to force LD_LIBRARY_PATH to path containing i386 build of libc.so.6 didn't help either.

purplebar0 avatar Feb 23 '24 21:02 purplebar0

I got a bit further by installing App ID 1628350 (Steam Linux Runtime Sniper) and running the server with:

./run ./srcds_run <args>

Still forcing stdc.so.6 to be emulated:

[srcds_linux]
BOX86_EMULATED_LIBS=libc.so.6

At least this time it can detect a crash and restart itself.

Full log

I should note that I haven't set up a chroot just yet.

purplebar0 avatar Feb 24 '24 12:02 purplebar0

Exact same issue trying to run TF2 srcds on an Ampere A1 OCI instance, srcds is running on FEX-Emu (using Steam Runtime Sniper to run srcds_run) atm but perf overhead is too great, any progress on this issue ?

MerGr avatar Apr 07 '24 22:04 MerGr

Not yet. I have to backport the latest elfloader changes from box64 to box86, that should help this ticket.

ptitSeb avatar Apr 08 '24 06:04 ptitSeb