Skip to content

Mangohud OpenGL doesn't work out of the box with runtime ( native and Proton) #435

Closed

Description

@Leopard1907

Your system information

Please describe your issue in as much detail as possible:

OpenGL games ( native and Proton) doesn't work out of the box with runtime. Normally they should work with just mangohud %command% or mangohud --dlsym %command%

Needs this for 32 bit apps:

LD_PRELOAD=$LD_PRELOAD:/usr/lib/mangohud/lib32/libMangoHud_dlsym.so:/usr/lib/mangohud/lib32/libMangoHud.so %command%

Needs this for 64 bit apps:

LD_PRELOAD=$LD_PRELOAD:/usr/lib/mangohud/lib/libMangoHud_dlsym.so:/usr/lib/mangohud/lib/libMangoHud.so %command%

Tested games are:

-Floating Point ( 32 bit native GL, SLR forced)
-Mount & Blade: Warband ( 64 bit native GL, SLR forced )
-Wolfenstein New Order ( 64 bit Windows only GL , proton )
-Wolfenstein Old Blood ( 64 bit Windows only GL , proton )

All of them reproduces the problem.

Logs:

slr-app48700-t20210722T182510.log
slr-app302380-t20210723T131457.log

Steps for reproducing this issue:

  1. Install Mangohud
  2. Try to use Mangohud ( mangohud --dlsym %command% or mangohud %command% on either a native GL game within SLR or a Windows only GL game within Proton
  3. Try with LD PRELOAD workaround noted above

Activity

  1. smcv commented on Jul 23, 2021

    @smcv
    Contributor

    What does mangohud set LD_PRELOAD and LD_LIBRARY_PATH to on your system?

    The easiest way to answer that question might be to run mangohud steam and grab the Help -> System Information.

    On my Debian system, the answers are:

    LD_PRELOAD="${LD_PRELOAD}:libMangoHud.so"     # or libMangoHud_dlsym.so:libMangoHud.so
    LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/\$LIB/mangohud/"
    

    and one possible trigger for this problem might be the special $LIB token in the LD_LIBRARY_PATH. We can't know what that token will expand to - glibc has no API to tell us. Recent versions of the steam-runtime-tools library can try to guess from a list of likely possibilities, but that isn't currently wired up to the LD_PRELOAD and LD_LIBRARY_PATH handling.

    Logs:

    Are these with or without your workaround?

  2. Leopard1907 commented on Jul 23, 2021

    @Leopard1907
    Author

    Those logs were taken with workaround in place.

  3. smcv commented on Jul 23, 2021

    @smcv
    Contributor

    Please could you get a log without the workaround when you have a chance?

    In general, what we need is a log from the broken/bad situation. If you're able to get logs with a workaround as well, that's sometimes a useful comparison, but a log in the broken situation is usually more important.

  4. Leopard1907 commented on Jul 25, 2021

    @Leopard1907
    Author

    @smcv Fresh logs, without workaround in place.

    mangohud %command

    slr-app48700-t20210725T123955.log
    slr-app302380-t20210725T123818.log

  5. Leopard1907 commented on Jul 25, 2021

    @Leopard1907
    Author

    Without workaround in place.

    mangohud --dlsym %command%

    slr-app48700-t20210725T124801.log
    slr-app302380-t20210725T124737.log

  6. Leopard1907 commented on Jul 25, 2021

    @Leopard1907
    Author

    System info report tool output from __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only mangohud steam:

    https://gist.github.com/Leopard1907/e874de378f642855ddb9058ac64ac3cd

  7. lukashoracek commented on Jul 25, 2021

    @lukashoracek

    I also have this issue. Tested with Half-Life 2 with Steam Linux Runtime forced.
    Replacing \$LIB with lib32 makes it work for Half-Life 2.

    Here's MangoHud script on my system /usr/bin/mangohud:

    #!/bin/sh
    
    if [ "$#" -eq 0 ]; then
    	programname=`basename "$0"`
    	echo "ERROR: No program supplied"
    	echo
    	echo "Usage: $programname <program>"
    	exit 1
    fi
    
    if [ "$1" = "--dlsym" ]; then
    	MANGOHUD_DLSYM=1
    	shift
    fi
    
    MANGOHUD_LIB_NAME="/usr/lib/mangohud/\$LIB/libMangoHud.so"
    
    if [ "$MANGOHUD_DLSYM" = "1" ]; then
    	MANGOHUD_LIB_NAME="/usr/lib/mangohud/\$LIB/libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
    fi
    
    # Preload using the plain filenames of the libs, the dynamic linker will
    # figure out whether the 32 or 64 bit version should be used, and will search
    # for it in the correct directory
    LD_PRELOAD="${LD_PRELOAD}:${MANGOHUD_LIB_NAME}"
    LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:"
    
    exec env MANGOHUD=1 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" LD_PRELOAD="${LD_PRELOAD}" "$@"
    
  8. smcv commented on Jul 26, 2021

    @smcv
    Contributor

    Yeah, I think this is because MangoHud is using the special token $LIB and we don't handle that yet. I'll look into it.

    Workaround: have two modified versions of the script, mangohud32 and mangohud64, in which you replace $LIB with the correct expansion, and then choose which script to use for each game. The expansion varies between distributions:

    Distribution 32-bit 64-bit
    Arch, Manjaro etc. lib32 lib
    Red Hat, Fedora, openSUSE etc. lib lib64
    Debian, Ubuntu etc. lib/i386-linux-gnu lib/x86_64-linux-gnu

    Replacing $LIB with lib32 makes it work for Half-Life 2

    FYI, that'll make it work for 32-bit games like HL2 and TF2, but not for 64-bit games like Artifact and (I think) DOTA 2.

  9. smcv commented on Aug 3, 2021

    @smcv
    Contributor

    Here's MangoHud script on my system /usr/bin/mangohud

    @lukashoracek: What OS are you using?

    @Leopard1907: is your mangohud script the same as @lukashoracek has? If different, it would be useful to see its content.

    Both @lukashoracek and @Leopard1907: Have you modified the script, or is this as supplied by your OS's package manager, or did you install MangoHud from upstream source code, or something different? If you installed from upstream source code, did you use build.sh or something else?

    (I'm trying to cover all the reasonable configurations while testing a solution for this, and I'd prefer to be able to say "the way Debian installs MangoHud" or "the way Arch installs MangoHud" or "the way upstream installs MangoHud", rather than "the way @lukashoracek reports that it works"!)

  10. Leopard1907 commented on Aug 4, 2021

    @Leopard1907
    Author

    @smcv Content of usr\bin\mangohud:

    #!/bin/sh
    
    if [ "$#" -eq 0 ]; then
    	programname=`basename "$0"`
    	echo "ERROR: No program supplied"
    	echo
    	echo "Usage: $programname <program>"
    	exit 1
    fi
    
    if [ "$1" = "--dlsym" ]; then
    	MANGOHUD_DLSYM=1
    	shift
    fi
    
    MANGOHUD_LIB_NAME="/usr/lib/mangohud/\$LIB/libMangoHud.so"
    
    if [ "$MANGOHUD_DLSYM" = "1" ]; then
    	MANGOHUD_LIB_NAME="/usr/lib/mangohud/\$LIB/libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
    fi
    
    # Preload using the plain filenames of the libs, the dynamic linker will
    # figure out whether the 32 or 64 bit version should be used, and will search
    # for it in the correct directory
    LD_PRELOAD="${LD_PRELOAD}:${MANGOHUD_LIB_NAME}"
    LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:"
    
    exec env MANGOHUD=1 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" LD_PRELOAD="${LD_PRELOAD}" "$@"
    

    I didn't modify the script, using Mangohud release as what it is.

    https://github.com/flightlessmango/MangoHud#github-releases

    ./mangohud-setup.sh install

  11. lukashoracek commented on Aug 4, 2021

    @lukashoracek

    @smcv I am using Arch Linux and I installed MangoHud by cloning git repository and running ./build.sh install.

  12. smcv commented on Aug 4, 2021

    @smcv
    Contributor

    Thanks. It's looking as though solving this for the way MangoHud works when installed from upstream (absolute paths in LD_PRELOAD) is going to be more straightforward than solving this for the way Debian installs it (basename in LD_PRELOAD, absolute path in LD_LIBRARY_PATH), but I'm aiming to do both.

  13. smcv commented on Aug 9, 2021

    @smcv
    Contributor

    This will hopefully be solved in the next client_beta version of Steam Linux Runtime - soldier (SteamLinuxRuntime_soldier/VERSIONS.txt should say depot 0.20210809.21 or later).

    Note that if you use Steam Linux Runtime, this particular beta will also require updating Steam Linux Runtime to the client_beta branch (if you don't update both tools, a few native Linux games like Shadowrun Returns won't work).

  14. Leopard1907 commented on Aug 9, 2021

    @Leopard1907
    Author

    Thanks for the fix. I tried some of the games i noted above with those new runtime versions and cannot reproduce the problem.

    • Floating Point
    • Mount & Blade: Warband
    • Wolfenstein New Order

    MangoHud OGL works as expected with mangohud %command and mangohud --dlsym %command%

    Content of SteamLinuxRuntime_soldier/VERSIONS.txt:

    #Name	Version		Runtime	Runtime_Version	Comment
    depot	0.20210809.22			# Overall version number
    pressure-vessel	0.20210809.1			
    scripts	v0.20210806.0-0-g21006f2			# Entry point scripts, etc.
    soldier	0.20210806.0	soldier	0.20210806.0	# soldier_platform_0.20210806.0/
    

    Content of SteamLinuxRuntime/VERSIONS.txt:

    #Name	Version		Runtime	Runtime_Version	Comment
    depot	0.20210809.34			# Overall version number
    LD_LIBRARY_PATH	-	scout	-	# see ~/.steam/root/ubuntu12_32/steam-runtime/version.txt
    scripts	v0.20210806.0-0-g21006f2			# Entry point scripts, etc.
    
  15. lukashoracek commented on Aug 10, 2021

    @lukashoracek

    MangoHud in Half-Life 2 works now, thanks!

  16. smcv commented on Aug 10, 2021

    @smcv
    Contributor

    Great, let's leave this issue open for now, but we can close it when soldier depot 0.20210809.22 goes to the default branch.

  17. smcv commented on Sep 3, 2021

    @smcv
    Contributor

    Great, let's leave this issue open for now, but we can close it when soldier depot 0.20210809.22 goes to the default branch.

    This has now happened (with a bit more delay than usual, because this change triggered a regression for users of libstrangle, which I fixed in libstrangle). @kisak-valve, I think we can close this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions