Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

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

    General and Desktop
    os x qmake framework build directory
    2
    16
    4323
    Loading More Posts
    • 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.
    • SGaist
      SGaist Lifetime Qt Champion last edited by

      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 Reply Quote 0
      • A
        artemskikh last edited by

        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 Reply Quote 0
        • A
          artemskikh last edited by

          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 Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            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 Reply Quote 0
            • A
              artemskikh last edited by SGaist

              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 Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                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 Reply Quote 0
                • A
                  artemskikh last edited by

                  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 Reply Quote 0
                  • SGaist
                    SGaist Lifetime Qt Champion last edited by

                    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 Reply Quote 0
                    • A
                      artemskikh last edited by

                      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 Reply Quote 0
                      • SGaist
                        SGaist Lifetime Qt Champion last edited by

                        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 Reply Quote 0
                        • A
                          artemskikh last edited by

                          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 Reply Quote 0
                          • First post
                            Last post