How do you check configuration of existing Qt install? - c++

The first step to building Qt itself is to run configure, setting up the library connections, compiler selection, etc. If the person compiling it was careful and helpful, they saved their config in a convenient, obvious location. If not, however, is there a way for me to check which args were used to configure an existing build?

If all you have are the binaries (.DLL/.so files), then "no", there is no easy way. But if you have access to the build configuration then obviously you could dig it out.

Related

set output path for cmake generated files

My question is the following:
Is there a way to tell CMakeFiles where to generate it's makefiles, such as cmake_install.cmake, CMakeCache.txt etc.?
More specifically, is there a way to set some commands in the CMakeFiles that specifies where to output these generated files? I have tried to search around the web to find some answers, and most people say there's no explicit way of doing this, while others say I might be able to, using custom commands. Sadly, I'm not very strong in cmake, so I couldn't figure this out.
I'm currently using the CLion IDE and there you can specifically set the output path through the settings, but for flexibility reasons I would like as much as possible to be done through the CMakeFiles such that compiling from different computers isn't that big of a hassle.
I would also like to avoid explicitly adding additional command line arguments etc.
I hope someone might have an answer for me, thanks in advance!
You can't (easily) do this and you shouldn't try to do it.
The build tree is CMake's territory. It allows you some tiny amount of customization there (for instance you can specify where the final build artifacts will be placed through the *_OUTPUT_DIRECTORY target properties), but it does not give you any direct control over where intermediate files, like object files or internal make scripts used for bookkeeping are being placed.
This is a feature. You have no idea how all the build systems supported by CMake work internally. Maybe you can move that internal file to a different location in your build process, which is based on Unix Makefiles. But maybe that will also horribly break my build process, which is using Visual Studio. The bottom line is: You shouldn't have to care about this. CMake should take care of it, and by taking some freedom away from you, it ensures that it can actually do that job on all supported build toolchains.
But this might still be an unsatisfactory answer to you. You're the developer, shouldn't you be in full control of the results produced by your build? Of course you should, which is why CMake again grants you full control over what goes into the install tree. That is, whatever ends up in the install directory when you call make install (or whatever is the equivalent of installing in your build toolchain) is again under your control.
So you do control everything that matters: The source tree, the install tree, and that tiny portion of the build tree where the final build artifacts go. The rest of the build tree is off-limits for you and for good reasons.

Install Qt without admin rights

I'd like to download Qt. I tried to download it from Qt's website but this gives me an exe file and since I've got a limited account when I try to run it it asks for an admin password. I've searched the web for a way for a limited account to install Qt but I haven't found anything. Could someone please help me find a solution?
In case it matters, I'm using Code::Blocks and Windows 7.
You could download the free software source code and compile and build it on your machine (that takes about a whole night, or maybe more). Don't forget to configure the build appropriately (I don't know Windows, but on Linux I'll suggest explicitly setting the -prefix to some writable directory ...). Before starting, ask explicitly your boss for permission (if you violate your company policies, you can be fired at once), and ask for guidance from someone knowing your operating system better than you do. You might need to change your PATH too.
Alternatively, ask permission to install and use a Linux distribution.
PS. Be sure to get permission to do something (even if technically you can do it alone).
You can download this ZIP file with Qt. All you have to do is unzip the ZIP file (which will take time) and place the files it contains in the right folder, nothing that requires administrator privileges. I recommend you put the contents of the ZIP file in C:\Qt, otherwise it might not work correctly (if this folder doesn't already exist, you can create it without administrator privileges and if it does exist, Qt is probably already installed on your computer in which case you don't need to do anything). I've also posted Qt's license agreement as it is in the installer program here since Qt wants you to read it before you use Qt.
Furthermore, I recommend using Qt Creator to make your Qt projects instead of Code::Blocks, because it's difficult to get Qt5 to work with Code::Blocks and Qt5 is the version of Qt used on both this website and Qt's installer (see this question) (if you find a way to get Qt5 to work with Code::Blocks, all the better, maybe you could even answer the question for which I posted a link). Qt Creator is included in the ZIP files on my website and to use Qt with Qt creator, all you have to do is include the right header files, no linking is needed. The path of Qt Creator is in the table on the bottom of the website.
You can download an archived distribution of MSYS2. After you extract and run it, you can use its packet manager to download numerous packages, including Qt. The only downside is you will have to settle for the version it provides, which is a little old, currently 5.5.1. You can install by typing:
pacman -S mingw-w64-i686-qt5 // for 32bit build or
pacman -S mingw-w64-x86_64-qt5 // for 64bit
This will install Qt and all dependencies automatically. Make sure your antivirus is not running in the final stage, because it can mess with the binary patcher that patches Qt to run from its current installation folder (because advanced software like Qt apparently cannot work without hard-coded paths).
You can even get a static build of Qt, which is quite useful, just add a -static to the package name.
Just in case you were wondering - MSYS2 is a build environment, it can come quite in handy, for getting ready to use libraries, or for building libraries which require a build environment. You can build Qt without it, however, it is a very slow process that may fail, and even though it is not complex to do, I would not recommend it as a first option.
If you still decide to build it from source, there is a detailed guide which will get you through the process.

