nickguletskii / GLXOSD

GLXOSD is an extensible on-screen display (OSD)/overlay for OpenGL applications running on Linux with X11 which aims to provide similar functionality to MSI Afterburner/RivaTuner OSD. It can show FPS, frame timings, temperatures and more in OpenGL games and applications. It can also be used to benchmark games, much like voglperf.
https://glxosd.nickguletskii.com
MIT License
124 stars 20 forks source link

Does not work with Steam games on Ubuntu 15.04 64bit #21

Closed sabun123 closed 9 years ago

sabun123 commented 9 years ago

Hi, I've recently compiled GLXOSD a number of times on Ubuntu 15.04, each time I try to get it to work with games on Steam via the glxosd --steam %command% Launch option. Nothing works, not even Source games are able to launch with it anymore. The only thing GLXOSD is able to inject into is glxgears.

Here's output from a Terminal when running GLXOSD directly from a Terminal now (Cities Skylines 64bit). I'm uncertain if I'm calling it correctly for Steam:

ismail@Intel-Ubuntu:~$ glxosd --steam steam://rungameid255710
/usr/local/bin/glxosd: line 70: steam://rungameid/255710: No such file or directory

However, changing it to this now at least gets the game running:

ismail@Intel-Ubuntu:~$ glxosd steam steam://rungameid/255710

It still seems to be unable to inject itself, and this is the output:

Running Steam on ubuntu 15.04 64-bit
STEAM_RUNTIME is enabled automatically
grep: /home/ismail/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local//lib/x86_64-linux-gnu//glxosd/libglxosd.so)
grep: /home/ismail/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local//lib/x86_64-linux-gnu//glxosd/libglxosd.so)
grep: /home/ismail/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local//lib/x86_64-linux-gnu//glxosd/libglxosd.so)
awk: /home/ismail/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local//lib/x86_64-linux-gnu//glxosd/libglxosd.so)
ERROR: ld.so: object 'libglxosd-elfhacks.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object 'libglxosd-glinject.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object 'libglxosd.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ismail@Intel-Ubuntu:~$ 

I have libstdc++6, libstdc++6:i386, and libstdc++-4.9 which should fulfill the requirement but it still complains. A note, I previously had an issue after updating Ubuntu where GLXOSD spat out this error on compiling:

make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libGL.so', needed by 'bin/libglxosd.so.2.3.3'.  Stop.
CMakeFiles/Makefile2:231: recipe for target 'src/glxosd/CMakeFiles/glxosd.dir/all' failed
make[1]: *** [src/glxosd/CMakeFiles/glxosd.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error

Looks like somehow it forgot where to look for libGL, so running this in a Terminal seemed to fix it, but I'm unsure if this is also the root cause of my issue with GLXOSD:

sudo ln -s -f -i /usr/lib/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so

ldconfig is telling me that libGL.so.1 -> libGL.so.346.47 which means it is using my Nvidia driver's GL which is good. It is not using Nouveau.

I make sure to clean all my directories from GLXOSD and run ./clean, before compiling and running make install each time to ensure it's not storing any old or broken files. The directories I clean out are: /etc/glxosd.conf /usr/local/lib/x86_64-linux-gnu/glxosd /usr/local/bin/glxosd

I've attempted to modify the version of C++ used when compiling and tried all three

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++14")

No difference.

I've also discovered that CMAKE will complain it cannot find pthread. So, I adjusted parts of CMakeLists.txt to look like this, and this seems to allow CMAKE to find pthread:

project (glxosd C CXX)
...
##### Compiler #####
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")

Any help is greatly appreciated.

sabun123 commented 9 years ago

Renaming libstdc++.so.6 in the Steam directory /home/ismail/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/ seems to stop it from complaining about GLIBCXX, since now it's forced to use the newer version available in Ubuntu instead of the one provided by Steam.

However, I have no clue how to fix this part:

ismail@Intel-Ubuntu:~$ glxosd steam steam://rungameid/255710
Running Steam on ubuntu 15.04 64-bit
STEAM_RUNTIME is enabled automatically
ERROR: ld.so: object 'libglxosd-elfhacks.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object 'libglxosd-glinject.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object 'libglxosd.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ismail@Intel-Ubuntu:~$

Is this happening because Steam itself is 32bit, but GLXOSD is being compiled as a 64bit program since I'm using a 64bit version of Ubuntu?

licaon-kter commented 9 years ago

Some ideas: 1) You need to start it:

glxosd --steam steam steam://rungameid/255710

as --steam is a glxosd parameter.

2) You need a GLXOSD version compatible with the game, say if it's a 32 bit game ( _ldd gameexe -> points at libs in lib32 or i386-gnu-linux ?) then you need the 32 bit version. It is safe to install both versions, as the game will eventually load the correct version on start.

sabun123 commented 9 years ago

Thank you for responding! I appreciate your assistance :)

Running it with your suggested command produced the following output:

Running Steam on ubuntu 15.04 64-bit
pid 31467 != 31373, skipping destruction (fork without exec?)
pid 31466 != 31373, skipping destruction (fork without exec?)
pid 31465 != 31373, skipping destruction (fork without exec?)
pid 31470 != 31373, skipping destruction (fork without exec?)
pid 31469 != 31373, skipping destruction (fork without exec?)
STEAM_RUNTIME is enabled automatically
pid 31473 != 31373, skipping destruction (fork without exec?)
ERROR: ld.so: object 'libglxosd-elfhacks.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object 'libglxosd-glinject.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object 'libglxosd.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.

Doesn't seem to be all that different from before. I've tried injecting 32bit and 64bit games from Steam, nothing works. I'm pretty certain this is because Steam itself is 32bit and GLXOSD is injecting Steam's overlay and not the actual game itself.

To that effect, like you say, I'll need a 32bit version of GLXOSD and this shouldn't be a problem, except I can't get the 32bit version to compile right! In CMakeLists.txt I added the line

##### Compiler #####
SET(CMAKE_CXX_FLAGS -m32)

It works in that it forces GLXOSD to begin compiling a 32bit version, but I cannot resolve the dependency issues:

from /home/ismail/Desktop/GLXOSD/src/glxosd/GLXOSD.cpp:10:
/usr/include/freetype2/config/ftheader.h:7:56: fatal error: i386-linux-gnu/freetype2/config/ftheader.h: No such file or directory
 #  include <i386-linux-gnu/freetype2/config/ftheader.h>
                                                        ^

If you have any idea on how I can proceed from this point, I am all ears sincerely! I'm in the middle of downloading the 32bit version of 15.04 to attempt compiling it from a LiveUSB but Canonical's latest release seems to be bogged down by many others downloading the same thing. It's going to take a day before I complete the download.

licaon-kter commented 9 years ago

What 64-bit games did you try? That error tells me that you only have the 64bit version of GLXOSD. I'm not sure now how you enable multi-arch on Ubuntu, but it should be similar to Debian: https://wiki.debian.org/Multiarch/HOWTO That's what I use, and I got the PPA (Ubuntu build DEBs) info from the home page here https://nickguletskii.github.io/GLXOSD/install.html and installed both 32 and 64 bit versions by

apt-get packagename packagename:i386

where packagename will install 64bit version and packagename:i386 the 32 bit version.

sabun123 commented 9 years ago

I've tried Cities Skylines and XCOM, which are both 64bit executables. I only have 64bit GLXOSD, because I can't get the 32bit version to compile fully (hence the dependency problem).

Those packages you installed from the PPA are packaged for Utopic and Trusty (and the 64bit PPA contains both the 32bit and 64bit version of GLXOSD). I'm compiling from source because the PPA does not yet have support for Ubuntu 15.04, otherwise I would just use the PPA.

I have libfreetype6-dev installed, which contains the necessary things for compiling in both a 64bit and 32bit scenario, which is why it's baffling me so much that I can't get past the freetype i386 dependency during compile.

licaon-kter commented 9 years ago

Installing those DEBs by dpkg does not work? (you'll have to track and install deps by hand too)

sabun123 commented 9 years ago

Alright, I hadn't thought about taking the individual .debs of the PPA and installing them manually. Thank you for that idea.

I installed the following manually through USC, from here, one-by-one in the following order: glxosd-data_2.3.3_all.deb glxosd-libs-i386_2.3.3_i386.deb glxosd-2.3.3_i386.deb

It finally works! It shows the GLXOSD fps numbers in Cities Skylines and XCOM: Enemy Unknown.

I noticed, this puts glxosd in usr/bin, compared to when compiling it puts glxosd in usr/local/bin.

I'd still like to learn how to compile the 32bit version of GLXOSD on a 64bit install, but I'm grateful. Thanks to your help licaon-kter I can now use GLXOSD as I need! I appreciate your help :)

licaon-kter commented 9 years ago

The simplest solution ;)

sabun123 commented 9 years ago

Strange though, running it from a terminal, it still outputs the following error even though it works in Cities Skylines:

Running Steam on ubuntu 15.04 64-bit
pid 8327 != 8232, skipping destruction (fork without exec?)
pid 8326 != 8232, skipping destruction (fork without exec?)
pid 8325 != 8232, skipping destruction (fork without exec?)
pid 8330 != 8232, skipping destruction (fork without exec?)
pid 8329 != 8232, skipping destruction (fork without exec?)
STEAM_RUNTIME is enabled automatically
pid 8333 != 8232, skipping destruction (fork without exec?)
ERROR: ld.so: object 'libglxosd-elfhacks.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object 'libglxosd-glinject.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object 'libglxosd.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ismail@Intel-Ubuntu:~$ 

More importantly though, is that I can't seem to get it to inject Counter Strike Source. Works on Cities Skylines, but not CSS. They both produce the same Terminal output. I wonder what the difference is.

licaon-kter commented 9 years ago

The output just says that it tried the 64bit version and failed, the Steam Overlay has the same error BTW, you can ignore it since if you see GLXOSD on screen it means the 32bit libs got loaded afterwards anyway.

What does this do?

glxosd --steam steam steam://rungameid/240

(assuming I got the CSS ID right)

sabun123 commented 9 years ago

That is the correct CSS ID, and it produces the exact same error as above (wrong ELF class). It then simply closes. Very peculiar.

nickguletskii commented 9 years ago

Unfortunately, fixing this issue permanently would require a rewrite, and I am kind of short on time at the moment, so don't expect a fix in the next month... I will try

https://github.com/nickguletskii/GLXOSD/issues/24

sabun123 commented 9 years ago

Thank you for your hardwork nick, and thank you for such a great piece of software. Keep up the good work, and don't stress yourself out :)