jamulus icon indicating copy to clipboard operation
jamulus copied to clipboard

Build: iOS: Use Qt6 and bump build environment

Open ann0see opened this issue 2 years ago • 21 comments

Adds a Crash-fix by @danryu for a new ios Qt 6 build. Unfortunately, Qt6 makes the app basically unusable on small devices. This should be fixed after this PR got in: Qt6 breaks iOS connect dialog

Short description of changes

Updates iOS to use Qt6 (coded by @hoffie)

CHANGELOG: Update iOS build to use Qt6. For now, only larger devices are usable. Please compile with Qt5 if you use small devices.

Context: Fixes an issue?

Fixes: #2711 Fixes: #2939

Does this change need documentation? What needs to be documented and how?

Status of this Pull Request Ready for review

What is missing until this pull request can be merged?

Nothing. However, a follow up for the GUI fix (?) should come in after the merge of this.

Checklist

  • [x] I've verified that this Pull Request follows the general code principles
  • [x] I tested my code and it does what I want
  • [x] My code follows the style guide
  • [x] I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • [x] I've filled all the content above

ann0see avatar May 11 '23 20:05 ann0see

@ngocdh as you initially fixed the iOS GUI (I think), do you have any insights on what could be the issue with Qt 6?

ann0see avatar May 11 '23 20:05 ann0see

@ngocdh as you initially fixed the iOS GUI (I think), do you have any insights on what could be the issue with Qt 6?

Hi @ann0see I only worked on iOS audio code and maybe some UI related issues but not iOS related if I recall correctly. I did try to fix some mobile UI issues, but not knowing Qt, I made it even worse so eventually gave up.

ngocdh avatar May 11 '23 22:05 ngocdh

Ok. Then someone else fixed them.

ann0see avatar May 12 '23 05:05 ann0see

#1450 maybe?

ngocdh avatar May 12 '23 11:05 ngocdh

Ah yes. Maybe something is not set correctly in the conditional or we have the multiple window support enabled.

ann0see avatar May 12 '23 11:05 ann0see

Ok. I think the chat dialog needs to be fixed (which crashes if I tap on close...) still - but that was the correct direction... Edit: Basically every window needs the full screen thingy now.

ann0see avatar May 13 '23 20:05 ann0see

Ok. At least connecting works - servers with welcome message bring issues due to the crash if close is tapped (this doesn't happen if I'm not connected to a server but the chat window is open)

Hmm. Maybe that's wrong. The crash log gives

VM - Fault hit memory shortage\nVM - Fault hit memory shortage\nVM - Fault hit memory shortage\nVM - Fault hit memory shortage\nVM - Fault hit memory shortage\n",
  "vmregioninfo" : "0 is not in any region.

Probably we dereference a null pointer.

Edit: Also changing to the Android way of the close button in the edit window doesn't change anything.

ann0see avatar May 13 '23 21:05 ann0see

The iOS log says at the start of the iOS app

May 21 20:22:02 Jamulus[58448] <Notice>: Detected system locale encoding (US-ASCII, locale "C") is not UTF-8.
Qt shall use a UTF-8 locale ("UTF-8") instead. If this causes problems,
reconfigure your locale. See the locale(1) manual for more information.

I don't think that's related but interesting to know. I'll downgrade the SDK. Maybe that fixes it? I don't really understand the issue. To me it seems like we dereference a NULL pointer.

May 21 20:22:25 SpringBoard(KeyboardArbiter)[55730] <Error>: [<_UIKeyboardArbiter: 0x28236ed80; <<_UIKeyboardArbiter_ForSpringBoard: 0x281653c90>; scene = <FBSScene: 0x28368ba80; identifier: com.apple.UIKit.remote-keyboard; valid: YES> {
    settings = <UIApplicationSceneSettings: 0x283602280> {
        displayConfiguration = "<FBSDisplayConfiguration: 0x28216f560; Main; mode: "320x568@2x 60Hz sRGB SDR">";
        frame = {{0, 0}, {320, 568}};
        level = 2.0;
        interfaceOrientation = unknown (0);
        foreground = NO;
        interruptionPolicy = default;
        isOccluded = BSSettingFlagNotSet;
        activityMode = default;
        jetsamMode = default;
    };
    clientSettings = <UIApplicationSceneClientSettings: 0x2803572c0> {
        layers = (empty);
        preferredLevel = 2.0;
        preferredInterfaceOrientation = unknown (0);
    };
    hostProcess = <FBApplicationProcess: 0x10310b770; daemon<com.apple.SpringBoard>:55730(v286BE); taskState: Running; visibility: Unknown>;
}>;
disabler = (null);
lastEventSource = 0;
current state = (null);
active handle = (null);
handles = (
    "<_UIKeyboardArbiterHandle: 0x282f72cb0; PID 55730: com.apple.springboard <com.apple.frontboard.systemappservices::com.apple.springboard>; hosting PIDs {(\134n)}; level 2.000000; active NO [wants NO]; suppression 0; iav 0.000000; on screen NO>",
    "<_UIKeyboardArbiterHandle: 0x282f41b80; PID 56371: (null) <(null)>; hosting PIDs {(\134n)}; level 0.000000; active NO [wants NO]; suppression 0; iav 0.000000; on screen NO>",
    "<_UIKeyboardArbiterHandle: 0x282f4c9a0; PID 57286: com.apple.MailCompositionService <(null)> (suspended); hosting PIDs {(\134n)}; level 0.000000; active NO [wants NO]; suppression 0; iav 0.000000; on screen NO>",
    "<_UIKeyboardArbiterHandle: 0x282f27700; PID 57909: com.apple.PassbookUIService <(null)> (suspended); hosting PIDs {(\134n)}; level 0.000000; active NO [wants NO]; suppression 0; iav 0.000000; on screen NO>"
)>] No handle found for currently focused PID: 58448; sceneIdentity: com.apple.frontboard.systemappservices::sceneID%3Aio.jamulus.Jamulus.<redacted>-default

Is probably the place where the error occurs.

May 21 20:22:26 ReportCrash(CoreAnalytics)[58352] <Notice>: Sending event: com.apple.stability.crash {"bundleID":"io.jamulus.Jamulus.<redacted>","bundleVersion":"1","exceptionCodes":"0x0000000000000001, 0x0000000000000000(\134n    1,\134n    0\134n)EXC_BAD_ACCESSSIGSEGVKERN_INVALID_ADDRESS at 0x0000000000000000","incidentID":"DFD5F2F2-D1FF-4E87-9C72-BDC2882CCEB8","logwritten":1,"process":"Jamulus","terminationReasonExceptionCode":"0xb","terminationReasonNamespace":"SIGNAL"}
May 21 20:22:26 analyticsd[100] <Notice>: Received event: com.apple.stability.crash {"bundleID":"io.jamulus.Jamulus.<redacted>","bundleVersion":"1","exceptionCodes":"0x0000000000000001, 0x0000000000000000(\134n    1,\134n    0\134n)EXC_BAD_ACCESSSIGSEGVKERN_INVALID_ADDRESS at 0x0000000000000000","incidentID":"DFD5F2F2-D1FF-4E87-9C72-BDC2882CCEB8","logwritten":1,"process":"Jamulus","terminationReasonExceptionCode":"0xb","terminationReasonNamespace":"SIGNAL"}
May 21 20:22:26 analyticsd[100] <Notice>: Aggregated. Transform: StabilityCrashNumerator3WithBundleVersion Dirty: 1 Event: com.apple.stability.crash {"bundleID":"io.jamulus.Jamulus.<redacted>","bundleVersion":"1","exceptionCodes":"0x0000000000000001, 0x0000000000000000(\134n    1,\134n    0\134n)EXC_BAD_ACCESSSIGSEGVKERN_INVALID_ADDRESS at 0x0000000000000000","incidentID":"DFD5F2F2-D1FF-4E87-9C72-BDC2882CCEB8","logwritten":1,"process":"Jamulus","terminationReasonExceptionCode":"0xb","terminationReasonNamespace":"SIGNAL","timestamp":1684693346614102}
May 21 20:22:26 analyticsd[100] <Notice>: Aggregated. Transform: StabilityCrashNumerator3WithIncidentID Dirty: 1 Event: com.apple.stability.crash {"bundleID":"io.jamulus.Jamulus.<redacted>","bundleVersion":"1","exceptionCodes":"0x0000000000000001, 0x0000000000000000(\134n    1,\134n    0\134n)EXC_BAD_ACCESSSIGSEGVKERN_INVALID_ADDRESS at 0x0000000000000000","incidentID":"DFD5F2F2-D1FF-4E87-9C72-BDC2882CCEB8","logwritten":1,"process":"Jamulus","terminationReasonExceptionCode":"0xb","terminationReasonNamespace":"SIGNAL","timestamp":1684693346614102}
May 21 20:22:26 analyticsd[100] <Notice>: Aggregated. Transform: StabilityCrashNumerator3 Dirty: 1 Event: com.apple.stability.crash {"bundleID":"io.jamulus.Jamulus.<redacted>","bundleVersion":"1","exceptionCodes":"0x0000000000000001, 0x0000000000000000(\134n    1,\134n    0\134n)EXC_BAD_ACCESSSIGSEGVKERN_INVALID_ADDRESS at 0x0000000000000000","incidentID":"DFD5F2F2-D1FF-4E87-9C72-BDC2882CCEB8","logwritten":1,"process":"Jamulus","terminationReasonExceptionCode":"0xb","terminationReasonNamespace":"SIGNAL","timestamp":1684693346614102}

