PDA

View Full Version : Building for Linux and Mac from Windows



VirtuousLeo
6th November 2013, 07:27
Hello,
I am a newbie to QT and cross platform environments including Linux and MAC. I have some basic questions because i have only experience in working in windows development.

i downloaded the following package Qt 5.1.1 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB) from http://qt-project.org/downloads and created a basic hello world gui application containing just a label with text in qt creator. I have build an application in release mode and it generated an .exe file which on double clicking in windows runs successfully.

The code also created some MakeFile.Release file which i have on idea about.

1) Will copying the same .exe to linux will run successfully in linux or do i have to compile the code in linux again? Any steps or guide for achieving this would be very helpful as i have never worked in linux before.

2) Same question above for MAC environment.

3) Whats the role of MakeFile.Release

I know that these questions are very basic but any help in this regard is much appreciated. Thanks

VirtuousLeo
7th November 2013, 06:01
No reply yet from anyone, please guide me if i haven't properly categorized my question or more clarification is required.

Radek
7th November 2013, 06:52
(1) No. Linux isn't winblows and it cannot run winblows executables. The usual solution is having Linux installed in a virtual machine and compile the same (portable) source code under Linux. Sometimes, it is possible to "cross compile" on winblows but even then you need Linux environment (Qt, base system libraries, etc.) stored somewhere and you lose an ability to see whether your app even runs. Winbows cannot run Linux executables.
(2) The same answer. Replace Linux by Mac.
(3) A makefile for the release build most likely.

VirtuousLeo
8th November 2013, 05:42
Thanx Radek for your clear reply.

Ok i have set up a virtual machine for linux. Do i need to install the Qt farmework for linux again for this virtual linux machine or can i use any other compiler to compile the same (portable) source code (copied from windows) to compile under linux?

Radek
8th November 2013, 07:17
You need a development environment in the virtual machine. The only thing you are sharing is the source code (create a shared folder, you need not copy). Install KDE, it's Qt- based so that you have Qt. Install:

- g++ - the C++ compiler, only the C compiler is installed by system install.
- gdb - not installed by system install
- qtcreator - your IDE
- qt4-designer - the designer
- qt4-qmlviewer - needed by qmake
- qt4-dev-tools - misc development tools
- libqt4-dev - you already have Qt installed, it will install only headers

All this is in the repository. You can also install Valgrind if you want to detect memory leaks. Set the project base to the shared folder but set debug and release folders differently from winblows.

VirtuousLeo
11th November 2013, 07:08
Thanx Radek :) ... i think i can atleast start something with the information you provided.