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. [Solved] Qt on Mac: set the path to find out *.dylib, when run under debug mode.
Forum Update on Monday, May 27th 2025

[Solved] Qt on Mac: set the path to find out *.dylib, when run under debug mode.

Scheduled Pinned Locked Moved General and Desktop
9 Posts 3 Posters 9.9k 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
    szuzsq
    wrote on 26 Oct 2011, 09:49 last edited by
    #1

    I have a test project at:
    @
    $${some_path}/
    @
    it depend upon a dylib at:
    @
    $${some_path}/lib/b.dylib
    @
    and it generated at:
    @
    $${some_path}/bin/test.app
    @

    when I cd to
    @
    $${some_path}/bin/test.app/Contents/MacOS
    @
    and run otool:
    @
    otool -L test
    @
    It ask for
    @
    ./lib/b.dylib (compatibility version 52.0.0, current version 52.122.0)
    @

    so, I must copy
    @
    $${some_path}/lib/b.dylib
    @
    to
    @
    $${some_path}/bin/test.app/Contents/MacOS/b.dylib
    @

    My problem is: How can do? If I don't want to copy the *.dylib, and also to fix the test.app with
    @
    install_name_tool
    @
    Is any way find upon b.dylib, when run debug mode in QtCreator?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      szuzsq
      wrote on 27 Oct 2011, 02:52 last edited by
      #2

      Some times, we have project "test.app" depend upon to "b.dylib".
      But after rebuild "b.dylib", we forget to copy "b.dylib" to "test.app/Contents/MacOS/"

      In msvc2008, we can set the "porject dependencies"
      So, when we try to build porject "a", and the IDE check project a is depend upon project "b", and find some source code of project "b" has been edited,
      in this situation, the IDE build project "b" first and then build project "a".

      I think, that is a good solution.
      But in Qt:
      @
      #all.pro*
      TEMPLATE = subdirs

      SUBDIRS += test
      SUBDIRS += b
      @

      1. I don't know how to set project "test" depend upon to project "b"?
      2. When I run debug "test" project, how to set QtCreator to find out "b.dylib" in itself's output path, but don't need to copy "b.dylib" to "test.app/Contents/MacOS/"?
      1 Reply Last reply
      0
      • R Offline
        R Offline
        rcari
        wrote on 27 Oct 2011, 16:25 last edited by
        #3

        Before running your program you can set the following path variable:
        'export DYLD_LIBRARY_PATH=$${some_path}:$DYLD_LIBRARY_PATH'

        Your application will look for its dependencies in the PATHs set in this colon-separated variable.

        Check the dyld manpages for more information: 'man dyld'

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on 27 Oct 2011, 20:51 last edited by
          #4

          Have a look into install_name_tool, you can change the path to the library with that one. The "Mac Deployment Guide":http://developer.qt.nokia.com/doc/qt-4.7/deployment-mac.html has some examples.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • R Offline
            R Offline
            rcari
            wrote on 28 Oct 2011, 07:44 last edited by
            #5

            [quote author="szuzsq" date="1319622592"]
            My problem is: How can do? If I don't want to copy the *.dylib, and also to fix the test.app with
            @
            install_name_tool
            @
            [/quote]

            Volker, that's precisely what he is trying to avoid from what I understand! It's for debug purposes.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              szuzsq
              wrote on 1 Nov 2011, 07:31 last edited by
              #6

              Yes, thanks all.
              I add the variable in page "Projects/Run Settings/Run Environment":
              DYLD_LIBRARY_PATH=$${some_path}:$DYLD_LIBRARY_PATH

              1 Reply Last reply
              0
              • R Offline
                R Offline
                rcari
                wrote on 1 Nov 2011, 08:02 last edited by
                #7

                Well, I guess you can mark the topic as solved then :)

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  szuzsq
                  wrote on 1 Nov 2011, 08:18 last edited by
                  #8

                  [quote author="rcari" date="1320134557"]Well, I guess you can mark the topic as solved then :)[/quote]

                  yes, yes. but how to do?

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on 1 Nov 2011, 11:32 last edited by
                    #9

                    [quote author="szuzsq" date="1320135515"][quote author="rcari" date="1320134557"]Well, I guess you can mark the topic as solved then :)[/quote]

                    yes, yes. but how to do?[/quote]

                    Just go to the very first post in this thread and click the edit link on the right (just below your avatar and username). And add "[Solved]" to the topic. You can add a tag "solved" too (but others might be quicker with that :-) )

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0

                    1/9

                    26 Oct 2011, 09:49

                    • Login

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