Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to tell qmake copy third-party framework to DEST_DIR(.app/Contents/...) on OS X?
Forum Update on Monday, May 27th 2025

How to tell qmake copy third-party framework to DEST_DIR(.app/Contents/...) on OS X?

Scheduled Pinned Locked Moved General and Desktop
os xqmakeframeworkbuild directory
16 Posts 2 Posters 5.5k Views
  • 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.
  • S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 13 Jul 2015, 22:01 last edited by
    #2

    Hi and welcome to devnet,

    Are you trying to deploy your app ? If so you have macdeployqt to help

    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
    • A Offline
      A Offline
      artemskikh
      wrote on 13 Jul 2015, 22:10 last edited by
      #3

      Hi, thanks )
      No, I'm not deploying yet (meaning I'm not trying to distribute it or anything, I might have a different understanding of what "deploying" means, English is not my first language).
      I'm trying to build and run my app on my machine, so far I've only managed to build it. But I get the above mentioned errors when I try to run it.
      In theory, I should add something to the pro file so that some other person on another machine can checkout my git branch, hit build and run and it would work.
      So I (presumably) have to tell qmake to copy the CEF framework into my DEST_DIR.
      But I can't even run it at this point.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 13 Jul 2015, 22:17 last edited by
        #4

        That or modify the CEF framework with install_name_tool to make it more usable while developing.

        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
        • A Offline
          A Offline
          artemskikh
          wrote on 13 Jul 2015, 22:32 last edited by
          #5

          Right. But that other person would then have to do the same thing, right?
          Also, I've found some tips about install_name_tool but I'm not sure how it works, or what it does, rather.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 13 Jul 2015, 22:50 last edited by
            #6

            Yes

            install_name_tool, allows you to alter the paths of the dependencies of your application or library. That allows you to embed frameworks/libraries etc. in your bundle and make your application find them. e.g. @executable_path means that the dependency is found in the same folder as the executable.

            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
            • A Offline
              A Offline
              artemskikh
              wrote on 13 Jul 2015, 23:01 last edited by
              #7

              Well, I kind of get it, but I can't get it to run even without playing with install_name_tool, so that's where my confusion comes from.
              I built the app, and let's say it's in ../bin/myapp.app
              the @executable_path is myapp.app/Contents/MacOS/
              After getting that message on trying to run my app, I thought I'd just copy the CEF framework into the Contents/MacOS/ , and so I did.
              But I still cannot run it with the same mistake. Is there any reason that could happen?
              otool -L myapp gives:
              @executable_path/Chromium Embedded Framework (compatibility version 31979.8.123, current version 31979.8.123)
              otool -L Chromium\ Embedded\ Framework gives:
              @executable_path/Chromium Embedded Framework (compatibility version 31979.8.123, current version 31979.8.123)

              1 Reply Last reply
              0
              • A Offline
                A Offline
                artemskikh
                wrote on 13 Jul 2015, 23:18 last edited by
                #8

                Finally made it work by changing the path to C E F.framework/C E F (did not understand that I have to "go inside .framework" for a while) for myapp.app
                Thanks for the help! )
                Will try to figure out how to properly do it now.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 14 Jul 2015, 22:03 last edited by
                  #9

                  Usually macdeployqt would do that for you. You can also write your own script that call install_name_tool

                  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
                  • A Offline
                    A Offline
                    artemskikh
                    wrote on 15 Jul 2015, 19:52 last edited by SGaist
                    #10

                    Yeap, ended up writing the script for this. Have another question if you don't mind:
                    The script currently runs when qmake runs (which is not good), I wanted to add it to QMAKE_POST_LINK, and it worked great when I only needed the path to script, but then I had to pass my script an argument so I ended up using the system() function of qmake.
                    And it didn't work well, was giving me errors, but worked fine when I removed the QMAKE_POST_LINK +=
                    Anyway, do you have an idea of why something like
                    QMAKE_POST_LINK += system($$PATH_TO_SCRIPT $$SCRIPTARG) wouldn't work and leaving only system($$PATH_TO_SCRIPT $$SCRIPTARG)does?

                    [edit: added coding tags around pro file code SGaist]

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 16 Jul 2015, 14:29 last edited by
                      #11

                      You should use two $ signs when you want to get the content of a variable

                      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
                      • A Offline
                        A Offline
                        artemskikh
                        wrote on 16 Jul 2015, 19:57 last edited by
                        #12

                        Yes, I was doing that, I think when I posted my message the other ones were cut off. So it should work this way? I don't know what might be the problem. $$

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 16 Jul 2015, 21:33 last edited by
                          #13

                          Ok, just remembered: QMAKE_POST_LINK should contain command(s) for the shell in a similar way you would write in a Makefile. So is your script executable ?

                          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
                          • A Offline
                            A Offline
                            artemskikh
                            wrote on 16 Jul 2015, 22:55 last edited by
                            #14

                            Sorry, I'm not big on scripts and the terminology there, it's just a .sh script with a series of commands, like cd [folder] , install_name -change [bla-bla] etc.
                            To make it executable I should return some value at the end or ..?
                            The error I get is:
                            "/bin/sh: -c: line 0: syntax error near unexpected token `"path/to/script"'

                            I also tried QMAKE_POST_LINK += system(sh $$ARG1 $$ARG2) to no avail

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 17 Jul 2015, 21:32 last edited by
                              #15

                              chmod +x name_of_your_script to make it executable.

                              QMAKE_POST_LINK += $$quote($$ARG1 $$ARG2) should do the trick

                              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
                              • A Offline
                                A Offline
                                artemskikh
                                wrote on 23 Jul 2015, 09:33 last edited by
                                #16

                                Thank you, turned out it could be done like this:
                                QMAKE_POST_LINK += $SCRIPT_PATH $ARG1 $ARG2
                                No need for system()

                                1 Reply Last reply
                                0

                                11/16

                                16 Jul 2015, 14:29

                                • Login

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