ValveSoftware / Source-1-Games

Source 1 based games such as TF2 and Counter-Strike: Source
649 stars 75 forks source link

TF2 doesn't launch/crashes early, "AppFramework : Unable to load module engine.so!" #5125

Open SetOfAllSets opened 1 year ago

SetOfAllSets commented 1 year ago

Affected games: team fortress 2 System: x86_64 gentoo linux openrc, nvidia 2070 max-q, tested with X/bspwm and wayland/sway

When running from the steam launcher TF2 launches and shows the valve intro (the person with a suction cup on the back of their head) and plays the sound, before immediately crashing. Running from the command line (by going to $HOME/.local/share/Steam/steamapps/common/Team\ Fortress\ 2 and running hl2.sh with bash) I get the output

SDL video target is 'x11'
This system supports the OpenGL extension GL_EXT_framebuffer_object.
This system supports the OpenGL extension GL_EXT_framebuffer_blit.
This system supports the OpenGL extension GL_EXT_framebuffer_multisample.
This system DOES NOT support the OpenGL extension GL_APPLE_fence.
This system DOES NOT support the OpenGL extension GL_NV_fence.
This system supports the OpenGL extension GL_ARB_sync.
This system supports the OpenGL extension GL_EXT_draw_buffers2.
This system DOES NOT support the OpenGL extension GL_EXT_bindable_uniform.
This system DOES NOT support the OpenGL extension GL_APPLE_flush_buffer_range.
This system supports the OpenGL extension GL_ARB_map_buffer_range.
This system supports the OpenGL extension GL_ARB_vertex_buffer_object.
This system supports the OpenGL extension GL_ARB_occlusion_query.
This system DOES NOT support the OpenGL extension GL_APPLE_texture_range.
This system DOES NOT support the OpenGL extension GL_APPLE_client_storage.
This system DOES NOT support the OpenGL extension GL_ARB_uniform_buffer.
This system supports the OpenGL extension GL_ARB_vertex_array_bgra.
This system supports the OpenGL extension GL_EXT_vertex_array_bgra.
This system supports the OpenGL extension GL_ARB_framebuffer_object.
This system DOES NOT support the OpenGL extension GL_GREMEDY_string_marker.
This system supports the OpenGL extension GL_ARB_debug_output.
This system supports the OpenGL extension GL_EXT_direct_state_access.
This system DOES NOT support the OpenGL extension GL_NV_bindless_texture.
This system DOES NOT support the OpenGL extension GL_AMD_pinned_memory.
This system supports the OpenGL extension GL_EXT_framebuffer_multisample_blit_scaled.
This system supports the OpenGL extension GL_EXT_texture_sRGB_decode.
This system supports the OpenGL extension GL_NVX_gpu_memory_info.
This system supports the OpenGL extension GL_ATI_meminfo.
This system supports the OpenGL extension GL_EXT_texture_compression_s3tc.
This system supports the OpenGL extension GL_EXT_texture_compression_dxt1.
This system supports the OpenGL extension GL_ANGLE_texture_compression_dxt3.
This system supports the OpenGL extension GL_ANGLE_texture_compression_dxt5.
This system supports the OpenGL extension GL_ARB_buffer_storage.
This system supports the OpenGL extension GLX_EXT_swap_control_tear.
OpenGL: NV166 4.3 (Compatibility Profile) Mesa 23.1.3 (4.3.0)
GL_NV_bindless_texture: DISABLED
GL_AMD_pinned_memory: DISABLED
GL_ARB_buffer_storage: AVAILABLE
GL_EXT_texture_sRGB_decode: AVAILABLE
AppFramework : Unable to load module engine.so!
Unable to load interface VCvarQuery001 from engine.so
src/tcmalloc.cc:278] Attempt to free invalid pointer 0xa7bb900 
./hl2.sh: line 72: 32217 Aborted                 ${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} "$@"```

Further investigation shows that the output of

cd bin/
export LD_LIBRARY_PATH="/home/admin/.local/share/Steam/steamapps/common/Team Fortress 2"/bin:$LD_LIB
RARY_PATH # it's done by the hl2.sh script to add the bin directory we just cded into as a directory in which libraries are stored
ldd engine.so

is

    linux-gate.so.1 (0xf7f8f000)
    libtier0.so => /home/admin/.local/share/Steam/steamapps/common/Team Fortress 2/bin/libtier0.so (0xf7481000)
    libvstdlib.so => /home/admin/.local/share/Steam/steamapps/common/Team Fortress 2/bin/libvstdlib.so (0xf7376000)
    libsteam_api.so => /home/admin/.local/share/Steam/steamapps/common/Team Fortress 2/bin/libsteam_api.so (0xf731c000)
    libSDL2-2.0.so.0 => /home/admin/.local/share/Steam/steamapps/common/Team Fortress 2/bin/libSDL2-2.0.so.0 (0xf721b000)
    libsteamnetworkingsockets.so => /home/admin/.local/share/Steam/steamapps/common/Team Fortress 2/bin/libsteamnetworkingsockets.so (0xf6d88000)
    libopenal.so.1 => not found
    libcurl-gnutls.so.4 => not found
    libm.so.6 => /lib/libm.so.6 (0xf6caa000)
    libdl.so.2 => /lib/libdl.so.2 (0xf6ca3000)
    libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/12/32/libstdc++.so.6 (0xf6a7c000)
    libpthread.so.0 => /lib/libpthread.so.0 (0xf6a77000)
    /lib/ld-linux.so.2 (0xf7f91000)
    libc.so.6 => /lib/libc.so.6 (0xf6860000)
    librt.so.1 => /lib/librt.so.1 (0xf685b000)
    libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/12/32/libgcc_s.so.1 (0xf6836000)

If I install all the necessary libraries (for this and another file I forgot that also has missing dependencies) with 32 bit support, the game refuses to launch at all through steam, and via hl2.sh it launches but doesn't show me my level or let me join servers (with or without VAC)

kisak-valve commented 1 year ago

Hello @SetOfAllSets, src/tcmalloc.cc:278] Attempt to free invalid pointer 0xa7bb900 reads like #5043. Can you check if your build of mesa is built against llvm 16?

SetOfAllSets commented 1 year ago

After a few googles I can't find how I would check that, my system also has llvm 15 and 16 installed so it's possible it's either

SetOfAllSets commented 1 year ago

I've rebuilt the package and checked what version of LLVM it build against, it was 16

kisak-valve commented 1 year ago

Thanks, it's likely that you're seeing the same issue that's being tracked in #5043 and rebuilding mesa against llvm 15 or using the NVIDIA proprietary driver should workaround it.

SetOfAllSets commented 1 year ago

EDIT: I don't know how I would compile mesa against a specific version of llvm and I cannot use the official nvidia drivers due to them not being supported by the sway compositor

alright, I will try that, first however I should mention that upon installing all the missing libraries for engine.so and vguimatsurface.so I need to copy the gameinfo file from tf/ to hl2/ and the entire scripts folder from tf/ to hl2/, at which point hl2.sh says

Loaded program cache file "glbaseshaders.cfg", total keyvalues: 266, total successfully linked: 227
Could not load program cache file glshaders.cfg
Could not find user GL shader cache file
Precache: Took 144 ms, Vertex 80, Pixel 171
server.so loaded for "Team Fortress"
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
08/05 12:46:54 Init: Installing breakpad exception handler for appid(440)/version(8227024)/tid(12169)
[S_API] SteamAPI_Init(): SteamAPI_IsSteamRunning() did not locate a running instance of Steam.
[S_API] SteamAPI_Init(): Loaded '/home/admin/.local/share/Steam/linux32/steamclient.so' OK.
[S_API FAIL] SteamAPI_Init() failed; create pipe failed.[S_API FAIL] Tried to access Steam interface SteamUser021 before SteamAPI_Init succeeded.
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.9/work/alsa-lib-1.2.9/src/confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.9/work/alsa-lib-1.2.9/src/conf.c:5181:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.9/work/alsa-lib-1.2.9/src/confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.9/work/alsa-lib-1.2.9/src/conf.c:5181:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.9/work/alsa-lib-1.2.9/src/confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.9/work/alsa-lib-1.2.9/src/conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.9/work/alsa-lib-1.2.9/src/conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.9/work/alsa-lib-1.2.9/src/pcm/pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM default
SDLAUDIO: SDL_OpenAudioDevice() failed: ALSA: Couldn't open audio device: No such file or directory
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
08/05 12:46:59 Init: Installing breakpad exception handler for appid(440)/version(8227024)/tid(12169)
[S_API] SteamAPI_Init(): SteamAPI_IsSteamRunning() did not locate a running instance of Steam.
[S_API] SteamAPI_Init(): Loaded '/home/admin/.local/share/Steam/linux32/steamclient.so' OK.
[S_API FAIL] SteamAPI_Init() failed; create pipe failed../hl2.sh: line 72: 12169 Segmentation fault      ${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} "$@"

and exits. Running from the client still shows the valve intro and crashes.

I decided to run stream from the command line and saw it was trying to run lsof and xdg-user-dirs both of which I did not have installed. Upon installing them and running the game from steam I get the error ERROR: ld.so: object '/home/admin/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.. I am now investigationg gameroverlayrenderer.so, it may also be missing dependencies.

SetOfAllSets commented 1 year ago

It turns out the part of the error "wrong ELF class: ELFCLASS64" was indicative of gameoverlayrenderer.so being 64 bit when it should be 32 bit.

SetOfAllSets commented 1 year ago

After some investigation it turns out that it's normal for steam to load both the 32 and 64 bit vers of the overlay renderer (and for one to not load), the real issue seems to be (process:20762): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed

SetOfAllSets commented 1 year ago

A breakthrough! When running steam and launching the game via hl2.sh not using steam but with steam open it runs! I have no clue what could be causing this or if the issue should be closed (probably not since this seems to be very unintended)

SetOfAllSets commented 1 year ago

Ah. When I load into the game the steam overlay (and the mann co store as a result) do not work. Audio is completely gone and loading into a game just presents a blank pop up window with an ok button. Clicking the button blanks the screen and requires me to force stop the game. It seems launching from within steam may be an necessity.

SetOfAllSets commented 1 year ago

It seems that src/tcmalloc.cc:278] Attempt to free invalid pointer 0xa88fad0 may be part of the issue as I get (process:20762): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed even when launching some games successfully.

SetOfAllSets commented 1 year ago

Adding LD_PRELOAD=/usr/lib/libtcmalloc.so to the start of hl2.sh lets me start, fixes audio, and lets me join games! The only broken thing I've encountered thus far is the overlay not working!

dhalucario commented 1 year ago

Is this ever gonna get fixed eventually? I run into VAC issues and I don't know if this is due to me symlinking libtcmalloc every single time I have to install the game...

SetOfAllSets commented 1 year ago

Is this ever gonna get fixed eventually? I run into VAC issues and I don't know if this is due to me symlinking libtcmalloc every single time I have to install the game...

Don't symlink, edit the script with the argument.

RomeoV commented 11 months ago

I get the same error, on Arch Linux running wayland/sway. Running

LD_PRELOAD=/usr/lib/libtcmalloc.so steam open ./hl2.sh

yields

ERROR: ld.so: object '/usr/lib/libtcmalloc.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
SetOfAllSets commented 11 months ago

Replying to https://github.com/ValveSoftware/Source-1-Games/issues/5125#issuecomment-1848859355

Try using a 32 bit version of libtcmalloc, TF2 is 32 bit

RomeoV commented 11 months ago

Turns out I can launch just fine when I set the TF2 compatability to Proton 8.0, from inside steam. EDIT: Never mind, it crashes once I actually try to join a game...

SetOfAllSets commented 11 months ago

Turns out I can launch just fine when I set the TF2 compatability to Proton 8.0, from inside steam. EDIT: Never mind, it crashes once I actually try to join a game...

That's also using the windows version in proton, which is slower

RomeoV commented 11 months ago

Unfortunately, installing the 32 bit version, i.e. lib32-gperftools from the AUR, still yields a similar error:

LD_PRELOAD=/usr/lib32/libtcmalloc.so ./hl2.sh

yields

ERROR: ld.so: object '/usr/lib32/libtcmalloc.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.

I'll leave it for tonight...

Kate6 commented 9 months ago

I'm on Lubuntu 22.04... What ended up working for me was:

  1. Install 32 bit libtcmalloc_minimal4. I used the Debian package from https://packages.debian.org/sid/i386/libtcmalloc-minimal4/download.
  2. Symlink from /usr/lib/i386-linux-gnu/libtcmalloc_minimal.so.4 to ~/.local/share/Steam/steamapps/common/Team Fortress 2/bin, overwriting the version of libtcmalloc_minimal4 that was already in there.
  3. Install the libopenal1:i386 from the regular Ubuntu repo. This appears to be a dependency of the engine.so file in the Team Fortress 2/bin folder that isn't satisfied by any of the libraries currently in that same folder. I didn't need to symlink anything for this one -- when launched from inside the Steam launcher, TF2 picked it up from wherever apt left it.

EDIT: Discovered that Aperture Desk Job has a similar issue with libtcmalloc, but that game uses the 64 bit version... Also discovered that Steam's update feature was overwriting my symlinked libtcmalloc... So I made this little shell script to quickly unbreak what the update function breaks... https://gist.github.com/Kate6/49e2ac0b2274c524df8f6995df7855c8

adverbialsatz commented 9 months ago

This worked for me too (I use Arch btw).

haluzpav commented 8 months ago

On Fedora following worked for me.

sudo dnf install gperftools-libs.i686

Then in Steam, launch options

LD_PRELOAD=$LD_PRELOAD:/usr/lib/libtcmalloc_minimal.so.4 %command% -novid

When trying to run from terminal, I was getting AppFramework : Unable to load module engine.so! no matter what, no idea why.

Kate6 commented 8 months ago

When trying to run from terminal, I was getting AppFramework : Unable to load module engine.so! no matter what, no idea why.

Do

ldd ~/.local/share/Steam/steamapps/common/Team\ Fortress\ 2/bin/engine.so

to see which of engine.so's dependencies it's bombing on. Though obviously if it's working inside the Steam launcher the culprit will most likely be Steam launcher setting something like LD_PRELOAD or LD_LIBRARY_PATH differently than your terminal shell sets it.