Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Assistance with setting up Qt with my Mac?

Assistance with setting up Qt with my Mac?

Scheduled Pinned Locked Moved Installation and Deployment
20 Posts 3 Posters 5.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JonathanAV95
    wrote on last edited by
    #5

    [quote author="sierdzio" date="1415640286"]I can't answer that with any degree of authority, because I've always tried to stay as far away from Xcode as possible; it's interface puts me off.

    Yes, I think (not sure!) you will need at least a main.cpp. But if you have more files with some project structure - even better. You do not need to generate .pro file more than once, only modify it when you add or remove cpp/ h files.

    Here is how it works:
    qmake is a Makefile generator. In your case, it creates an Xcode project file. Once you open that file in Xcode, it should work fine - with code completion and stuff. You should also be able to build and run the application from within Xcode. You should also expect some hurdles, especially since you don't know much about qmake and don't have experience with command line tools.[/quote]

    So i went ahead in got the Qt installed on my laptop. Now when i simply run the line:
    qmake -spec macx-xcode
    i get this:
    -bash: qmake: command not found

    So what will i do? Also what are the process to doing it all.
    Do i first create a Folder then create a main.cpp that contains this:

    #include <QApplication>
    #include <QPushButton>

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    QPushButton button("Ca marche !");
    button.show();
    return app.exec();
    }

    How do i get it all working? Sorry for the basic noob question, jsut trying to figure everything out !

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #6

      Hi,

      Use the full path to qmake. Qt's installation doesn't add it's bin path to the PATH environment variable which is a Good Thing(™). Sure it makes more to type to call qmake but it avoids silly mistakes when you have several Qt versions installed.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JonathanAV95
        wrote on last edited by
        #7

        [quote author="SGaist" date="1415651202"]Hi,

        Use the full path to qmake. Qt's installation doesn't add it's bin path to the PATH environment variable which is a Good Thing(™). Sure it makes more to type to call qmake but it avoids silly mistakes when you have several Qt versions installed.[/quote]

        what do you mean by the full path environment?

        I was thinking of doing this:
        Step 3: Set the Environment variables
        In order to use Qt, some environment variables need to be extended.
        PATH - to locate qmake, moc and other Qt tools
        This is done like this:
        In .profile (if your shell is bash), add the following lines:
        PATH=/usr/local/Trolltech/Qt-4.8.6/bin:$PATH
        export PATH
        In .login (in case your shell is csh or tcsh), add the following line:
        setenv PATH /usr/local/Trolltech/Qt-4.8.6/bin:$PATH
        If you use a different shell, please modify your environment variables accordingly.
        That's all. Qt is now installed.

        But i was never able to find the .profile folder nor the usr/local/Trolltech folder.

        This is a bit confusing!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #8

          Which version of Qt did you install ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JonathanAV95
            wrote on last edited by
            #9

            [quote author="SGaist" date="1415652772"]Which version of Qt did you install ?[/quote]

            Actually, i enable the hidden folder and managed to get .profile
            which i then added the environment variable.

            However, i cant find the folder TrollTech that the environment variable says.
            Also i'm using the latest Qt for Mac, since i just downloaded the dmg today and made sure i used the latest which i dont know by hear (above 5 surely)!
            I just installed it and thats it, i then got a Qt folder in the hard drive but i dont know were else to go with it? do i have to do this to fullfill the installation?

            http://qt-project.org/doc/qt-4.8/install-mac.html

            To configure the Qt library for your machine type, run the ./configure script in the package directory.
            By default, Qt is configured for installation in the /usr/local/Trolltech/Qt-4.8.6 directory, but this can be changed by using the -prefix option.
            cd /tmp/qt-everywhere-opensource-src-4.8.6
            ./configure
            Type ./configure -help to get a list of all available options.
            Note that you will need to specify -universal if you want to build universal binaries, and also supply a path to the -sdk option if your development machine has a PowerPC CPU. By default, Qt is built as a framework, but you can built it as a set of dynamic libraries (dylibs) by specifying the -no-framework option.
            Qt can also be configured to be built with debugging symbols. This process is described in detail in the Debugging Techniques document.
            To create the library and compile all the demos, examples, tools, and tutorials, type:
            make
            If -prefix is outside the build directory, you need to install the library, demos, examples, tools, and tutorials in the appropriate place. To do this, type:
            sudo make -j1 install
            This command requires that you have administrator access on your machine.
            Note: There is a potential race condition when running make install with multiple jobs. It is best to only run one make job (-j1) for the install.
            If you later need to reconfigure and rebuild Qt from the same location, ensure that all traces of the previous configuration are removed by entering the build directory and typing make confclean before running configure again.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #10

              If you downloaded the latest Qt version it should be something like 5.3.X or 5.4 if you got the beta.

              You are following the 4.8 documentation, which is not completely valid for the 5.X series.

              Anyway, you can use Spotlight to find the exact position of qmake

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • J Offline
                J Offline
                JonathanAV95
                wrote on last edited by
                #11

                [quote author="SGaist" date="1415656599"]If you downloaded the latest Qt version it should be something like 5.3.X or 5.4 if you got the beta.

                You are following the 4.8 documentation, which is not completely valid for the 5.X series.

                Anyway, you can use Spotlight to find the exact position of qmake[/quote]

                I have the 5.3 so what do i need to do? What do i personally need to follow to make sure that Qt is fully installed and ready to be used?

                Also i opened a terminal and "cd" to the folder that contains the main.cpp for the projects i want to use with Qt.

                When i do the qmake, i get the problem that its supposibly not working!

                What can i do?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #12

                  What I already wrote: call qmake with the absolute path to it e.g.

                  @/usr/local/Qt/5.3.1/bin/qmake@

                  Or something like that. You can easily find qmake using spotlight

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    JonathanAV95
                    wrote on last edited by
                    #13

                    [quote author="SGaist" date="1415752681"]What I already wrote: call qmake with the absolute path to it e.g.

                    @/usr/local/Qt/5.3.1/bin/qmake@

                    Or something like that. You can easily find qmake using spotlight[/quote]

                    i get tons of qmake lol literally, i hate the Qt folder which has this:
                    Qt > 5.3 >
                    android_armv7
                    clang_64
                    ios
                    Src

                    Then each one of those folder have theyre own qmake, so in reality which one do i choose? i know i dont use ios or android since im building for desktop, so would i get clang or Src? Also if i choose src, what folder in Src do i choose? I have a bunch of folders starting with Qt....

                    Sorry for all the dumb questions, i dont know about this and what might be simple for you guys might be a bit confusing for me! I appreciate all the help !

                    So to clarify, i open up Terminal, then "sudo cd" into the directory were qmake is found in, correct? Once in there, i run the codes:
                    qmake -project
                    qmake -spec macx-xcode
                    make

                    However, my other question is, would i need to also insert the location of the folder were i'll be creating the program?

                    1 Reply Last reply
                    0
                    • sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #14

                      No need to use sudo. And you should cd into your project directory, not qmake dir. You should use qmake from clang_64 folder, like this:
                      @
                      cd /your/project/directory
                      /Qt/5.3/clang_64/bin/qmake -project
                      /Qt/5.3/clang_64/bin/qmake -spec macx-xcode
                      make
                      @

                      (Z(:^

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        JonathanAV95
                        wrote on last edited by
                        #15

                        [quote author="sierdzio" date="1415775064"]No need to use sudo. And you should cd into your project directory, not qmake dir. You should use qmake from clang_64 folder, like this:
                        @
                        cd /your/project/directory
                        /Qt/5.3/clang_64/bin/qmake -project
                        /Qt/5.3/clang_64/bin/qmake -spec macx-xcode
                        make
                        @[/quote]

                        Wow thats remarkably really straightforward lol, never knew that it was that simple! I guess i was simply been overwelmed by the tons of files!

                        anyways when i call the qmake -project i get this error:

                        Project ERROR: Could not resolve SDK path for 'macosx10.8'

                        I'm guessing that Qt SDK is not properly linked to the macosx10.8, or what could it be specifically?

                        1 Reply Last reply
                        0
                        • J Offline
                          J Offline
                          JonathanAV95
                          wrote on last edited by
                          #16

                          [quote author="sierdzio" date="1415775064"]No need to use sudo. And you should cd into your project directory, not qmake dir. You should use qmake from clang_64 folder, like this:
                          @
                          cd /your/project/directory
                          /Qt/5.3/clang_64/bin/qmake -project
                          /Qt/5.3/clang_64/bin/qmake -spec macx-xcode
                          make
                          @[/quote]

                          Wow thats remarkably really straightforward lol, never knew that it was that simple! I guess i was simply been overwelmed by the tons of files!

                          anyways when i call the qmake -project i get this error:

                          Project ERROR: Could not resolve SDK path for 'macosx10.8'

                          I'm guessing that Qt SDK is not properly linked to the macosx10.8, or what could it be specifically?

                          1 Reply Last reply
                          0
                          • sierdzioS Offline
                            sierdzioS Offline
                            sierdzio
                            Moderators
                            wrote on last edited by
                            #17

                            You're on Qt 4.8.6, right? It does not know about OS X 10.10, so I guess that is the problem. Check in Xcode, whether that SDK version is installed (and if it is still available at all).

                            (Z(:^

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #18

                              Qt's properly linked, the thing is that the latest version of Xcode doesn't provide that SDK anymore.

                              IIRC, you only need to update the macx-clang mkspec to use the one you get with your version of Xcode

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • J Offline
                                J Offline
                                JonathanAV95
                                wrote on last edited by
                                #19

                                [quote author="SGaist" date="1415830510"]Qt's properly linked, the thing is that the latest version of Xcode doesn't provide that SDK anymore.

                                IIRC, you only need to update the macx-clang mkspec to use the one you get with your version of Xcode[/quote]

                                What do you mean? i have the latest Qt 5.3 sdk and xCode 6 so is there something i need to do specifically to be able to get what i need working already?

                                1 Reply Last reply
                                0
                                • sierdzioS Offline
                                  sierdzioS Offline
                                  sierdzio
                                  Moderators
                                  wrote on last edited by
                                  #20

                                  SGaist means you may need to modify macx-clang mkspecs (it's a folder inside Qt installation, which holds build configurations for different platforms) so that Qt knows about this new SDK.

                                  (Z(:^

                                  1 Reply Last reply
                                  0

                                  • Login

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved