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

mangohud: init at 0.4.1 #95225

Merged
merged 1 commit into from May 1, 2021
Merged

mangohud: init at 0.4.1 #95225

merged 1 commit into from May 1, 2021

Conversation

zeratax
Copy link
Contributor

@zeratax zeratax commented Aug 12, 2020

Motivation for this change

closes #84686

Things done

I tested this with several OpenGL and Vulkan 32/64 bit games.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Questions

This is currently a little hackish with the combined.nix file, since to use mangohud with 32bit application like a lot of games still are we also need to compile a 32bit version.
but if I just try to build the default.nix file with:

nix-env -f . -iA mangohud
nix-env -f . -iA mangohud --argstr system i686-linux

The second derivation fails with:

error: packages '/nix/store/98anspysbisprqmzr2rwsm9dvgkxzz2z-mangohud-0.4.1/share/vulkan/registry/cgenerator.py' and '/nix/store/hg7vqhxy0kb2kdxm6rrncajb036mjg15-vulkan-headers-1.2.131.1/share/vulkan/registry/cgenerator.py' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' to change the priority of one of the conflicting packages (0 being the highest priority)

The combined.nix now installs both versions next to each other.

I am also not using the exact 0.4.1 version, but am a few commits ahead to fix flightlessmango/MangoHud#231 and also flightlessmango/MangoHud@acf2d88

Or should I include all extra commits with the patches option?

Edit: resolved with zeratax#1

Copy link
Contributor

@kira-bruneau kira-bruneau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this @zeratax!

pkgs/tools/graphics/mangohud/default.nix Outdated Show resolved Hide resolved
@kira-bruneau
Copy link
Contributor

There may be a better approach that I don't know about for combining the two builds, but this seems to work. I've also seen other projects use a later rev to get the build working, so I think it should be fine here.

I noticed that you had Tested using sandboxing and Tested execution of all binary files unchecked. Is this correct? It sounds like you may have already completed those.

@zeratax
Copy link
Contributor Author

zeratax commented Aug 16, 2020

@MetaDark right yes that was incorrect and I now checked those boxes. I also have a nur package here that seems to build fine: https://travis-ci.com/github/ZerataX/nur-packages
https://github.com/ZerataX/nur-packages/blob/master/default.nix#L19

Copy link
Member

@Atemu Atemu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Result of nixpkgs-review pr 95225 1

1 package built:
- mangohud

When I try to run something with it I get a bunch of

MANGOHUD: Failed to open 64bit libnvidia-ml.so.1: libnvidia-ml.so.1: cannot open shared object file: No such file or directory
MANGOHUD: Failed to open 64bit libXNVCtrl.so.0: libXNVCtrl.so.0: cannot open shared object file: No such file or directory

though and it doesn't work :/

pkgs/tools/graphics/mangohud/default.nix Outdated Show resolved Hide resolved
@zeratax
Copy link
Contributor Author

zeratax commented Aug 17, 2020

@Atemu so I imagine you are using an nvidia gpu? also would love to know what you tried to run with it? easiest to test is imo vkcube which comes with vulkan-tools. 32bit applications in this version of mangohud require to be run with mangohud.x86

@Atemu
Copy link
Member

Atemu commented Aug 17, 2020

Yes it's an nvidia GPU, sorry should've mentioned that.

I tried Guild Wars 2 but these messages even appear when I try to run bash. Same story with vkcube.

Copy link
Member

@Atemu Atemu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha! Got it to work. A nix-shell isn't enough, mangohud needs to be in your user env.

The missing library messages still show up weirdly but that's a cosmetic issue we can fix later.

Copy link
Member

@Atemu Atemu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/294

@zeratax
Copy link
Contributor Author

zeratax commented Nov 26, 2020

I was wondering what the current status of this is? Do I just need to rebase this so the commit looks properly (not quite sure how I would go about doing that honestly) or do we wait for #101597 and go for a current release of mangohud?

@Atemu
Copy link
Member

Atemu commented Nov 27, 2020

You should rebase on top of master or unstable and then squash the remaining two commits.

I'd be in favour of merging this as-is and not trying to perfect it by packaging the newest version.
Fixing the bug in our ld.so that prevents the upgrade is way outside this PR's scope I think and will probably require a core maintainer to have a look at. Given how busy they are with more important things than an obscure feature of a core library which 2/70000 packages would need, I wouldn't count on that happening anytime soon.
Same goes for @MetaDark's #92401.

