Results 1 to 7 of 7

Thread: Dynamic linking on Mac OS X

  1. #1
    Join Date
    Oct 2009
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Dynamic linking on Mac OS X

    Hi,
    although I am not a newbie concerning Qt, I'm a newbie on this forum and as a Mac user.

    I've been trying to run my project (originally developed on Linux), consisted of a couple of shared libraries and a couple of executables on OS X, but the linking fails.
    I (sort of) understood that the libraries are supposed to be in the app bundle, in the Frameworks dir, but I didn't understand how to achieve that.

    Any friendly Mac-using Qt developers around here could give me a hint or two?

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Dynamic linking on Mac OS X

    Have you tried the Qt tool macdeployqt? It will bundle all necessary libraries and frameworks into your application bundle.
    It's nice to be important but it's more important to be nice.

  3. #3
    Join Date
    Oct 2009
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Dynamic linking on Mac OS X

    Quote Originally Posted by axeljaeger View Post
    Have you tried the Qt tool macdeployqt? It will bundle all necessary libraries and frameworks into your application bundle.
    As a matter a fact, I haven't. But, if I understood correctly, this is for deployment purposes.
    Do i need to run macdeployqt on every build while developing?
    Also, as I read the comments... macdeployqt doesn't include custom libraries, the framework only.

  4. #4
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Dynamic linking on Mac OS X

    Ah I see, you already have problems compiling your appilcation. What are the exact error messages you get?
    It's nice to be important but it's more important to be nice.

  5. #5
    Join Date
    Oct 2009
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Dynamic linking on Mac OS X

    Quote Originally Posted by axeljaeger View Post
    Ah I see, you already have problems compiling your appilcation. What are the exact error messages you get?
    Not quite. The projects compile perfectly. First the libraries, then the executables that depend on those libraries (which should mean that the linker finds the libs and links successfully). It's all fine. The app bundles that are created, though, contain only the executables, and nothing more.
    When I try to run the application, it crashes saying (libKtX is one of my libraries the executable depends on):

    dyld: Library not loaded: libKtX.0.dylib
    Reason: image not found

  6. #6
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Dynamic linking on Mac OS X

    Add the directories containing the libraries to DYLD_LIBARY_PATH.
    It's nice to be important but it's more important to be nice.

  7. The following user says thank you to axeljaeger for this useful post:

    Vnuce (20th October 2009)

  8. #7
    Join Date
    Oct 2009
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Dynamic linking on Mac OS X

    Quote Originally Posted by axeljaeger View Post
    Add the directories containing the libraries to DYLD_LIBARY_PATH.
    Set DYLD_LIBRARY_PATH as an env var, right? I did... no good
    Should I restart the machine, or some service in order to take it into account?

    Ok.. setting the DYLD_LIBRARY_PATH as an system-wise env var didn't work, but setting it in project's run settings did the trick. Thanks Axel.
    Last edited by Vnuce; 19th October 2009 at 16:13.

Similar Threads

  1. static & dynamic linking
    By mickey in forum General Programming
    Replies: 6
    Last Post: 11th June 2010, 09:57
  2. Linking Qt in a dynamic library
    By dave_mm0 in forum Qt Programming
    Replies: 4
    Last Post: 18th July 2009, 17:28
  3. Replies: 2
    Last Post: 1st August 2007, 16:04
  4. dynamic linking on mac
    By munna in forum General Discussion
    Replies: 4
    Last Post: 1st January 2007, 19:39
  5. Runtime dynamic linking + Qt4 problem
    By _Ramirez_ in forum Qt Programming
    Replies: 5
    Last Post: 11th February 2006, 15:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.