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 find dynamically linked libraries on a Mac?
Forum Updated to NodeBB v4.3 + New Features

How to find dynamically linked libraries on a Mac?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 980 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.
  • K Offline
    K Offline
    kitfox
    wrote on 17 Apr 2019, 19:31 last edited by kitfox
    #1

    I'm writing a program that links to a third party library. I've already got it working on Windows and am now trying to figure out how to get it to work for Mac. I'm not very familiar with Mac programming.

    Anyhow, I've put my precompiled libraries under $$PWD/thirdParty and added them to my .pro file

    INCLUDEPATH +=thirdParty/ffmpeg/include
    
    win32 {
    LIBS += -L$$PWD/thirdParty/ffmpeg/win32/lib
    LIBS += -lavcodec -lavformat -lavutil -lswscale -lswresample
    }
    
    macx {
    #MacOs specific stuff
    LIBS += -L$$PWD/thirdParty/ffmpeg/macos/bin
    LIBS += -lavcodec.58 -lavformat.58 -lavutil.56 -lswscale.5 -lswresample.3
    }
    

    My thirdParty/ffmpeg/macos/bin directory contains the files

    libavcodec.58.dylib
    libavdevice.58.dylib
    libavfilter.7.dylib
    libavformat.58.dylib
    libavutil.56.dylib
    libpostproc.55.dylib
    libswresample.3.dylib
    libswscale.5.dylib
    

    At the moment, I can link but I cannot run in the debugger. The program crashes:

    1 __abort_with_payload                                                                                                   (x86_64) /usr/lib/dyld  0x100616456 
    2 abort_with_payload_wrapper_internal                                                                                    (x86_64) /usr/lib/dyld  0x100615c4d 
    3 abort_with_payload                                                                                                     (x86_64) /usr/lib/dyld  0x100615c7f 
    4 dyld::halt(const char *)                                                                                               (x86_64) /usr/lib/dyld  0x1005d3aea 
    5 dyld::_main(macho_header const *, unsigned long, int, const char * *, const char * *, const char * *, unsigned long *) (x86_64) /usr/lib/dyld  0x1005d69dd 
    6 dyldbootstrap::start(macho_header const *, int, const char * *, long, macho_header const *, unsigned long *)           (x86_64) /usr/lib/dyld  0x1005d04f6 
    7 _dyld_start                                                                                                            (x86_64) /usr/lib/dyld  0x1005d0036 
    

    On Windows, copying the relevant .dlls into the debug build directory allowed me to run, but doing the same with the .dylib files on mac does not help.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 17 Apr 2019, 20:05 last edited by
      #2

      Hi,

      You can use the DYLD_LIBRARY_PATH environment variable to add folders to the dynamic loader search paths.

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

      K 1 Reply Last reply 17 Apr 2019, 20:17
      0
      • S SGaist
        17 Apr 2019, 20:05

        Hi,

        You can use the DYLD_LIBRARY_PATH environment variable to add folders to the dynamic loader search paths.

        K Offline
        K Offline
        kitfox
        wrote on 17 Apr 2019, 20:17 last edited by
        #3

        @SGaist said in How to find dynamically linked libraries on a Mac?:

        DYLD_LIBRARY_PATH

        I added

        DYLD_LIBRARY_PATH += -L$$PWD/thirdParty/ffmpeg/macos/bin
        

        but that didn't change the error I was getting.

        Also, that might help run in the debugger, but I also need this to run from the command line when its finally ready to deploy. Would you know how to load the libraries in that case?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 17 Apr 2019, 20:21 last edited by
          #4

          You should do that in the Run part of the Project panel. It's not a qmake 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
          1

          1/4

          17 Apr 2019, 19:31

          • Login

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