Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Building a Release for Windows 10 from Mac OS
I've got my code ready. But the problem's with deployment.
I built a release version that could run on my Mac and sent it to a friend to try it out. He uses Windows 7. It works.
I sent it to another friend who uses Windows 10. The application doesn't work. The .app extension turns out into a folder on his screen (with contents similar to right-click->Show Package Contents for Mac).
I was wondering if this compatibility issue was due to the -spec flag on the qmake? I tried setting (in Additional arguments)
-spec win32-clang-g++and a bunch of other win32 mkspecs but, when building, I kept getting
<QtCore/qchar.h> not foundor
unknown argument: -fno-keep-inline-dllexport. I attempted a thorough search across the web but failed to find a solution to be able to build.
So I thought maybe there was a special step for Windows 10? or maybe for Windows in general?
I dunno, so I'm seeking help from you guys.
I'm using Qt Creator 4.6.0 (Based on Qt 5.10.1 (Clang 7.0 (Apple), 64 bit). QMake has the flag -spec macx-clang and CONFIG += x86_64.
The application bundle is just a folder with the
.appextension. Are you sure your first friend didn't go into the folder to execute the application itself ?
Hullo, thanks for your reply.
It turns out that my friend used one or two third-party apps to open the app I sent him. (Because I sent my app to him in a .zip so he went ahead and found a zip opener).
My second friend didn't use any third-party apps (directly copied the application of my flash drive). This might (hopefully) explain the issue I had.
I've already asked my first friend which apps he used. I expect a reply from him in less than two/three days time.
Thanks for taking your time, @SGaist.
Friend #1 used an application called WinZip and somehow unpacked the applications (which I sent in a .zip file which also contained a .db and a README.txt).
I told friend #2 to download WinZip. He did. Unzipped the folders. Tells me is still a bunch of folders.
So no indeed, my first friend didn't go into the folder to execute the application itself.
My second friend (the one using Windows 10) further informs me that the application inside the .app folder (what would be a Unix Executable on my Mac) has type File.
If he tries to rename the file to have a .exe extension, he gets a "This app can't run on your PC" error pop-up.
That's the extra info I got.
My second friend (the one using Windows 10) further informs me that the application inside the .app folder
Sounds like you sent MacOS version of your app to your friend #2...
@jsulm That is accurate. Any idea how to build a release version for Windows 10?
@ResistorInTheDark Somehow I don't really understand - "I built a release version that could run on my Mac and sent it to a friend to try it out. He uses Windows 7. It works.". How can a MacOS build of your app work on Windows?
To get a Windows build you will need to build on Windows. Either use a machine with Windows or a Virtual Machine.
You're going to have a tough time setting up a cross compile chain from MacOS to Windows. It's possible, this StackOverflow thread may help you.
Besides the obvious hassels, you'll also have to crosscompile the whole Qt libabry, in the end, you're much better of by simply creating a vm and runnning windows & compiling of from that.
Thanks for the quick replies.
@jsulm I'm not entirely sure how he did it. He told me he pulled it out of the zip file using WinZip and it ran fine.
@J.Hilk Okay then, I think I might run and compile from Windows. I've told my friend to download Qt. Hopefully everything goes well then.
@ResistorInTheDark Your friend should not download Qt to run your app, instead you should deploy it to create a package containing all needed libraries. See here for Windows: https://doc.qt.io/Qt-5/windows-deployment.html
@jsulm I can't seem to find the windeployqt executable in the Qt folders. I've found a macdeployqt, but no windeployqt. Is there a direct download link for this, perhaps?
@ResistorInTheDark Yes, that's because you're on a Mac with Mac version of Qt. As I said you need a Windows machine.
@jsulm Okay. So right now I have access to my friend's computer (Windows 10). He doesn't have Qt installed (as you have advised). But he also doesn't seem to have the windeployqt.exe.
@ResistorInTheDark Why should your friend have windeployqt? It's your job to deploy the app for all platforms/OS you want to support.
So, again: you need Windows machine with a compiler (MinGW or VC++) and Qt. Then build your app there and use windeployqt to deploy your app and then send the result to your friend.
And I did NOT adviced that your friend needs to install Qt! You should read more careful what others write...
@jsulm Thanks for your comments. Perhaps my post caused a misunderstanding. I meant that you advised to not have Qt installed.
Right now, I'll continue installing Qt for Windows.
I meant that you advised to not have Qt installed
Yes, you should deploy your app with everything it needs to run, including Qt libraries. Then your users do not have to install Qt. This is how applications are distributed.
@jsulm That makes sense then. My friend is not a user, he's a tester. So his computer is technically part of my assets. Perhaps that helps clarify something.
I apologise for my inexperience in this field.
Alright, after installing Qt on Windows and building from a Windows machine, the application was able to be compiled and ran successfully with very minor differences compared to the deployment on Mac.