Qt Program deploy to multi platform, how? - c++

Am new in Qt Programming and i would like to develop a program which i want to run in Windows, Linux(ubuntu), and Mac.
I heard that Qt support mutli-platform application development,
but my Question is that,
would any Qt library need to run these appilication in Ubuntu after i deployed or compiled?

If you deploy on Ubuntu, and therefore use a .deb package, then your job is easy since you just have to require qt as a dependency and apt will automatically install it as needed.
Windows and Mac however do not have any "good" software management layer, so you have no choice but include the required Qt DLLs with your binary or compile a static one. On Windows you just have to make sure the DLLs are in the same directory as your program. Mac however requires some relinking to be done. This is a big pain, but fortunately Qt comes with a tool named macdeployqt which does this for you.
So according to my experience, Linux is the easiest platform to deploy to, followed by Windows, and Mac is a good last.
The link to the Qt deployment doc given above is a good starting point. If you need an example, I have written a couple of scripts to build the Windows binaries of a program of mine. You can have a look at these to get started.
Windows installer:
http://gitorious.org/tagaini-jisho/tagaini-jisho/blobs/master/pack/win32-cross/buildwin32releases.sh
http://gitorious.org/tagaini-jisho/tagaini-jisho/blobs/master/pack/win32-cross/tagainijisho.nsi

Talking for the Linux side here, if you distribute your application as packages (deb, rpm) then you can use the package dependencies rules. If you define these rules correctly, then the package manager will install the Qt libraries you need when installing your application.

Related

How to make a Native Node.js module for one platform only?

I have a multiplatform Node.js application, and on one platform (windows) I need a Native Node.js module. It isn't needed on other platforms and fails to compile.
How can I go about making sure the module only gets the native element installed on Windows? Currently I have it as an optional dependency, but on other platforms people doing npm install will see an error.
Ideally on all other platforms the module would get installed without error, but just without the native bit. Obviously I could just ifdef all of the C file, but then it'd still fail to install for Mac users without XCode.
If it helps, this is my module - I tried to make it windows-only with OS==win in binding.gyp but there are still problems: https://github.com/espruino/winnus
thanks!

DLL Dependencies with Mingw on Windows

I'm working on a program which uses autotools for its build system and compiles fine on linux. To build for windows I'm trying to get a mingw cross-compiler working for windows. Now when I compile on linux and move to windows of course I am missing some dll's that are not installed by default on windows. This leads to missing dll errors. I cannot statically link my program due to restrictions in the LGPL.
So my question is what is the correct way to cross compile in this situation? I feel like I need to wrap my exe in a installer which automatically resolves and installs the dll dependencies for windows but I haven't been able to locate something explaining how to do this. Basically I'm thinking of yum/apt-get for windows. How do I manage dll dependencies on windows? I'm a linux guy, not a windows guy, so please bear with me.
Probably the easiest thing would be if you could move your development to a Windows machine. But short of that, you could install Windows-Mingw on your Linux machine using Wine. (IIRC winetricks has even a target for this) That way you get a "feel" for the issues on windows. An alternative could be Windows in a virtual machine, but Wine should be ok for a development environment.
I also strongly suggest that you install Microsoft Visual C++. The express versions will do fine. There are a number of tools coming with MSVC++ that can make your life a lot easier, like dll-dependency checker etc. An additional excellent source of information are the Sysinternals tools from Mark Russinovich and his blog.

Does wxwidgets use rosetta in Mac?

While deciding for a cross platform language for a desktop application I want to do, I came across "wxwidgets" for C++. After testing a demo application in Mac 10.6.4 I noticed the application needed "Rosetta" to run.
My concern is: Will I always need "Rosetta" for a C++ application with wxwidgets to run on a Mac?
Note: Latest news about Mac dropping support for Java in future OS release (hoping Oracle will pickup were left) and the upcoming App Desktop Store will not support apps requiring Rosetta.
You can create Universe Binaries with wxWidgets. My guess is that your demo application was only compiled for PPC. (Which seems weird, actually. Was the app you tried one you built yourself from examples/, or just one you downloaded off the web?).
I've built Universal apps in wxWidgets both in Xcode (the easiest way to do it), and I believe it's not that hard with a Makefile on the command line. (you make the ppc version, make the intel version, and use the lipo command line tool to squash them together.)

Which install system to pick when deploying to Windows and Linux?

My company is thinking of dumping InstallShield and move to something else, mainly because of the poor experience it had with it, mostly on Linux.
Our product is a C++ application (binaries, shared libraries) targeted at Windows and Linux (Red Hat).
The installer itself isn't required to do anything special, just dump some binaries and shared libraries and sometime execute an external process. Things like version upgrading through the installer isn't necessary, this is handled after the installer finishes.
I thought of suggesting using NSIS on Windows and RPM on Linux.
What are the recommended installer systems to use when deploying to Windows/Linux? Something that is cross platform to prevent maintaining two installers is a definite plus.
For Windows I would definitively use NSIS. It's very lightweight, easy to code and very simple to understand. Using msis would just be a killer - it generates guid for every file so you can get upgrades for free and stuff but truth being said, you never end up using any of these.
Regarding Linux I would go for RPM and Deb. They're probably the two biggest packaging system so you'll be targeting most of the Linux users. I've never tried RPM but creating a Deb package is fairly straightforward.
See also:
What to use for creating a quick and light setup file?
Packaging to use to deploy cross-platform?
And even:
Creating installers for complex cross-platform programs
There's a tool called BitRock Installer which can create installers for Windows, Linux and OS X.
However, I think that if you target RedHat it would be better to provide native packages for that platform (that is .rpm).
For C++ projects, I'd go with cmake/cpack, if you are also willing to change your build system. Great support, strongly cross-platform. cpack has various generators, NSIS is one..
Take a look at InstallJammer. It will handle both platforms from the same build project, and you can have the installer register the package with the RPM database as well if that's your requirement.
You may want to consider our tool BitRock InstallBuilder , it can generate installers for Windows and Linux from a single project file and also RPMs. Is your application based on Qt? Our clients include the makers of Qt, Nokia (previously Trolltech) and they use it to package their Qt Creator product. We encourage to give InstallBuilder a try and contact our support with any questions or suggestions you may have.

Question regarding libraries and framework

Sorry i'm a beginner,from what i know there are number of varieties of libraries and framework out there provided for the C++ language.My question is,when we create an application using the framework and libraries,do the users of the application need to install the framework or so so call the libraries on his/her PC??Thank You
It depends whether the library you are using is statically or dynamically linked. In the former case, it is part of the executable file that you distribute. In the latter case, it is an extra file (or set of files) with extensions such as .so or .dll, which you should distribute with your app.
Yes, libraries must be bundled with your application/installed before hand, as they are the framework upon which your application relies. If you don't install the framework, your application will not work.
You need to install something, not necessarily the framework. Some frameworks, like DirectX for example have a client installation. Some components are simple dll files that you can deliver with your software, creating an installation package.
The end-user need to have the framework installed.
As you need to have .Net installed to run some Microsoft(and other companies) products. If your application is written in C++ using GTK or Qt. You need to have they installed, but if you're on Linux using KDE, Qt is natively installed for default, the same for Gnome and also the same of Cocoa on Mac and Cocoa-Touch on iPhone and iPod Touch.
I suggest you to have the installer of the framework used embedded on the installer of your application. As GIMP and Xchat do.
Generally when using a framework there will be a framework redistributable (.NET, DirectX, etc) which can be bootstrapped into your installation to install the framework (or run by the end user as the first part of "installing" your app).
Many libraries simply need to be included with your code to function correctly, they themselves might have dependencies which need to be installed but these should be called out.
If in doubt, before you distribute your package run it on a fresh install of your target system (Linux, Windows, etc) and see if it complains about missing dependencies. Include those in your package and try again.
You can also look at installation systems (RPM, Apt, Windows Installer, etc) which can handle all of these tasks for you directly (or provide scripting languages to help you automate the job).