We could try would be to patch the new Mangohud to use the v4 loader again that we did manage to get working here but I think that should happen in a separate PR.

@legendofmiracles
Copy link
Contributor

Will you pick this up again @zeratax?

@zeratax
Copy link
Contributor Author

zeratax commented Apr 23, 2021

hmm not sure how to squash that merge and my commit properly

Edit: wow I did it!


stdenv.mkDerivation rec {
pname = "mangohud${lib.optionalString stdenv.is32bit "_32"}";
version = "0.4.1";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newest version is 0.6.1
And rename the commit, if you change the version

Tried it locally, if I manually push the version, the patch doesn't apply.

Copy link
Member

@Atemu Atemu Apr 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Versions newer than v4 won't work in Nixpkgs, see #95225 (comment) #101597

@legendofmiracles
Copy link
Contributor

legendofmiracles commented Apr 25, 2021

Edit: wow I did it!

Nice!
Feel free to add me as a maintainer once you're done

@legendofmiracles
Copy link
Contributor

Result of nixpkgs-review pr 95225 run on x86_64-linux 1

1 package failed to build:
  • mangohud

@legendofmiracles
Copy link
Contributor

Well, this is awkward, running the nix-review command again worked flawlessly

@legendofmiracles
Copy link
Contributor

Result of nixpkgs-review pr 95225 run on x86_64-linux 1

1 package built:
  • mangohud

@davidak
Copy link
Member

davidak commented Apr 26, 2021

Result of nixpkgs-review pr 95225 run on x86_64-linux 1

1 package built:
  • mangohud

@davidak
Copy link
Member

davidak commented Apr 26, 2021

Tested using glxgears from mesa-demos.

[nix-shell:~/.cache/nixpkgs-review/pr-95225]$ mangohud glxgears
ERROR: ld.so: object 'libMangoHud.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
MANGOHUD: Failed to open 64bit libnvidia-ml.so.1: libnvidia-ml.so.1: cannot open shared object file: No such file or directory
MANGOHUD: Failed to open 64bit libXNVCtrl.so.0: libXNVCtrl.so.0: cannot open shared object file: No such file or directory
MANGOHUD: Failed to open 64bit libX11.so.6: libX11.so.6: cannot open shared object file: No such file or directory
MANGOHUD: Failed to open 64bit libnvidia-ml.so.1: libnvidia-ml.so.1: cannot open shared object file: No such file or directory
MANGOHUD: Failed to open 64bit libXNVCtrl.so.0: libXNVCtrl.so.0: cannot open shared object file: No such file or directory
skipping config: /nix/store/5bx1vwh2v9dxbz5dss3mllrx6q5b7l0n-mesa-demos-8.4.0/bin/MangoHud.conf [ not found ]
skipping config: /home/davidak/.config/MangoHud/glxgears.conf [ not found ]
skipping config: /home/davidak/.config/MangoHud/MangoHud.conf [ not found ]
MANGOHUD: can't find file pci.ids
Version: 4.6 
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
329 frames in 5.0 seconds = 65.647 FPS
300 frames in 5.0 seconds = 59.890 FPS
...

Screenshot from 2021-04-26 18-43-27

Then installed it and tested in Steam by adding mangohud %command% to CS:GO launch options.

[nix-shell:~/.cache/nixpkgs-review/pr-95225]$ nix-env -f nixpkgs/ -i mangohud

That does also work.

Also tested with Half-Life 1 (32-bit).

@kira-bruneau
Copy link
Contributor

kira-bruneau commented Apr 30, 2021

It looks like the latest version is now 0.6.1, so it would probably be best to update it here.

@zeratax
Copy link
Contributor Author

zeratax commented May 1, 2021

It looks like the latest version is now 0.6.1, so it would probably be best to update it here.

yeah we decided to do this in a different pr #95225 (comment)

Copy link
Contributor

@kira-bruneau kira-bruneau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah we decided to do this in a different pr #95225 (comment)

Oh right thanks, I forgot about that 😅. This looks good to me then, thanks @zeratax!

@davidak davidak merged commit 20935f3 into NixOS:master May 1, 2021
@zeratax zeratax deleted the mangohud branch May 1, 2021 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build failure on Musl: type of 'readlink' is unknown MangoHud
9 participants