You are not logged in.
I already asked this on r/linux4noobs and r/linuxquestions and r/archlinux,but the people couldn't help me,so I ask here.
I want to use Mangohud,cause I want to see my fps in game and limit the fps and use vsync options,it already works globally for vulkan programs by puttig "export MANGOHUD=1" in .profile,but that doesn't work with OpenGL programs.
I asked the mangohud dev and he replied that I needed to put this in .profile:
export LD_PRELOAD=/usr/lib/mangohud/libMangoHud.so:/usr/lib32/mangohud/libMangoHud.so
export MANGOHUD=1
export MANGOHUD_DLSYM=1
But when I do this and restart,then it still doesn't work with OpenGL apps globally,the dev said that he can't help me,so did anyone of you get it to work?
Offline
Are you sure your ~/.profile is even read? https://wiki.archlinux.org/title/Bash#C … tion_files
Offline
When I put env vars that are not LD_PRELOAD,then they work,so they get read.
Offline
Does the output of env list
LD_PRELOAD=/usr/lib/mangohud/libMangoHud.so:/usr/lib32/mangohud/libMangoHud.so
MANGOHUD=1
MANGOHUD_DLSYM=1
How are you starting the applications? If not from the console does it work from the console?
Offline
Does the output of env list
LD_PRELOAD=/usr/lib/mangohud/libMangoHud.so:/usr/lib32/mangohud/libMangoHud.so MANGOHUD=1 MANGOHUD_DLSYM=1
How are you starting the applications? If not from the console does it work from the console?
That's strange,none of the env vars get listed even though some that I put in .profile work.
So how can I make .profile properly readable?
I am starting the applications by .desktop files or executing the executable directly,starting them from terminal also doesn't make mangohud work.
Offline
Is the desktop started by a display manager or started on your user login. If user login what is the login shell?
Offline
I start it by the sddm display manager.
Offline
/usr/share/sddm/scripts/Xsession for an X session and /usr/share/sddm/scripts/wayland-session source various files at startup. The particular files depends on the users login shell.
Last edited by loqs (2021-06-09 23:48:41)
Offline
Can I somehow edit which files /usr/share/sddm/scripts/wayland-session sources at startup?
Offline
Yes you can edit it. Is that needed? The default contents is:
#!/bin/sh
# wayland-session - run as user
# Copyright (C) 2015-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
# This file is extracted from kde-workspace (kdm/kfrontend/genkdmconf.c)
# Copyright (C) 2001-2005 Oswald Buddenhagen <ossi@kde.org>
# Note that the respective logout scripts are not sourced.
case $SHELL in
*/bash)
[ -z "$BASH" ] && exec $SHELL $0 "$@"
set +o posix
[ -f /etc/profile ] && . /etc/profile
if [ -f $HOME/.bash_profile ]; then
. $HOME/.bash_profile
elif [ -f $HOME/.bash_login ]; then
. $HOME/.bash_login
elif [ -f $HOME/.profile ]; then
. $HOME/.profile
fi
;;
*/zsh)
[ -z "$ZSH_NAME" ] && exec $SHELL $0 "$@"
[ -d /etc/zsh ] && zdir=/etc/zsh || zdir=/etc
zhome=${ZDOTDIR:-$HOME}
# zshenv is always sourced automatically.
[ -f $zdir/zprofile ] && . $zdir/zprofile
[ -f $zhome/.zprofile ] && . $zhome/.zprofile
[ -f $zdir/zlogin ] && . $zdir/zlogin
[ -f $zhome/.zlogin ] && . $zhome/.zlogin
emulate -R sh
;;
*/csh|*/tcsh)
# [t]cshrc is always sourced automatically.
# Note that sourcing csh.login after .cshrc is non-standard.
wlsess_tmp=`mktemp /tmp/wlsess-env-XXXXXX`
$SHELL -c "if (-f /etc/csh.login) source /etc/csh.login; if (-f ~/.login) source ~/.login; /bin/sh -c 'export -p' >! $wlsess_tmp"
. $wlsess_tmp
rm -f $wlsess_tmp
;;
*/fish)
xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX`
$SHELL --login -c "/bin/sh -c 'export -p' > $xsess_tmp"
. $xsess_tmp
rm -f $xsess_tmp
;;
*) # Plain sh, ksh, and anything we do not know.
[ -f /etc/profile ] && . /etc/profile
[ -f $HOME/.profile ] && . $HOME/.profile
;;
esac
exec $@
So login shell is:
bash sources /etc/profile directly,
zsh sources /etc/zsh/zprofile which by default sources /etc/profile
tsch not sure on this one
fish again not sure
anything else, sources /etc/profile directly.
Offline
So if I understand it right,then I should try to put the env vars in /etc/profile?
Offline
I missed you were using .profile instead of profile.
login shell is:
bash sources .profile directly,
zsh sources .zprofile
tsch not sure on this one
fish again not sure
anything else, sources .profile directly
So if your login shell is zsh either add the vars to .zprofile or have .zprofile source .profile.
Offline
How can I check which login shell I use?
I have zsh and bash installed,but forgot what I set as login shell.
Offline
getent passwd $UID
login shell will be the seventh ( last ) of colon separated fields.
Offline
getent passwd $UID
login shell will be the seventh ( last ) of colon separated fields.
It's bash,that's strange,now the question is why .profile doesn't work.
Offline
*/bash)
[ -z "$BASH" ] && exec $SHELL $0 "$@"
set +o posix
[ -f /etc/profile ] && . /etc/profile
if [ -f $HOME/.bash_profile ]; then
. $HOME/.bash_profile
elif [ -f $HOME/.bash_login ]; then
. $HOME/.bash_login
elif [ -f $HOME/.profile ]; then
. $HOME/.profile
fi
I missed in order of preference .bash_profile .bash_login and then .profile will be used.
So I am guessing as per deafult you have .bash_profile.
Offline
So I am guessing as per deafult you have .bash_profile.
That was the link in the second post that OP ignored.
Toadfield, you are going to have a hard time with Arch if you expect to be spoonfed.
Offline
*/bash) [ -z "$BASH" ] && exec $SHELL $0 "$@" set +o posix [ -f /etc/profile ] && . /etc/profile if [ -f $HOME/.bash_profile ]; then . $HOME/.bash_profile elif [ -f $HOME/.bash_login ]; then . $HOME/.bash_login elif [ -f $HOME/.profile ]; then . $HOME/.profile fi
I missed in order of preference .bash_profile .bash_login and then .profile will be used.
So I am guessing as per deafult you have .bash_profile.
But wouldn't that mean that all three,.bash_profile .bash_login and .profile will be used?
Or does only .bash_profile get used?
Offline
But wouldn't that mean that all three,.bash_profile .bash_login and .profile will be used?
Or does only .bash_profile get used?
You may be interested in... Bash Scripting Tutorial - If statements
"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb
Offline
So I edited my .bash_profile and it now looks like this:
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc
export LD_PRELOAD=/usr/lib/libMangoHud.so:/usr/lib32/libMangoHud.so:/usr/lib/libgtk3-nocsd.so.0
export MANGOHUD_DLSYM=1
export MANGOHUD=1
export CLUTTER_BACKEND=wayland
export GTK_USE_PORTAL=1
export GTK_CSD=0
I tested it,mangohud works with Vulkan applications,but it still doesn't work with OpenGL applications.
I also tried another LD_PRELOAD Env Var (/usr/lib/libgtk3-nocsd.so.0),but that also doesn't work.
Offline
I think the problem here isn't mangohud itself,but LD_PRELOAD.
Offline
I think the problem here isn't mangohud itself,but LD_PRELOAD.
How did you reach that conclusion? Have you read through the ld.so man page, which includes how to trace the loaded libraries?
LD_TRACE_LOADED_OBJECTS="" stat
linux-vdso.so.1 (0x00007ffe789d7000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f84d5cac000)
/lib64/ld-linux-x86-64.so.2 (0x00007f84d5e9a000)
LD_TRACE_LOADED_OBJECTS="" LD_PRELOAD=/usr/lib/libm.so.6 stat
linux-vdso.so.1 (0x00007fff43d3c000)
/usr/lib/libm.so.6 (0x00007f75d4802000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f75d4616000)
/lib64/ld-linux-x86-64.so.2 (0x00007f75d4949000)
LD_TRACE_LOADED_OBJECTS="" LD_PRELOAD=/usr/lib/liblib.so stat
ERROR: ld.so: object '/usr/lib/liblib.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
linux-vdso.so.1 (0x00007ffd11bb4000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f849edb5000)
/lib64/ld-linux-x86-64.so.2 (0x00007f849efa3000)
Last edited by loqs (2021-06-14 19:18:17)
Offline
Toadfield wrote:I think the problem here isn't mangohud itself,but LD_PRELOAD.
How did you reach that conclusion? Have you read through the ld.so man page, which includes how to trace the loaded libraries?
LD_TRACE_LOADED_OBJECTS="" stat linux-vdso.so.1 (0x00007ffe789d7000) libc.so.6 => /usr/lib/libc.so.6 (0x00007f84d5cac000) /lib64/ld-linux-x86-64.so.2 (0x00007f84d5e9a000) LD_TRACE_LOADED_OBJECTS="" LD_PRELOAD=/usr/lib/libm.so.6 stat linux-vdso.so.1 (0x00007fff43d3c000) /usr/lib/libm.so.6 (0x00007f75d4802000) libc.so.6 => /usr/lib/libc.so.6 (0x00007f75d4616000) /lib64/ld-linux-x86-64.so.2 (0x00007f75d4949000) LD_TRACE_LOADED_OBJECTS="" LD_PRELOAD=/usr/lib/liblib.so stat ERROR: ld.so: object '/usr/lib/liblib.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. linux-vdso.so.1 (0x00007ffd11bb4000) libc.so.6 => /usr/lib/libc.so.6 (0x00007f849edb5000) /lib64/ld-linux-x86-64.so.2 (0x00007f849efa3000)
I did
LD_TRACE_LOADED_OBJECTS="" LD_PRELOAD=/usr/lib/libMangoHud.so
and I got nothing as an output,did I get it wrong?
I also tested it by running some gui applications (not from the terminal) and neither mangohud nor libstrangle nor gtk3-nocsd LD_PRELOAD commands worked.
This is my system info if this helps:
OS: Arch Linux x86_64
Kernel: 5.12.10-arch1-1
Uptime: 5 hours, 48 mins
Packages: 1704 (pacman), 4 (flatpak)
Shell: bash 5.1.8
Resolution: 1920x1080
DE: Plasma 5.22.0
WM: kwin
WM Theme: WhiteSur-Sharp-dark
Theme: WhiteSurDark [Plasma], Breeze-gtk [GTK2], Breeze [GTK3]
Icons: [Plasma], WhiteSur-dark [GTK2/3]
Terminal: konsole
Terminal Font: Monospace 14
CPU: AMD Ryzen 5 3600 (12) @ 3.600GHz
GPU: AMD ATI Radeon RX 470/480/570/570X/580/580X/590
GPU: AMD ATI Radeon R7 240/340
Memory: 3418MiB / 15995MiB
Desktop Protocol: Wayland
Offline
LD_TRACE_LOADED_OBJECTS="" LD_PRELOAD=/usr/lib/libMangoHud.so
What command is the above supposed to be preloading /usr/lib/libMangoHud.so into? As posted the above sets two variables and does nothing else.
Last edited by loqs (2021-06-15 00:13:55)
Offline
How can I check it then?
Offline