-
-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
qt5: cmake find_package(Qt5Core) doesn't work when linked to /usr/local #8392
Comments
Great work here.
We should definitely submit this upstream; we don't like having any patches that we haven't at least tried to submit upstream. Could you do that and create a PR linking to the upstream patch submission? @steveire may have thoughts/help here. |
I don't see why not if it doesn't break anything else. |
This is Homebrew/legacy-homebrew#29938 btw, and you can hit similar issues with any package which installs cmake config files and references paths which are not part of your symlink system. The upstream Qt files should keep relative paths, so you will have to do patching on the homebrew side to make them absolute. |
why? |
The upstream Qt binary distribution installer asks the user to specify an install location. The installation infrastructure should not have to rewrite those files for example. Relative paths allow avoiding a host of issues like that. |
Well that's a bit of a mess, then, because we're not going to want to patch it forever. So permanent keg_only status sounds likely since a top level |
The |
Aren't we going to have this same problem with the other Qt-specific folders installed directly into the prefix?
|
Of the rest, the cmake config files additionally look for content in the I could imagine the files potentially looking for |
Yeah, that's not good if it was previously working properly when Immediately, it seems like we have a few choices:
|
@steveire Unlike other package managers we like to get our patches upstream rather than keep them around indefinitely. Would it be possible for us to get something upstream that does uses a |
@steveire If that patch should be in CMake itself we could consider that too. |
Have opened #8408 as a temporary workaround. |
@steveire thanks for the pointer to Homebrew/legacy-homebrew#29938 I noticed there was a cmake bug filed, but it doesn't look like it has seen any action: |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Closing this since we have an effective workaround in #8408 but we'd look at a PR with a better fix if it's been upstreamed. |
For downstream users: if(APPLE AND EXISTS /usr/local/opt/qt5)
# Homebrew installs Qt5 (up to at least 5.9.1) in
# /usr/local/qt5, ensure it can be found by CMake since
# it is not in the default /usr/local prefix.
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
endif() |
When Qt5 is installed using Homebrew on macOS, Qt5 is not available in the default prefix. Remove the hack from macos-setup-brew.sh and adjust the search path instead. Note that is needed for development, "brew install" has already set this option in the environment. See Homebrew/homebrew-core#8392 Change-Id: I57ea09b649a94c9a4cb18b1b2d334808e47ec27e Reviewed-on: https://code.wireshark.org/review/23232 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This helps for homebrew users who try to `find_package(Qt5Core)` but can't find the mkspecs folder in `/usr/local` Homebrew/homebrew-core#8392
I just submitted a variant of my patch upstream in qt/qtbase#15 and am asking if they can expose a build option that we could invoke from the qt build formula to use absolute paths instead of relative paths. Fingers crossed... |
Please follow the general troubleshooting steps first:
brew update
and retried your prior step?brew doctor
, fixed as many issues as possible and retried your prior step?Bug reports:
I have a 3rd-party package that uses cmake to find qt5 with a
find_package(Qt5Core)
call. Thefind_package
call works if theCMAKE_PREFIX_PATH
is set to/usr/local/opt/qt5
but fails ifCMAKE_PREFIX_PATH
is set to/usr/local
with the following console output:The following is a sufficient
CMakeLists.txt
to reproduce the issue:I only noticed this recently since
qt5
was promoted fromkeg_only
. I investigated the error messages, and noticed thatqt5
has amkspecs
folder in its Cellar that is not linked into/usr/local/mkspecs
. This causes a problem with thefind_package
call since it tries to find themkspecs
folder relative to where the cmake config file is found, but that folder isn't in/usr/local/mkspecs
.I expect that we won't be linking the
mkspecs
folder to/usr/local
any time soon. As an alternative, I have a patch for qt5 that forces the cmake config files to use an absolute path to themkspecs
folder:I don't expect this patch would be accepted upstream, since the problem comes from brew's linking to
/usr/local
. Should I submit a pull request to add the patch to theqt5
formula?The text was updated successfully, but these errors were encountered: