Fix QML build regressions on macOS#13334
Conversation
Instead of include <GL/gl.h>, which is unavailable on macOS and not used elsewhere in the codebase either, we include the Qt OpenGL headers.
This should hopefully fix the other build issues
As per PR feedback
acolombier
left a comment
There was a problem hiding this comment.
Thanks for the quick fix!
My fault for not testing On MacOS after doing all the nits addressing on that beast PR
|
Hm, it looks like |
| } | ||
|
|
||
| QByteArray input(std::bit_cast<const char*>(frame.constBits()), frame.sizeInBytes()); | ||
| QByteArray input(reinterpret_cast<const char*>(frame.constBits()), frame.sizeInBytes()); |
There was a problem hiding this comment.
From what I understand, casting between const char * and const unsigned char * using reinterpret_cast seems to be fine, stackoverflow confirms that. This would fix the build on some older compilers where std::bit_cast isn't available, such as the macOS 11 runners we are building on in CI.
Would appreciate a second pair of eyes checking that this is fine though.
| } | ||
|
|
||
| QByteArray input(std::bit_cast<const char*>(frame.constBits()), frame.sizeInBytes()); | ||
| QByteArray input(reinterpret_cast<const char*>(frame.constBits()), frame.sizeInBytes()); |
There was a problem hiding this comment.
AFAIR, this is what I was using, but I was requested to change it to bit_cast. Perhaps you could keep this cast specific to Mac?
There was a problem hiding this comment.
My gut feeling would be that it would be better not to have different code paths here to avoid introducing subtle semantic differences here. From what I understand the semantics shouldn't differ, but I think it would be better to hit a bug on all platforms rather than just one (that isn't as well-tested as e.g. Linux).
Perhaps a comment that this should be refactored to a std::bit_cast once we drop support for macOS 11 (or build on a newer runner)?
There was a problem hiding this comment.
Perhaps a comment that this should be refactored to a std::bit_cast once we drop support for macOS 11 (or build on a newer runner)?
is this specific to the build environment or to the runner? Cuz the runner was recently updated #13296.
Here's a little more context for reinterpret_cast vs std::bit_cast: https://stackoverflow.com/a/53402217
There was a problem hiding this comment.
Should be specific to the compiler, i.e. the Xcode version that the runner uses. macOS 12 is two years old too, so my best guess would be that it doesn't support bit_cast either yet.
There was a problem hiding this comment.
https://developer.apple.com/xcode/cpp/ says bit-casting requires XCode 14.3. Seems like that's only available on MacOS 13...
There was a problem hiding this comment.
Ah okay, thanks for checking. I think as long as we're building against an SDK older than that (in CI), we are going to get an error, regardless of whether we use a newer runner. I'll update the comment.
There was a problem hiding this comment.
That's a neat site btw, have to bookmark that.
There was a problem hiding this comment.
Even better: https://en.cppreference.com/w/cpp/compiler_support
Apparently they also track apple clang now, which they previously haven't which is why I defaulted to the apple site.
Swiftb0y
left a comment
There was a problem hiding this comment.
LGTM. waiting for CI. Thank you.
|
Any ideas on the test failure? That it only fails on x64 makes it pretty strange |
|
Yep, that's the part that is failing: This is likely because the QML dependencies aren't included in the VCPKG, or aren't installed properly in the build environment, basically meaning that QML doesn't work on Mixxx out of the box. This was tracked in #12267 and should have been fixed in #12604 but not sure this was tested on Mac x64 |
|
Hm okay, so maybe disabling QML in x64 CI would be a temporary fix, not ideal, but at least we'd get QML CI on macOS. |
|
Do you mind creating an issue for macOS x64 /w QML just so we keep track of this? |
|
-> #13336 |
Swiftb0y
left a comment
There was a problem hiding this comment.
Welp, at least QML on arm macos is better than not on macos at all.
|
Thank you for looking into the issue this quickly. |
This fixes a few minor regressions introduced by #11407 when building with
-DQML=ONon macOS and re-enables QML in the CI build for macOS.