seems to be where the system logs the error.

ann0see avatar May 21 '23 18:05 ann0see

Now a linking error... I'll try to downgrade to Qt5 and then raise another PR if that works.

ann0see avatar May 21 '23 19:05 ann0see

Ok. It could be that just adding the flags doesn't solve the problem. We might need to load some plugins manually

https://stackoverflow.com/questions/45508043/qt-ios-linker-error-entry-point-main-undefined

ann0see avatar May 21 '23 20:05 ann0see

The build seems to also produce binaries for the iOS simulator - so the IPA would also run on the x86 mac simulator - which is not what we want. I think deploy_ios.sh needs to be tweaked too...

https://forum.qt.io/topic/140559/qmake-cmake-build-apk-and-ios-app-via-terminal/5

ann0see avatar May 21 '23 20:05 ann0see

I believe the change in deploy_ios.sh removed the simulator as target. This needs further investigation (might be related to the issue not needing the macOS workaround).

I believe this PR should be considered as in development now. The Qt5 one should be ready.

ann0see avatar May 21 '23 21:05 ann0see

The warning sounds bad here. Xcode would like us to use " instead of < for includes as far as I understand? But doesn't < have a meaning that it's in the include path and something standard while " means that it's a header file of the project?

Putting https://stackoverflow.com/questions/65943369/what-is-a-headermap-in-c-or-c-or-objective-c here

Edit: Maybe it's not the case: https://developer.apple.com/documentation/xcode-release-notes/build-system-release-notes-for-xcode-10

Also it doesn't find lrelease...

ann0see avatar May 22 '23 20:05 ann0see

Use quote-style include ("example.h") for project headers, and reserve angle-bracket include (<example.h>) for system headers.

So no change there. The only thing C++ seems to do is drop the .h? (So <vector> rather than (Objective?) C's #include <fcntl.h>.)

pljones avatar May 23 '23 15:05 pljones

Ok. Could get another run on the simulator and got a crash:

2023-06-06 21:33:10.326150+0200 Jamulus[4974:50829] [SceneConfiguration] Info.plist contained no UIScene configuration dictionary (looking for configuration named "(no name)")
2023-06-06 21:33:10.398742+0200 Jamulus[4974:50829] - allocated port number: 22134
2023-06-06 21:33:10.977508+0200 Jamulus[4974:50829] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600003090120> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2023-06-06 21:33:32.011739+0200 Jamulus[4974:50829] fopen failed for data file: errno = 2 (No such file or directory)
2023-06-06 21:33:32.012905+0200 Jamulus[4974:50829] Errors found! Invalidating cache...
2023-06-06 21:33:32.929661+0200 Jamulus[4974:50829] fopen failed for data file: errno = 2 (No such file or directory)
2023-06-06 21:33:32.929946+0200 Jamulus[4974:50829] Errors found! Invalidating cache...
2023-06-06 21:33:44.013115+0200 Jamulus[4974:50829] QHBoxLayout(0x6000030c17e0, name = "horizontalLayout_7") is laying out QTabWidget(0x600003ebc0f0, name="tabSettings") outside of the contents rect of CClientSettingsDlg(0x7ff7ba208398, name="CClientSettingsDlgBase")
2023-06-06 21:33:44.013782+0200 Jamulus[4974:50829] QHBoxLayout(0x6000030c17e0, name = "horizontalLayout_7") is laying out QTabWidget(0x600003ebc0f0, name="tabSettings") outside of the contents rect of CClientSettingsDlg(0x7ff7ba208398, name="CClientSettingsDlgBase")
2023-06-06 21:33:44.015753+0200 Jamulus[4974:50829] QHBoxLayout(0x6000030c17e0, name = "horizontalLayout_7") is laying out QTabWidget(0x600003ebc0f0, name="tabSettings") outside of the contents rect of CClientSettingsDlg(0x7ff7ba208398, name="CClientSettingsDlgBase")
2023-06-06 21:33:44.016987+0200 Jamulus[4974:50829] QHBoxLayout(0x6000030c17e0, name = "horizontalLayout_7") is laying out QTabWidget(0x600003ebc0f0, name="tabSettings") outside of the contents rect of CClientSettingsDlg(0x7ff7ba208398, name="CClientSettingsDlgBase")
2023-06-06 21:33:44.018262+0200 Jamulus[4974:50829] QHBoxLayout(0x6000030c17e0, name = "horizontalLayout_7") is laying out QTabWidget(0x600003ebc0f0, name="tabSettings") outside of the contents rect of CClientSettingsDlg(0x7ff7ba208398, name="CClientSettingsDlgBase")
2023-06-06 21:33:44.018982+0200 Jamulus[4974:50829] QHBoxLayout(0x6000030c17e0, name = "horizontalLayout_7") is laying out QTabWidget(0x600003ebc0f0, name="tabSettings") outside of the contents rect of CClientSettingsDlg(0x7ff7ba208398, name="CClientSettingsDlgBase")
2023-06-06 21:33:44.023379+0200 Jamulus[4974:50829] QHBoxLayout(0x6000030c17e0, name = "horizontalLayout_7") is laying out QTabWidget(0x600003ebc0f0, name="tabSettings") outside of the contents rect of CClientSettingsDlg(0x7ff7ba208398, name="CClientSettingsDlgBase")
2023-06-06 21:33:57.247931+0200 Jamulus[4974:50829] ASSERT failure in QCoreApplication::sendEvent: "Unexpected null receiver", file /Users/qt/work/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp, line 1527
CoreSimulator 857.14 - Device: iPhone 14 Pro Max (A0A2608F-FCF3-4B1B-9E96-A64EC82AD958) - Runtime: iOS 16.2 (20C52) - DeviceType: iPhone 14 Pro Max
(lldb) 

ann0see avatar Jun 06 '23 19:06 ann0see

It could also be a race condition. But that would be out of scope of Jamulus and a Qt bug?

ann0see avatar Jun 06 '23 20:06 ann0see

hide() instead of close() works. So tat would be an option.

ann0see avatar Jun 06 '23 20:06 ann0see

We've already got issues on Android where the application gets hidden without going through close and not saving settings.

I'd beware of hiding rather than closing when the user asks to exit until we're catching all OS signals indicating we should save state (there's a Qt signal, IIRC).

https://github.com/jamulussoftware/jamulus/issues/2395

pljones avatar Jun 07 '23 17:06 pljones

I know. But it's hard to debug. I have the feeling that Qt6 (Widgets) isn't ready at all.

ann0see avatar Jun 08 '23 17:06 ann0see

Any progress on this or can it be dropped from 3.10.0 (with #2711)?

pljones avatar Jun 25 '23 13:06 pljones

I think this can be dropped. I think it could also be a Qt bug which we can't really fix.

ann0see avatar Jun 25 '23 14:06 ann0see

Unfortunately I've lost track on this. Qt 6 UI bugs also show up on bigger devices but that's the main issue.

ann0see avatar Jun 22 '24 20:06 ann0see

Is there any way to split the Jamulus application changes out from the build tool chain changes? Can one be made without the other or must they go in together?

pljones avatar Jul 01 '24 17:07 pljones

Potentially yes. As I said, This needs to be recreated anyway.

ann0see avatar Jul 01 '24 19:07 ann0see