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

[qt5-base] fix building with mac dynamic triplet #32500

Merged
merged 4 commits into from
Jul 14, 2023

Conversation

jpfeuffer
Copy link
Contributor

@jpfeuffer jpfeuffer commented Jul 11, 2023

fixes #32497

  • Changes comply with the maintainer guide
  • SHA512s are updated for each updated download
  • The "supports" clause reflects platforms that may be fixed by this new version
  • Any fixed CI baseline entries are removed from that file.
  • Any patches that are no longer applied are deleted from the port's directory.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is added to each modified port's versions file.

@Adela0814
Copy link
Contributor

Adela0814 commented Jul 11, 2023

Please update port version.

Note: I will be converting your PR to draft status. When you respond, please revert to "ready for review". That way, I can be aware that you've responded since you can't modify the tags.

@Adela0814 Adela0814 marked this pull request as draft July 11, 2023 08:41
@Adela0814 Adela0814 changed the title fix dynamic qt in debug macos [qt5-base]fix dynamic qt in debug macos Jul 11, 2023
@@ -289,6 +289,7 @@ elseif(VCPKG_TARGET_IS_LINUX)
list(APPEND DEBUG_OPTIONS "PSQL_LIBS=${PSQL_DEBUG} ${PSQL_PORT_DEBUG} ${PSQL_TYPES_DEBUG} ${PSQL_COMMON_DEBUG} ${SSL_DEBUG} ${EAY_DEBUG} -ldl -lpthread")
endif()
elseif(VCPKG_TARGET_IS_OSX)
list(APPEND DEBUG_OPTIONS -no-framework)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this option needed at all? In vcpkg CI, I didn't see any frameworks installed.
Why is this option only needed for DEBUG_OPTIONS?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See the linked issue. Qt does not support frameworks for debug.
And frameworks are the default when using the dynamic triplet.
I could add an "if dynamic".

Copy link
Contributor

Choose a reason for hiding this comment

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

And frameworks are the default when using the dynamic triplet.

So this is the difference to vcpkg CI.
Frameworks aren't desired in vcpkg, so the parameter should simply go to the common options for osx, not just debug.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool! No problem. Will do. Found some rpath problems, too, that I already fixed locally.

@Adela0814 Adela0814 added the category:port-bug The issue is with a library, which is something the port should already support label Jul 12, 2023
@jpfeuffer jpfeuffer marked this pull request as ready for review July 12, 2023 11:06
@jpfeuffer jpfeuffer changed the title [qt5-base]fix dynamic qt in debug macos [qt5-base] fix building with mac dynamic triplet Jul 12, 2023
@Adela0814 Adela0814 added the info:reviewed Pull Request changes follow basic guidelines label Jul 13, 2023
# Avoid frameworks for vcpkg
list(APPEND CORE_OPTIONS -no-framework)
# Such that Qt executables like moc find their libs. The default path is ../Frameworks
list(APPEND DEBUG_OPTIONS -R ${CURRENT_INSTALLED_DIR}/debug/lib)
Copy link
Member

Choose a reason for hiding this comment

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

This seems like it will embed an absolute path which is bad?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, but I cannot get it to work with relative paths.
Happy to try something though if you have an idea. All combinations of "@executable_path/../lib" are completely ignored by their build system. Not sure if the @ needs to be escaped somehow.. no idea..

However, I still think it's an improvement.
I think the only problem is that the vcpkg folder would not be relocatable for the Qt binaries under these very specific circumstances. Potentially users can even fix this themselves after relocating.
Better than not being able to build at all.

Copy link
Member

Choose a reason for hiding this comment

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

the vcpkg folder would not be relocatable for the Qt binaries under these very specific circumstances.

It isn't "very specific circumstances", it is "all binary cache hits".

Moreover, in general customers expect to be able to deploy what comes out of a build with their application, which is almost never going to be "identical to a vcpkg installation tree in the build lab" in terms of location.

If it won't work with their build system I think you need to fix it to work with patchelf or similar.

Copy link
Member

Choose a reason for hiding this comment

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

Upon further reflection, this is bad, but it's no worse than the status quo (that being "totally broken") so I'm weakly in favor of merging it. Going to ask other maintainers.

Copy link
Contributor

@dg0yt dg0yt Jul 13, 2023

Choose a reason for hiding this comment

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

For the installed tree, there is #32200.

Copy link
Member

Choose a reason for hiding this comment

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

For the installed tree, there is #32200.

Would this change be needed in addition to that or does that obsolete this?

Copy link
Contributor Author

@jpfeuffer jpfeuffer Jul 13, 2023

Choose a reason for hiding this comment

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

So, I actually found a way to include relative RPaths. The problem is now:
Qt tries to run/test/use its /Users/jpfeuffer/.clion-vcpkg/vcpkg/buildtrees/qt5-base/x64-osx-dynamic-dbg/bin/moc binary during the build.
But the libs its looking for are already installed in /Users/jpfeuffer/build/vcpkg_installed/x64-osx-dynamic/debug/lib/libbz2d.dylib. Apparently, the loading needs work during the build process already since the binary is used or tested there. I probably can include both paths during build, since I don't know yet how to differentiate between build and install rpaths with qmake.

Copy link
Contributor

Choose a reason for hiding this comment

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

For the installed tree, there is #32200.

Would this change be needed in addition to that or does that obsolete this?

In addition. That PR is only for the installed tree, but here fixes are needed already during the build AFAIU.

Copy link
Member

Choose a reason for hiding this comment

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

OK, we'll merge on the grounds that everything with osx-dynamic is toast (and we shouldn't have even added that as a community triplet) and this just brings up to parity with everything else there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see that it can be a lot of work but it was very helpful for us.

We want to use vcpkg also for deployment, including all dependencies and there are so many problems with static libraries:

  • first of all Qt's LGPL license which requires additional steps to fulfill it when linking statically
  • then the size of the executables
  • and more minor caveats in CMake and the code itself to correctly handle transitive dependencies in a complex project

I'm just hoping it won't get removed ;)
Thanks for the help.

@Adela0814 Adela0814 removed the info:reviewed Pull Request changes follow basic guidelines label Jul 14, 2023
@BillyONeal BillyONeal merged commit ca4640a into microsoft:master Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[qt5-base] Build error
4 participants