Qt + VTK + MAC version based compilation and execution - c++

I have successfully Built and compiled VTK with Qt on Mac osx 10.6.7. Then according to the requirements I changed configuration in CMAKE so that the target version is 10.5. I compiled VTK with Qt again and it was successful, with cones tutorials examples running. But whenever i compile my own application which is built using QVTK Widget i got this error
"Check with the developer to make sure
Application works with this version of MacOS
X. You may need to reinstall the
application ..."
Following is my CMAKE Configuration
BUILD_EXAMPLES checked
BUILD_SHARED_LIBS checked
CMAKE_OSX_ARCHITECTURES x86_64
CMAKE_OSX_DEPLOYMENT_TARGET 10.5
CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk
VTK_USE_COCOA checked
VTK_USE_CARBON unchecked
VTK_USE_QT checked
VTK_USE_QVT_QTOPENGL checked
I have also ran following command on the terminal
export MACOSX_DEPLOYMENT_TARGET=10.5
Every thing in my application compiles with both QtCreator and XCode but does not execute by giving the error as mentioned above.
In the above if i change everything from 10.5 to 10.6 everything start working. But according to requirement i need to have it compatible with 10.5.
Can someone please let me know is there anything else i need to do? Am i missing something here?
Regards,
Rashid

Related

How to make Qt Creator use Rosetta and x86 compiler on Mac M1?

I am using Qt 5.15.2 on my Mac mini with M1 chip. This works fine (due to Rosetta). Below is the list of compilers Qt Creator found on this computer, and among them is the C++, x86 64bit that I use. No problem.
I would like to use the same settings on a (somewhat newer) Mac Book Pro (also with M1 chip). Below is the list of compilers Qt Creator finds on this computer, the x86 is now missing!
I do not know if I have a x86 compiler on the new M1-computer. I have installed Xcode and the command line tools for XCode 13.2.
Can I somewhere tell Qt Creator that the deployment target is x86?
Does /usr/bin/clang++ only compile for the ARM/M1-chip, or can it also produce and link to x86 code?
if not, how can I find out if there is an x86 compiler on my new M1-computer?
If the compiler is missing, how to install it?
Any help would be most appreciated!
A few tips that can help, I just setup a project using Qt 5.15.2 on a 2021 M1 Mac.
Note this will likely be different for Qt >= 6.
Can I somewhere tell Qt Creator that the deployment target is x86?
Yes, you can do this using specific argument in the build settings of your kit.
Add the QMAKE_APPLE_DEVICE_ARCHS="x86_64" additional argument to qmake.
Also, add an additional CMake option: -DCMAKE_OSX_ARCHITECTURES:STRING="x86_64"
ℹ️ Click Manage Kits.. in the projects view to open the preferences editor where you can update your CMake configuration.
Does /usr/bin/clang++ only compile for the ARM/M1-chip, or can it also produce and link to x86 code?
With rosetta installed (/usr/sbin/softwareupdate –install-rosetta –agree-to-license), and the configuration above, yes you can compile and link x86 binaries.

Qt cannot load cocoa plugin

I'm trying to compile and run an application on a MacBook using Qt Creator. There are no issues compiling the project, but when I try and run it, it seems to be unable to load a plugin.
Could not load the Qt platform plugin "cocoa" in "" even though it was found.
The application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
This error occurs both when trying to run the application from Qt Creator or via Finder. It seems to only happen when I use the CMake build system (no issues when using QMake), but my existing project that I need to deploy on MacOS uses CMake.
My steps to reproduce are:
Install a completely clean MacOS (no user data)
Install Xcode 11
Install CMake 3.15
Install Qt 5.13.1 MacOS package
Open QtCreator->New Project->Qt Quick Application - Scroll
Set build system to CMake (important)
Compile and notice error
I am using:
Qt 5.13.1
macOS Catalina 10.15
Apple Clang 11
I recognize that for final user deployment I will need to use the macqtdeploy tool to copy the Qt libraries to the executable folder, but I should be able to run my app from QtCreator without doing this? Especially as it works fine when using QMake.
So it ended up being some kind of name resolution thing where Qt Creator couldn't decide whether to use the debug or release versions of the framework. Supplying DYLD_IMAGE_SUFFIX=_debug fixed this (add this to the environment section under Kits).