Qt/C++: How to deploy Qt application for windows

I tried to follow this link to deploy application for Windows, but I don't have the file configure and I am unable to run the command.
Any help ?
Skip the configure step. What you need is the windeployqt utility.
Afterwards you may need to remove some libraries your project doesn't use. For my projects, windeployqt insists to deploy a huge openglsw.dll (or something like that), even though I don't need it.
I also recommend simply copying the MSVC libraries into your distribution rather than installing from the supplied installer package. Just make sure you got all of them, the right version and for the right architecture.
If you use the Qt Network module, you may want to also deploy the OpenSSL binaries - you'll need them if you want to access HTTPS resources.
And my last advice - use Inno Setup for installer. It is well documented, very well written, very easy to use and produces no junk.
P. S. You could use one of my open source projects for reference, I have a script to copy all the necessary files into one folder and pack it into an installer using Inno Setup. I try to keep the scripts as simple and short as possible, no junk there.

Qt Application : How to create standalone executable file for Windows (& Mac) from Mac?

I developed a Qt application in MacBook (El-Capitan 10.11.2) and it is ready now to be released.
What i want now, is to create the standalone executable file for both Mac and Windows OS.
But I don't know how !
I found this link but I am unable to follow it is guidance, it looks different from what my system is showing me.
If you have any idea, please help me.
Thank you
Well, to compile an application for windows, you will need a windows machine (or at least a virtual machine). You can't compile for windows on mac.
Regarding the "standalone": The easy way is to deploy your application together with all the required dlls/frameworks and ship them as one "package". To to this, there are the tools windeployqt and macdeployqt. However, those will not be "single file" applications, but rather a collection of files.
If you want to have one single file, you will have to build Qt statically! You can to this, but you will have to do it on your own. And if you do, please notice that the LGPL-license (the one for the free version of Qt) requires you to make the source-code of your program public! That's not the case if you just link to the dynamic libraries.
EDIT:
Deployment
Deployment can be really hard, because you have to do it differently for each platform. Most times you will have 3 steps
Dependency resolving: In this step, you collect all the exectuables/lirabries/translations/... your application requires and collect them somewhere they can find each other. For windows and mac, this can be done using the tools I mentioned above.
Installation: Here you will have to create some kind of "installer". The easiest way is to create a zip-file that contains everyhing you need. But if you want to have a "nice" installation, you will have to create proper "installers" for each platform. (One of many possibilities is the Qt Installer Framework. Best thing about it: It's cross platform.)
Distribution: Distribution is how to get your program to the user. On Mac, you will have the App-Store, for windows you don't. Best way is to provide the download on a website created for this (like sourceforge, github, ...)
I can help you with the first step, but for the second step you will have to research the possibilities and decide for a way to do it.
Dependencies
Resolving the dependencies can be done by either building Qt statically (this way you will have only one single file, but gain additional work because you will have to compile Qt) or using the dynamic build. For the dynamic build, Qt will help you to resolve the dependencies:
macdeployqt is rather easy to use. Compile your app in release mode and call <qt_install_dir>/bin/macdeployqt <path_to_your_bundle>/<bundle>.app. After thats done, all Qt libraries are stored inside the <bundle>.app folder.
For windeployqt is basically the same: <qt_install_dir>\bin\windeployqt --release <path_to_your_build>\<application>.exe. All dependencies will be inside the build folder. (Hint: copy the <application>.exe in an empty directoy and run windeployqt on that path instead. This way you get rid of all the build-files).
Regarding the static build: Just google it, you will find hundreds of explanations for any platform. But unless you have no other choice but to use one single file (for whatever reason) it would recommend you to use dynamic builds. And regarding the user experience: On mac, they won't notice a difference, since in both cases everything will be hidden inside the app bundle. On windows, it's normal to have multiple files, so no one will bother. (And if you create an installer for windows, just make sure to add a desktop shortcut. This way the user will to have "a single file" to click.)

Building Archive in Xcode does not create archive

It seems all my searches to figure this out are fruitless. Knowing me it's one stupid checkbox or pulldown I'm missing. Is it maybe my install? Do I need to uninstall Xcode 4 and reinstall?
I've gone through all these steps and tricks and fixes all over the net and on SO, yet nothing gets me closer to getting an archive to pop up in my organizer. When I go to look at the archive that was built, it's just a zero k file. I get a build succeed, I change skip install to both yes and no ... I do all these things I find on the net, I'm going crazy. I'm pretty sure my certificates are all set up correctly, I have things checked where I'm told to be checked. It's driving me crazy. 99% of the solutions I see are:
"Anyway, in the "Skip Install", set the value for "Release" as "NO" (the help doc told you the opposite). Once you set it to "NO", archive again. You'll immediately see your app showing up in the archive organizer."
Well, it's not working or any further answers after aren't either.
Archive only seems to include those build products that are set to be "installed", so make sure that you deactivate Skip Install in your build settings:
Go to BuildSettings.
Find "Skip Install".
Select "NO" for Release.
Additionally, Xcode needs an Install Path. For Applications this is usually /Applications, but when e.g. building a plugin you might want to set this to just /, which will put the build product in the root of your archive. Note that you must use a "real" path, not a relative one like ~/Library.
Make sure you use Product > Archive, instead of Product > Build For > Archive.
I had this issue after I updated to High Sierra. I went to my library folder. /Users/your_user/Library/Developer/Xcode/Archives
In this folder was an empty folder named to the date I had created this archive. But the folder was empty. I removed the folder and archived again. That fixed the issue for me.
For me, I had to also change the following blank build setting, to something like...
"Installation Directory" --> /Applications
Finally, it started appearing in Organizer/Archives.
P.S. Interestingly, without this setting the old archive file was being created, but it was always empty.
I just had this issue and what resolved it for me was this:
Verify Code Signing on the release is set to your Distribution Profile. I did this and it actually reverted it at one point. Make sure that setting wasn't reverted and try again.
You mentioned the "Skip Install" value, I also had similar results. Setting to YES would not open the archive list, setting to NO would.
Hope this helps (more that #1 above helps).
Go through this checklist, and you should find an answer somewhere:
Create a new scheme labeled "[App name]-AppStore"
Create a build configuration labeled "Distribution" by duplicating release
Click the project and hit the + under build configurations in the "Info" tab.
Set the archive to build as "Distribution" under the new scheme
Verify all certificates
Verify all provisioning profiles
Verify your private key under your name in your keychain. (in the system keychain)
Make sure that in the Distribution code signing, you are setting the profile to your iPhone/iPad distribution profile in ALL signing instances.
Make sure that in your project info, the Distribution code signing is set to your iPhone/iPad distribution profile.
Make sure that you have the option, skip install, in build settings of your target set to "NO" for Distribution.
Make sure that your currently selected scheme is "[App Name]-AppStore > iOS Device"
If nothing else, clean all builds, delete all old archive attempts, build for archiving, and if there are no other errors, try archiving again. One problem that I ran into was when I let XCode always allow signing with my private key. Simply deleting that and redownloading the certificates forced XCode to re-ask me to allow code signing. I only click allow now and I haven't had that problem ever again.
If you are still having problems, you should delete all of your provisioning, revoke all of your certificates, reissue them all, and reinstall them all. Try resetting your code signing after that, and if it still doesn't work, use one of your two free TSIs given to you by Apple Dev Support. If nothing works, they can fix it for you I'm sure.
Hope this helps.
I did the following to make it work for me:
I replaced some subprojects/static libraries i had (ie three20) by using cocoapods to include the files within the main project.. it just got rid of all the trouble three20 was giving me (and they are lots..)
set skip install to yes under build settings for all other sub projects/static libraries and switched the copy headers from public to project under build phases
most importantly: under the sub libraries.. under build phases i ensured that copy files destination was changed from Absolute path to products directory.
and that was it!
hint: to get an idea of the offending files that's causing your archive to create an archive file rather than an ipa do this:
Select the archive and click the Distribute button.
Select the 'Save Built Products' option.
Hit Next and Save.
Browse the created directory in Finder.
The 'libraries' subdirectory will identify the libraries that you need to set the Skip Install to Yes.
in some cases usr/local/include will identify the culprit header files you need to move from Public to Project or the files that you have to change from absolute path to products directory. but that directory (ie usr/local/include) varies depending on your sublibrary directory structure