-
Notifications
You must be signed in to change notification settings - Fork 84
Building for iOS errors and some solutions #1250
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
Comments
Continuing: Error: failed to add native library ... libcxx-qt-cxxqt-generated.a: Unsupported archive identifier The next error was due to the libraries being generated as universal 'fat' libs (including both arm64 and x86_64 I suppose).
The generated build script was already calling cargo with The only thing which worked was to add a step to the thin_generated_fat_library_with_lipo() Using lipo in the build scripts worked. Error: ld: building for 'iOS', but linking in dylib (.../libz.1.tbd) built for 'macOS macCatalyst zippered(macOS/Catalyst)' The problem is that the wrong (MacOS SDK) Some details of investigation: The correct -isysroot path is already set in the generated clang command:
In
Had removed this warning:
But another still caused clang to fail:
Trying to add Getting the build to succeed These steps produced a successful iOS build. (1) Remove the project's (2) Add this in .zshrc: MACOS_SDK_CLI="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
IOS_SDK_DEV="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.4.sdk/usr/lib"
export PATH=$MACOS_SDK_CLI:$PATH
export LIBRARY_PATH=$MACOS_SDK_CLI:$LIBRARY_PATH
# export LIBRARY_PATH=$IOS_SDK_DEV:$LIBRARY_PATH (3) Start Qt Creator from a new terminal session.
Configure Project > Enable the Qt kit for iOS (4) Build for iOS. This will fail with:
(5) Exit Qt Creator, change # export LIBRARY_PATH=$MACOS_SDK_CLI:$LIBRARY_PATH
export LIBRARY_PATH=$IOS_SDK_DEV:$LIBRARY_PATH (6) In a new terminal, start Qt Creator, build for iOS again.
And the app deploys to the iPad. This is a crazy weird dance but I repeated it and is reproducible, however I don't know how to improve on it. At least it shows that building for iOS is possible. |
Uh oh!
There was an error while loading. Please reload this page.
Thanks for the cool project! I started to port an app to CXX-Qt so that I can build it for Android and iOS.
After setting up XCode and Qt Creator, I successfully compiled a "Hello World" app on a MacOS machine and deployed it to an iPad.
(This tutorial was helpful: How to develop a simple Qt app for iPad?)
Qt is installed to
~/Qt/
using their official open source online installer.At this point my project is very similar to the
qml_minimal
example.When trying to build it for iOS, a few errors I was able to solve:
Error: building for 'iOS', but linking in object file ... built for 'macOS'
Have to set the correct Rust target and qmake path in
CMakeLists.txt
:Error: linking with cc failed
The solution was in this article: Brain Detour - Rust and macOS compilation / linking issue
Have to add this to ~/.zshrc:
Error: Could not open ios ... QtCore.prl file to read libraries to link
In the Qt ios framework folders, the .prl files are under Versions/A/Resources.
I changed that path in
qt-build-utils/src/lib.rs
directly, but I think it should test somehow when building for ios.Error: ... QtGui.framework/QtGui found in .prl file for Qt6Gui, but could not extract library base name to pass to linker command line
The .prl contained no form of the library with .a or other suffix, e.g.:
You can see in this commit that in
parse_cflags.rs
I changed it to return the name without the suffix.It seems to be a quick hack but I don't know how to make it more sophisticated for the correct context.
Error: include/cxx-qt/connection.h:9:10: fatal error: 'QtCore/QObject' file not found
Update:
It turns out that the cc-rs
builder.flag_if_supported()
didn't include the-F
framework paths on iOS. Changing it tobuilder.flag()
solved this error.The text was updated successfully, but these errors were encountered: