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 qtPrepareTool function #118904
Fix qtPrepareTool function #118904
Conversation
Confirmed that this fails to find |
173f0cb
to
5522611
Compare
I think I fixed it, will rerun some test builds on my darwin system later today. EDIT: Been awhile but IIRC |
5522611
to
108fb20
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran most of a review, didn't see many failures specific to qt.
Likely missed somethign with all the staging noise.
Motivation for this change
Fixes #76080. Extracted from #108366.
What this fixes / Why this is needed
Loading qtbase's
qt_module
qmake feature in a project withgit_build
set (either manually set or when.git
is present) will use theqtPrepareTool
function to find Qt'ssyncqt.pl
tool. This function, in its upstream implementation, uses the$$[QT_HOST_BINS]
variable to reference the<qt-installation>/bin
directory with all of Qt's modules installed, appends the requested tool name to it ($${2}
) and checks for some variations of this path (.pl
,.exe
,.app/Contents/MacOS/$${2}
), falling back to just the initial concatenation.The current patch only replaces this concatenation (
$$[QT_HOST_BINS]/$$2
) with acommand -v $${2}
invocation (because we don't keep all tool binaries/scripts in the same directory), leaving the following extension-handling code unchanged. This functions fine for binary tools without any further file extension or path variation (likemoc
), but fails onsyncqt.pl
(empty response fromcommand -v syncqt
+.pl
) and falls back to an empty string. This is an unexpected result for the rest of the feature code, which appends arguments to the result and tries to invoke the tool. Hence you may get:instead of:
Or sometimes you may get no indication of any missing tool invocation at all, followed by missing header errors because the tool that would've generated them wasn't executed.
This PR fixes the patch.
command -v $${2}
. If a match for the tool name is found, we exit the finding code with its full path as the command.command -v $${2}.pl
. If a match is found thenperl -w ${/path/to/tool.pl}
is used as the command.(I'm unsure if it would make sense to insert a known-bad command if no match was found. Sometimes
qtPrepareTool
seems to get used to check if an optional tool likeqdoc
exists, which always fails and doesn't seem to cause any problems?)To test, try building
qtsvg
(looks formoc
binary tool, sanity check) andqtwebengine
(looks forsyncqt
Perl tool, I've removed the workaround that was added in #116724)With this fix:
Without the fix and without the workaround script (copied from the linked PR, haven't had the time to fully compile qtwebengine yet):
Things done
sandbox
innix.conf
on non-NixOS linux)(Only
qtbase
, someqtModule
s and afew minutes ofqtwebengine
)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)