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 Updated to NodeBB v4.3 + New Features

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.6k Views 2 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on 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 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 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
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on 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 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
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on 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 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
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 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 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
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 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 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

                        • Login

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