Results 1 to 6 of 6

Thread: Building for Linux and Mac from Windows

  1. #1
    Join Date
    Nov 2013
    Posts
    8
    Thanked 8 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Building for Linux and Mac from Windows

    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

  2. #2
    Join Date
    Nov 2013
    Posts
    8
    Thanked 8 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Building for Linux and Mac from Windows

    No reply yet from anyone, please guide me if i haven't properly categorized my question or more clarification is required.

  3. #3
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Building for Linux and Mac from Windows

    (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.

  4. #4
    Join Date
    Nov 2013
    Posts
    8
    Thanked 8 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Building for Linux and Mac from Windows

    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?

  5. #5
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Building for Linux and Mac from Windows

    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.

  6. #6
    Join Date
    Nov 2013
    Posts
    8
    Thanked 8 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Building for Linux and Mac from Windows

    Thanx Radek ... i think i can atleast start something with the information you provided.

Similar Threads

  1. Building QT program on the Linux in QtCreator
    By piyushpandey in forum Newbie
    Replies: 2
    Last Post: 18th January 2011, 21:29
  2. building qt with opengl on linux...
    By suma in forum Newbie
    Replies: 0
    Last Post: 11th November 2010, 09:02
  3. Which Linux distribution is best for building compatible apps?
    By Oxidative in forum Installation and Deployment
    Replies: 8
    Last Post: 9th July 2009, 16:13
  4. Replies: 2
    Last Post: 4th June 2009, 16:09
  5. Building for linux from MacOS
    By afflictedd2 in forum Qt Programming
    Replies: 1
    Last Post: 29th October 2008, 03:51

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.