iOS kit not detected on Qt (macOS)

I am currently trying to port an android application on iOS. The application was developped on Linux. But I can't manage to use Qt on macOs for iOS developpement.
I followed those (rather unclear) instructions : http://doc.qt.io/qt-5/ios-support.html
First, I installed successfully XCode and I managed to deploy a dummy app on my iPhone. Then, I installed Qt and opened the ".pro" project file.
But the only kit I can use is "Desktop Qt 5.4.1 clang 64 bit". The kits for iOS don't seem to be detected.
Did I do something wrong ? Am I missing something ?
EDIT:
When I launch the ".pro", I got this error :
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
Unfortunately, it is NOT related to this well known issue (Qt Creator - Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild)
When I run the command :
/usr/bin/xcodebuild
I get this error:
xcodebuild: error: The directory /Users/<UserName> does not contain an Xcode project
Okay I managed to solve my problem by re installing Qt with version 5.8 (instead of 5.9.1).
But I am not sure this is what was causing the issue though. In deed, I realized I installed Qt prior to configuring XCode the first time(with my Developer Account).

QT enable cross-compiling using MinGW (precompiled)

Good day all
I have been searching for a method of cross-compiling for QT-Creator in Linux for sometime now, and I have been having alot of trouble with it.
Background info
please note: I am on a Linux machine, and would like to cross compile Windows Apps
My system:
Ubuntu Gnome 16.10
QT Creator 4.0.2 (based on QT 5.7)
I have came across a few SO links, a few blogs with broken instructions, etc and one seeming helpful but dependencies could not be found.
I have also attempted another compiler MXE and cloned and attempted to build the MXE compiler from the GIT repo, which failed (no solution for the build error - VTK build error)
I decided to download precompiled MinGW compilers (i686 and x86_x64 versions) from sourceforge
Issue:
In QT Creator, adding the compiler is done without an issue, adding the "Kit" and selecting the newly added compiler, an red exclamation gives an error
The Compiler (x86_windows_msys_pe_64bit) cannot produce code for QT version 5.7.0 GCC 64Bit (x86_linux_generic_elf_64bit)
This occurs for both 32 + 64 bit compilers.
I think that you should have a QT version that matches your compiler ABI. The error tells you that the MinGW compiler doesn't match the Linux version of QT you have used. Therefore, get a windows version of QT and use it instead (just as you've added WinGW).
You can download Qt Binaries from here.

Qt + VTK + Cmake

I'm running OSX 10.6 (Snow Leopard), Qt 4.6, VTK 5.4, and Cmake 2.8. I installed Qt, then VTK and Cmake. I configured VTK to use QT 4.6 (turned on VTK_USE_GUISUPPORT and VTK_USE_QVTK). The configuration and installation worked painlessly but if I run Cmake with Qt references the compilation fails during the subsequent make process because of failed dependency resolution.
As an example, I tried to build the Qt ImageViewer example (VTK/Examples/GUI/Qt/ImageViewer) and it failed to find qapplication.h (and all other qt headers). Any ideas about why this might be happening would be greatly appreciated!
CMake finds Qt by looking for qmake (ironic, eh?). Make sure qmake is in your path.
Also, make sure VTK and Qt 4.6 were compiled with the same version of gcc/g++. Weird runtime errors (like cout not working) can result.
First you should set DESIRED_QT_VERSION to 4. When it's ready, you could chose QT_QMAKE_EXECUTABLE to your qmake binary.
I find that the CMakeCache.txt in your build folder for cmake tends to have all the necessary diagnostics info for stuff like this. Almost certainly there's a string field for the include path that is blank right now due to not being found.