Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mangohud): support 32bit apps #6342

Merged
merged 15 commits into from
Sep 13, 2024
Merged

Conversation

bright-side-99
Copy link
Contributor

@bright-side-99 bright-side-99 commented Aug 16, 2024

update script to latest specmangohud support 32bit games via 2 builds + installs, one for mangohud default (64bit) and one for 32bit

the problem with the current script is, that old games (or other 3d apps) built for 32bit are not supported by the default mangohud build. I adapted the script to build 2 mangohud versions, the default one (resulting in 64bit mangohud install) and a second one for 32bit.
Both work together nicely, I tested it by removing all mangohud from my install, then running the new script, then testing a modern game (wreckfest in my case) and an old one (WoW 3.3.5a private server ~2010 (32bit)). both work fine.

I am new to the project, so don't know about the .SRCINFO though

edit: just noticed .SRCINFO gets created automatically. neat.

@bright-side-99
Copy link
Contributor Author

ninja -j"${NCPU}" should not be necessary btw, as it should adapt according to available CPU cores automatically by default, see https://manpages.org/ninja "-j N run N jobs in parallel [default=derived from CPUs available] "

@bright-side-99 bright-side-99 changed the title support 32bit games via 2 builds + installs, one for mangohud default… mangohud support 32bit games via 2 builds + installs, one for mangohud default… Aug 17, 2024
@Elsie19
Copy link
Member

Elsie19 commented Aug 21, 2024

ninja -j"${NCPU}" should not be necessary btw, as it should adapt according to available CPU cores automatically by default, see manpages.org/ninja "-j N run N jobs in parallel [default=derived from CPUs available] "

Please keep it, because NCPU can be modified by the user if they wish.

@Elsie19
Copy link
Member

Elsie19 commented Aug 21, 2024

Fix the title to conform to our standards, as explained in our docs. You can also look at past PRs to get an idea of how to format the title if you're unsure.


You gotta play by the rules

@bright-side-99 bright-side-99 changed the title mangohud support 32bit games via 2 builds + installs, one for mangohud default… feat(mangohud): support 32bit apps Aug 22, 2024
@bright-side-99
Copy link
Contributor Author

bright-side-99 commented Aug 22, 2024

Fix the title to conform to our standards, as explained in our docs. You can also look at past PRs to get an idea of how to format the title if you're unsure.

found the "feat()" term used by other PRs, I'll use it for this PR, as it is not a version bump

@Xdavius
Copy link
Contributor

Xdavius commented Aug 22, 2024

Fix the title to conform to our standards, as explained in our docs. You can also look at past PRs to get an idea of how to format the title if you're unsure.

found the "feat()" term used by other PRs, I'll use it for this PR, as it is not a version bump

Thank you for your contribution.

Please, do a add(lib32-mangohud) PR with a new pacscript for this one is a better idea.

lib32-mangohud is very optional and users may want to install both separately.

Since split package functionality is not rewritten, we need to split with lib32- prefix.
You need also add pacdeps=("mangohud") for the new pacscript.

Regards.

@bright-side-99
Copy link
Contributor Author

I also thought about that. However I see the risk that one would not understand why mangohud is not working for certain games.

@Xdavius
Copy link
Contributor

Xdavius commented Aug 24, 2024

I also thought about that. However I see the risk that one would not understand why mangohud is not working for certain games.

After reflection, it's good for me.

@oklopfer oklopfer changed the title feat(mangohud): support 32bit apps fix(mangohud): support 32bit apps Aug 24, 2024
@oklopfer oklopfer added the Update Pacscript Updates to the pacscript itself label Aug 24, 2024
@bright-side-99
Copy link
Contributor Author

After reflection, it's good for me.

Just to avoid miscommunication, that means youre fine with the current state, right?

@Xdavius
Copy link
Contributor

Xdavius commented Aug 27, 2024

After reflection, it's good for me.

Just to avoid miscommunication, that means youre fine with the current state, right?

It's good to use the same pacscript for lib32. I already did once with wine-staging-git also and in this case you are right: it's better for users.

Look at the review I have made. Check your package to be sure it's all good. (pacstall -IBK and you have your previews in /tmp for source, build and package).

@bright-side-99
Copy link
Contributor Author

Look at the review I have made. Check your package to be sure it's all good. (pacstall -IBK and you have your previews in /tmp for source, build and package).

I do not see a review, am I missing something? Were you talking about the workflow checks?

Pushed another commit that helps specifying the build directories, don't know how it got missing

@bright-side-99
Copy link
Contributor Author

I also clicked on merge main, which caused the checks to be pending again, sry >.<

@bright-side-99
Copy link
Contributor Author

Is there anything else left to do? Or just wait until someone has time to merge it?

@Xdavius
Copy link
Contributor

Xdavius commented Sep 1, 2024

Is there anything else left to do? Or just wait until someone has time to merge it?

[1/2] Installing files.
Installing src/libMangoHud.so to /usr/src/pacstall/mangohud/usr/lib/x86_64-linux-gnu/mangohud
Installing src/libMangoHud_opengl.so to /usr/src/pacstall/mangohud/usr/lib/x86_64-linux-gnu/mangohud
Installing src/libMangoHud_dlsym.so to /usr/src/pacstall/mangohud/usr/lib/x86_64-linux-gnu/mangohud
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/data/mangohud.1 to /usr/src/pacstall/mangohud/usr/share/man/man1
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/build64/src/MangoHud.x86_64.json to /usr/src/pacstall/mangohud/usr/share/vulkan/implicit_layer.d
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/build64/src/mangohud to /usr/src/pacstall/mangohud/usr/bin
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/data/io.github.flightlessmango.mangohud.metainfo.xml to /usr/src/pacstall/mangohud/usr/share/metainfo
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/data/io.github.flightlessmango.mangohud.svg to /usr/src/pacstall/mangohud/usr/share/icons/hicolor/scalable/apps
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/data/MangoHud.conf to /usr/src/pacstall/mangohud/usr/share/doc/mangohud
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/data/presets.conf to /usr/src/pacstall/mangohud/usr/share/doc/mangohud
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/bin/mangoplot.py to /usr/src/pacstall/mangohud/usr/bin
ninja: Entering directory `build32'
[1/12] Generating version.h with a custom command
fatal : ni ceci ni aucun de ses répertoires parents (jusqu'au point de montage /tmp) n'est un dépôt git
Arrêt à la limite du système de fichiers (GIT_DISCOVERY_ACROSS_FILESYSTEM n'est pas défini).
[1/2] Installing files.
Installing src/libMangoHud.so to /usr/src/pacstall/mangohud/usr/lib/i386-linux-gnu/mangohud
Installing src/libMangoHud_opengl.so to /usr/src/pacstall/mangohud/usr/lib/i386-linux-gnu/mangohud
Installing src/libMangoHud_dlsym.so to /usr/src/pacstall/mangohud/usr/lib/i386-linux-gnu/mangohud
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/data/mangohud.1 to /usr/src/pacstall/mangohud/usr/share/man/man1
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/build32/src/MangoHud.x86.json to /usr/src/pacstall/mangohud/usr/share/vulkan/implicit_layer.d
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/build32/src/mangohud to /usr/src/pacstall/mangohud/usr/bin
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/data/io.github.flightlessmango.mangohud.metainfo.xml to /usr/src/pacstall/mangohud/usr/share/metainfo
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/data/io.github.flightlessmango.mangohud.svg to /usr/src/pacstall/mangohud/usr/share/icons/hicolor/scalable/apps
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/data/MangoHud.conf to /usr/src/pacstall/mangohud/usr/share/doc/mangohud
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/data/presets.conf to /usr/src/pacstall/mangohud/usr/share/doc/mangohud
Installing /tmp/pacstall/mangohud~0.7.2/MangoHud-0.7.2/bin/mangoplot.py to /usr/src/pacstall/mangohud/usr/bin

/usr/bin/mangohud build32 overwrite /usr/bin/build64

please fix this.

@Elsie19 Elsie19 added the blocked unable to be merged due to some issue label Sep 1, 2024
@bright-side-99
Copy link
Contributor Author

bright-side-99 commented Sep 8, 2024

/usr/bin/mangohud build32 overwrite /usr/bin/build64

please fix this.

okay I finally found the time to look into this.
I found that to not be a problem, /usr/bin/mangohud is not a binary, but a script, the contents of the two files that overwrite each other are the same.
It seems important that the lib files are in the correct directories.
The tree of the current script version is

andy@2204:~/Downloads$ pacstall -T mangohud
/usr
  │──lib
  │  │──i386-linux-gnu
  │  │  │──mangohud
  │  │  │  │──libMangoHud.so
  │  │  │  │──libMangoHud_dlsym.so
  │  │  │  │──libMangoHud_opengl.so
  │  │──x86_64-linux-gnu
  │  │  │──mangohud
  │  │  │  │──libMangoHud.so
  │  │  │  │──libMangoHud_dlsym.so
  │  │  │  │──libMangoHud_opengl.so
  │──bin
  │  │──mangoplot
  │  │──mangohud
  │──share
  │  │──icons
  │  │  │──hicolor
  │  │  │  │──scalable
  │  │  │  │  │──apps
  │  │  │  │  │  │──io.github.flightlessmango.mangohud.svg
  │  │──vulkan
  │  │  │──implicit_layer.d
  │  │  │  │──MangoHud.x86.json
  │  │  │  │──MangoHud.x86_64.json
  │  │──doc
  │  │  │──mangohud
  │  │  │  │──MangoHud.conf.example
  │  │  │  │──presets.conf.example
  │  │──metainfo
  │  │  │──io.github.flightlessmango.mangohud.metainfo.xml
  │  │──man
  │  │  │──man1
  │  │  │  │──mangohud.1

If we look at /usr/bin/mangohud, the script tries to resolve library paths like

MANGOHUD_LIB_NAME="/usr/lib/mangohud/\$LIB/libMangoHud_opengl.so"

if [ "$1" = "--dlsym" ]; then
    MANGOHUD_LIB_NAME="/usr/lib/mangohud/\$LIB/libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
    shift  # shift will only be executed if $1 is "--dlsym"
elif [ "$MANGOHUD_DLSYM" = "1" ]; then
    MANGOHUD_LIB_NAME="/usr/lib/mangohud/\$LIB/libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
fi

where $LIB is resolved by the dynamic linker which looks up like (ubuntu 22.04)

andy@2204:~/Downloads$ ldd /bin/ls
	linux-vdso.so.1 (0x00007ffe817a8000)
	libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x0000709b596d2000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000709b59400000)
	libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x0000709b5963b000)
	/lib64/ld-linux-x86-64.so.2 (0x0000709b59734000)
	
andy@2204:~/Downloads$ LD_TRACE_LOADED_OBJECTS=1 /bin/ls
	linux-vdso.so.1 (0x00007ffec7fa3000)
	libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x0000753b0a13a000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000753b09e00000)
	libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x0000753b0a0a3000)
	/lib64/ld-linux-x86-64.so.2 (0x0000753b0a178000)
	
andy@2204:~/Downloads$ 
cat /etc/ld.so.conf
cat /etc/ld.so.conf.d/*

include /etc/ld.so.conf.d/*.conf

/usr/lib/x86_64-linux-gnu/libfakeroot
# Multiarch support
/usr/local/lib/i386-linux-gnu
/lib/i386-linux-gnu
/usr/lib/i386-linux-gnu
/usr/local/lib/i686-linux-gnu
/lib/i686-linux-gnu
/usr/lib/i686-linux-gnu
# libc default configuration
/usr/local/lib
# Multiarch support
/usr/local/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
# Legacy biarch compatibility support
/lib32
/usr/lib32
# Legacy biarch compatibility support
/libx32
/usr/libx32

btw. the ./build.sh build script from the mangohud repo, does also overwrite the bin

andy@2204:~/Downloads/MangoHud$ ./build.sh build
Command: build 
ninja: Entering directory `build/meson64'
[56/57] Installing files.
Installing src/libMangoHud.so to /home/andy/Downloads/MangoHud/build/release/usr/lib/mangohud/lib64
Installing src/libMangoHud_opengl.so to /home/andy/Downloads/MangoHud/build/release/usr/lib/mangohud/lib64
Installing src/libMangoHud_dlsym.so to /home/andy/Downloads/MangoHud/build/release/usr/lib/mangohud/lib64
Installing /home/andy/Downloads/MangoHud/data/mangohud.1 to /home/andy/Downloads/MangoHud/build/release/usr/share/man/man1
Installing /home/andy/Downloads/MangoHud/build/meson64/src/MangoHud.x86_64.json to /home/andy/Downloads/MangoHud/build/release/usr/share/vulkan/implicit_layer.d
Installing /home/andy/Downloads/MangoHud/build/meson64/src/mangohud to /home/andy/Downloads/MangoHud/build/release/usr/bin
Installing /home/andy/Downloads/MangoHud/data/io.github.flightlessmango.mangohud.metainfo.xml to /home/andy/Downloads/MangoHud/build/release/usr/share/metainfo
Installing /home/andy/Downloads/MangoHud/data/io.github.flightlessmango.mangohud.svg to /home/andy/Downloads/MangoHud/build/release/usr/share/icons/hicolor/scalable/apps
Installing /home/andy/Downloads/MangoHud/data/MangoHud.conf to /home/andy/Downloads/MangoHud/build/release/usr/share/doc/mangohud
Installing /home/andy/Downloads/MangoHud/data/presets.conf to /home/andy/Downloads/MangoHud/build/release/usr/share/doc/mangohud
Installing /home/andy/Downloads/MangoHud/bin/mangoplot.py to /home/andy/Downloads/MangoHud/build/release/usr/bin
ninja: Entering directory `build/meson32'
[1/112] Generating src/overlay.frag.spv.h with a custom command
../../src/overlay.frag
[5/112] Generating src/overlay.vert.spv.h with a custom command
../../src/overlay.vert
[111/112] Installing files.
Installing src/libMangoHud.so to /home/andy/Downloads/MangoHud/build/release/usr/lib/mangohud/lib32
Installing src/libMangoHud_opengl.so to /home/andy/Downloads/MangoHud/build/release/usr/lib/mangohud/lib32
Installing src/libMangoHud_dlsym.so to /home/andy/Downloads/MangoHud/build/release/usr/lib/mangohud/lib32
Installing /home/andy/Downloads/MangoHud/data/mangohud.1 to /home/andy/Downloads/MangoHud/build/release/usr/share/man/man1
Installing /home/andy/Downloads/MangoHud/build/meson32/src/MangoHud.x86.json to /home/andy/Downloads/MangoHud/build/release/usr/share/vulkan/implicit_layer.d
Installing /home/andy/Downloads/MangoHud/build/meson32/src/mangohud to /home/andy/Downloads/MangoHud/build/release/usr/bin
Installing /home/andy/Downloads/MangoHud/data/io.github.flightlessmango.mangohud.metainfo.xml to /home/andy/Downloads/MangoHud/build/release/usr/share/metainfo
Installing /home/andy/Downloads/MangoHud/data/io.github.flightlessmango.mangohud.svg to /home/andy/Downloads/MangoHud/build/release/usr/share/icons/hicolor/scalable/apps
Installing /home/andy/Downloads/MangoHud/data/MangoHud.conf to /home/andy/Downloads/MangoHud/build/release/usr/share/doc/mangohud
Installing /home/andy/Downloads/MangoHud/data/presets.conf to /home/andy/Downloads/MangoHud/build/release/usr/share/doc/mangohud
Installing /home/andy/Downloads/MangoHud/bin/mangoplot.py to /home/andy/Downloads/MangoHud/build/release/usr/bin

I think this is fine 🤔
keep in mind, I am new to packaging and this stuff, while I read a lot the last days, I can't say I'm 100% sure.
Though I think regarding what the pacstall script does, it is now quite similar to what mangohud builds are doing

@Xdavius
Copy link
Contributor

Xdavius commented Sep 8, 2024

@bright-side-99 yes. I need to test in game.
In most cases in dual architecture, you have to delete /bin /share and license because they conflicts.

In this case it's seems to work. And it's the build method in the mangohud.

Can you add theses lines to the pacscript please :

arch=("amd64")
provides=("mangohud:i386")

Because it's a crossbuild package, his architecture have to be fixed. And his i386 package have to be provided.

Still making tests these days on multilib packages and reported some issues (reported on main pacstall project). I suggest you to have a look on them if you are curious. I'm still investigating and searching solutions/alternatives.

Multilib on Debian/Ubuntu is creepy and very different than archlinux.

@bright-side-99
Copy link
Contributor Author

@bright-side-99 yes. I need to test in game. In most cases in dual architecture, you have to delete /bin /share and license because they conflicts.

Can you add theses lines to the pacscript please :

arch=("amd64")
provides=("mangohud:i386")

sure. done.

Multilib on Debian/Ubuntu is creepy and very different than archlinux.
image

@Xdavius
Copy link
Contributor

Xdavius commented Sep 10, 2024

@vigress8 Good to merge

@vigress8
Copy link
Collaborator

What is this issue on develop about?

@oklopfer
Copy link
Member

What is this issue on develop about?

Extinguished

@vigress8 vigress8 merged commit f6d8854 into pacstall:master Sep 13, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked unable to be merged due to some issue Update Pacscript Updates to the pacscript itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants