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

Workaround for iOS. #1775

Merged
merged 4 commits into from
Jan 17, 2025
Merged

Conversation

JamesMBallard
Copy link
Contributor

Description

We need to manually link and deliver ffmpeg libraries bundled with Qt whenever multimedia capabilities are required on iOS. This is needed until https://bugreports.qt.io/browse/QTBUG-129651 is solved.

Type of change

  • Bug fix
  • New sample implementation
  • Sample viewer enhancement
  • Other enhancement

Platforms tested on:

  • Windows
  • Android
  • Linux
  • macOS
  • iOS

@JamesMBallard JamesMBallard self-assigned this Jan 14, 2025
@JamesMBallard
Copy link
Contributor Author

This will need to be held until the builds are up to 6.8.1 officially. I can put a version ifdef, but that is only useful for a short amount of time. Let me know if that is preferred.

@@ -37,7 +37,7 @@ exists($$PWD/../../../DevBuildCpp.pri) {
# use the Esri dev build script
include ($$PWD/../../../DevBuildCpp.pri)
# include the toolkitcpp.pri, which contains all the toolkit resources
include($$PWD/../../toolkit/uitools/toolkitcpp.pri)
include($$PWD/../../toolkit/uitools/toolkitcpp/toolkitcpp.pri)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This avoids a toolkit warning. This file was recently moved into uitools/toolkitcpp. There is still a uitools/toolkitcpp.pri, but it logs a warning and says to use the new file directly.

FYI @GuillaumeBelz

With command line builds, we need to find the lib directly the hard way.
It's actually qmake in the macOS dir, and then the build
might be using either qmake or qmake6.
@@ -62,7 +62,9 @@ ios {
# and ffmpeg frameworks have embedded '@rpath/Frameworks' path.
# so in order for them to be found, we need to add @executable_path to the
# search path.
QMAKE_LFLAGS += -F$$(QTDIR)/lib/ffmpeg -Wl,-rpath,@executable_path
FFMPEG_LIB_DIR = $$absolute_path($$replace(QMAKE_QMAKE, "qmake6", "../../ios/lib/ffmpeg"))
Copy link
Collaborator

@bri12415 bri12415 Jan 14, 2025

Choose a reason for hiding this comment

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

So we grab the qmake absolute path with QMAKE_QMAKE and use that to source the location of the ffmpeg binaries?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. It's not great, but I can't find any non-hacky qmake way to locate the Qt kit's lib dir. QTDIR is the obvious one, but that's only set with Qt Creator. Christian is testing in CI now and it fails, so we can't use that.

It gets pretty ugly, because qmake for iOS is just a script that points to macOS's qmake binary. Then users could be using either qmake or qmake6 so we don't know which one to replace, so we have to handle both.

Copy link
Collaborator

@chri7325 chri7325 left a comment

Choose a reason for hiding this comment

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

Works on CI builds!

@GuillaumeBelz
Copy link
Contributor

GuillaumeBelz commented Jan 15, 2025

Some warnings on my machine (debug build). The build is fine, it's just warnings.

2025-01-14 18:35:00.669 xcodebuild[84584:4390756] warning:  The file reference for "Qt/6.8.1/ios/lib/ffmpeg/libavcodec.framework" is a member of multiple groups ("Bundle Data" and "Bundle Data"); this indicates a malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the same path.
2025-01-14 18:35:00.669 xcodebuild[84584:4390756] warning:  The file reference for "Qt/6.8.1/ios/lib/ffmpeg/libavformat.framework" is a member of multiple groups ("Bundle Data" and "Bundle Data"); this indicates a malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the same path.
2025-01-14 18:35:00.669 xcodebuild[84584:4390756] warning:  The file reference for "Qt/6.8.1/ios/lib/ffmpeg/libavutil.framework" is a member of multiple groups ("Bundle Data" and "Bundle Data"); this indicates a malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the same path.
2025-01-14 18:35:00.669 xcodebuild[84584:4390756] warning:  The file reference for "Qt/6.8.1/ios/lib/ffmpeg/libswresample.framework" is a member of multiple groups ("Bundle Data" and "Bundle Data"); this indicates a malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the same path.
2025-01-14 18:35:00.669 xcodebuild[84584:4390756] warning:  The file reference for "Qt/6.8.1/ios/lib/ffmpeg/libswscale.framework" is a member of multiple groups ("Bundle Data" and "Bundle Data"); this indicates a malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the same path.

We have our own version of this workaround for all
internal iOS builds.
@JamesMBallard
Copy link
Contributor Author

I conditionalized the fix so it won't be applied for internal Esri build, as we have the same workaround in our global dev .pri file for iOS.

@JamesMBallard JamesMBallard merged commit 22be253 into v.next Jan 17, 2025
@JamesMBallard JamesMBallard deleted the james/qt6.8.1_ffmpeg_ios_workaround branch January 17, 2025 21:39
GuillaumeBelz added a commit that referenced this pull request Jan 23, 2025
* v.next: (28 commits)
  Bump up the minimum versions. (#1778)
  Fix deprecated Qt API usages. (#1777)
  Workaround for iOS. (#1775)
  unused (#1776)
  snap geometry sample fixes (#1773)
  Update README.metadata.json (#1772)
  jared/200.7.0 (#1770)
  Split apart connection logic from permission requests logic (#1764)
  Bluetooth requirement is mobile only for indoors. (#1765)
  Sample viewer and the indoors sample must specify bluetooth manually now. (#1763)
  Bri12415/5917 android context (#1762)
  Update README to include haptics (#1761)
  Fix find place sample (#1758)
  Change all references of `DisplayGrid` to `ShowGrid` (#1759)
  Tan11389/scene grid app update (#1754)
  Fix ifdef condition (#1757)
  Update samples to request permissions (#1753)
  These paths have changed. (#1755)
  Update snap geometry edits sample (#1752)
  Use 200.6 ENC data. (#1751)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants