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

Use qt5's mkDerivation in packages that otherwise crash #84673

Merged
merged 32 commits into from Apr 22, 2020

Conversation

mmilata
Copy link
Member

@mmilata mmilata commented Apr 7, 2020

This attempts to fix several Qt applications that crash on startup with:

qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

A crude script was used to find packages that:

  • are called with libsForQt5.callPackage from top-level/all-packages.nix, and
  • use stdenv.mkDerivation, but
  • are not marked as broken nor do they refer to wrapQtAppsHook, and
  • have binaries that crash with the message above.

This was followed with manual steps:

  • Modify package file to use mkDerivation from argument list instead of stdenv, and
  • build the package and check that some sort of window appears.
Motivation for this change

#65399

Things done
  • 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/)
  • Ensured that relevant documentation is up to date
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

Result of nixpkgs-review pr 84673 1

3 package marked as broken and skipped:
  • bonfire
  • swiften
  • swiftformat
34 package built:
  • aqemu
  • awesomebump
  • bibletime
  • bomi
  • calaos_installer
  • candle
  • caneda
  • colord-kde
  • dfasma
  • enyo-doom
  • firebird-emu
  • glogg
  • httraqt
  • iannix
  • ipe
  • kdeApplications.okteta
  • luckybackup
  • mindforger
  • mpc-qt
  • openbrf
  • phototonic
  • pro-office-calculator
  • qcomicbook
  • qmediathekview
  • qstopmotion
  • qt-box-editor
  • ricochet
  • rocket
  • swift-im
  • tensor
  • traverso
  • valentina
  • write_stylus
  • yabause

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/please-fix-all-packages-which-were-broken-by-the-qt-wrapping-changes/6444/28

@worldofpeace worldofpeace modified the milestones: 20.03, 20.09 Apr 7, 2020
@worldofpeace worldofpeace added the 9.needs: port to stable A PR needs a backport to the stable release. label Apr 7, 2020
pkgs/applications/graphics/awesomebump/default.nix Outdated Show resolved Hide resolved
pkgs/tools/misc/colord-kde/default.nix Outdated Show resolved Hide resolved
@mmilata
Copy link
Member Author

mmilata commented Apr 13, 2020

@das-g thank you for your attention! I've dropped stdenv from the arguments - looks better to me, not sure what's the right thing here, if there is such thing.

Copy link
Member

@das-g das-g left a comment

Choose a reason for hiding this comment

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

👍 Change LGTM
👍 Commits LGTM

Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

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

bomi does a conditional wrapProgram which will prevent it from being wrapped.
And that's because wrapQtAppsHook only wraps ELF, so it won't double wrap a script.

Other packages that have this problem are:

  • ipe
  • awesomebump

@worldofpeace
Copy link
Contributor

The part around here in the manual should be useful to you https://nixos.org/nixpkgs/manual/#qt-default-nix-co-3

@mmilata
Copy link
Member Author

mmilata commented Apr 14, 2020

@worldofpeace good point! In all three cases the hook ended up wrapping the .foo-wrapped binary so things worked out somewhat fine. Nevertheless having multiple levels of wrappers is ugly so I added dontWrapQtApps = true;, changed the wrapping function to the qt one and removed makeWrapper from nativeBuildInputs since it was no longer needed.

bomi remains broken though, as documented in #57532

Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

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

This LGTM. But there's no way I could even test this manually. Perhaps our other reviewer did this.

@das-g
Copy link
Member

das-g commented Apr 14, 2020

But there's no way I could even test this manually. Perhaps our other reviewer did this.

Me? I didn't test anything, I only looked at the diff and commit messages. I could run nixpkgs-review pr if that helps, but I guess whether stuff builds can also be tested by @GrahamcOfBorg, can't it?

The functionality of the build results I can't really test either, as I don't know the packaged applications. Maybe ping the respective package maintainers?

@jtojnar
Copy link
Contributor

jtojnar commented Apr 22, 2020

I still think Qt's mkDerivation does more harm than good and should not have been introduced. Adding the dependencies (and wrapQtAppsHook for programs) should be sufficient. (There is also one minor improvement in debug flag handling but it does not outweigh the loss of compositionality. We should finish #71089 to get the debug flag handling to other qt setup hooks.)

@worldofpeace
Copy link
Contributor

@jtojnar I personally don't see much benefit in telling people to commit to something that isn't a committed practice, when it's mentioned in detail in our official documentation.
For what it's worth, I think any user of these commits would appreciate them committed right away.

@mmilata Can you rebase?

@mmilata
Copy link
Member Author

mmilata commented Apr 22, 2020

@worldofpeace rebased

@worldofpeace worldofpeace merged commit b4d5dd8 into NixOS:master Apr 22, 2020
@worldofpeace
Copy link
Contributor

I've backported this to 20.03, but I've yet to do it for 19.09 because there's conflicts.

@mmilata
Copy link
Member Author

mmilata commented Apr 22, 2020

Did the 19.09 in #85805 - gonna try building it now.

@mmilata mmilata deleted the qt5-mkDerivation-stdenv branch April 22, 2020 19:43
@jtojnar
Copy link
Contributor

jtojnar commented Apr 22, 2020

Just to have it on the record, copying my rant from IRC:

the fact that qt's mkDerivation should be removed was acknowledged by Thomas
since it does not bring almost any benefits compared to wrapQtAppsHook I see no reason to continue using it, especially if it is to be deprecated
the fact that documentation promotes it is unfortunate but it is a documentation bug that can be rectified

but since you already did the work and we do not want to make you redo it, I agreed with merging this for now:

I guess we can merge it now and then do a removing sprint

@worldofpeace
Copy link
Contributor

Yep, thank you so much @mmilata for taking initiative to get these last fixes, I know people will appreciate it.

@mmilata
Copy link
Member Author

mmilata commented Apr 22, 2020

No need to merge this just to not upset me, I'm not too invested, just wanted to see if it's possible to fix some of the broken packages using a simple script:)

Anyway, #85805 built for me - had to drop bibletime and write_stylus since they'd require backporting more commits which is probably out of scope. Also luckybackup was added after 19.09 was forked and according to git log it probably never worked??

@deviant deviant mentioned this pull request Aug 24, 2020
10 tasks
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.

None yet

5 participants