Results 1 to 11 of 11

Thread: qwt DYLD_LIBRARY_PATH on MacOsX

  1. #1
    Join Date
    Jul 2007
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X

    Default qwt DYLD_LIBRARY_PATH on MacOsX

    Hello
    I ve got some troubles with qwt on Mac OsX. I succesfully install libs and headers in /usr/local/qwt-5.0.2,
    but when I build my project (with xcode making qmake -spec macx-xcode app.pro) i ve got the message:
    dyld: Library not loaded: libqwt.5.dylib
    I guess it is a problem with an environment variable ??
    (I define DYLD_LIBRARY_PATH in my .Bashrc)
    Has anyone has an idea about what i could do ?

  2. #2
    Join Date
    Mar 2006
    Location
    Irvine, CA
    Posts
    11
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qwt DYLD_LIBRARY_PATH on MacOsX

    The only way way I have found to set an environment variable that Xcode knows about is to set it within Xcode itself.

    Assuming you added this to your .pro file before you called qmake to create your Xcode project:
    LIBS += -L/usr/local/qwt/lib -lqwt

    Expand the "Executables" node in the Groups & Files list,
    select your executable, Get Info on it,
    go to the Arguments tab, and manually add
    DYLD_LIBRARY_PATH for the "Name" and
    /usr/local/qwt/lib (or whatever is appropriate for you) for the "Value".

    I have tried all the other methods including .profile and .MacOS environment.plist settings, and could not get Xcode to recognize any of them. Only setting DYLD_LIBRARY_PATH inside Xcode works for me.

    Bad news: you have to do this manually every time you create a new xcode project with qmake -spec macx-xcode. And since Xcode also does not have a way of making C++ files moc'able, you have to create a new xcode project every time you want to add a C++ file or header to your project. Using Xcode with Qt no fun unless you enjoy this kind of brain dead manual labor.

    Since I am brain dead, and really like Qt, I forged on and decided to put the source code for the qwt library in my project directly, which eliminated having to setup DYLD_LIBRARY_PATH manually every time. This works. Use the source, Luke!

    Then I went to the Dark Side. I decided to get rid of qwt all together and just write some simple classes for the technical plotting I need to do. For me personally, sad to say, but this actually is far easier and faster than trying to figure out all these undocumented issues.

    Steve

  3. #3
    Join Date
    Jul 2007
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: qwt DYLD_LIBRARY_PATH on MacOsX

    thanks very much indeed !!!
    I think you almost solve my problem. I do not have anymore the message concerning the
    library not loaded. But i still cannot open my app from the finder. The only way to open
    it is with terminal: open myapp.app
    strange ??

  4. #4
    Join Date
    Mar 2006
    Location
    Irvine, CA
    Posts
    11
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qwt DYLD_LIBRARY_PATH on MacOsX

    Yes, this bug is strange, but that is beside the point. I would more accurately describe it as a curveball.

    Try this:
    1. with ctrl key down, click the mouse on your app and choose "Show Package Contents" from the popup menu.
    2. tunnel into the "Contents" directory, and double-click on "Info.plist". This should launch the Property List Editor application.
    3. Expand the "Root" Property List, and change the Value of CFBundleExecutable to the exact name of your application (without any .app extension). The current Value is probably the name of your application in quotes. Remove the quotes.

    By the way, ignore the NOTE in the Property List that says "Please, do NOT change this file - It was generated by Qt/QMake." This is false bravado.

    Either directly with the Property List Editor or from within Xcode, you should change the original Info.plist file in your project directory that gets copied into your application bundle. This file is the start and source of the bug. Next time you run qmake the problem may be back again of course.

    In general, you may find these links informative on related macintosh matters:
    http://doc.trolltech.com/4.3/deployment-mac.html
    http://doc.trolltech.com/4.3/qtmac-as-native.html
    http://doc.trolltech.com/4.3/mac-differences.html
    http://qtnode.net/wiki?title=Distrib...t_applications

    The bash script at qtnode.net by Thomas Keller is noteworthy.

    Steve

  5. #5
    Join Date
    Jul 2007
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: qwt DYLD_LIBRARY_PATH on MacOsX

    thank you Steve fot this prompt and precise reply and all the references. Actually I still have my problem. As you mentionned i checked the .plist which seems correct as far the Value of CFBundleExecutable is concerned. This is the exact name of my application without any quotes. After building process i cannot open my app by double clicking. Please note that i ve got the same problem even if i don't use xcode i.e. :
    qmake -spec macx-g++ myapp.pro
    make
    what do you think ?

  6. #6
    Join Date
    Mar 2006
    Location
    Irvine, CA
    Posts
    11
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qwt DYLD_LIBRARY_PATH on MacOsX

    Rats... Oh well then.. I don't know. It's been a while since I included qwt, but I do remember I never did like what I had to do to get it to work so I removed it... and never really understood what I was doing.

    I think I wound up modifying the Thomas Keller script (which copies all the libraries into the your application's bundle) to add qwt. If I just wanted to copy the qwt library into my bundle, I would do something like this (you might try it just to see if this fixes your problem):

    // copy library into bundle:
    mkdir DupsApplication.app/Contents/Frameworks
    cp /usr/local/qwt/lib/libqwt.5.dylib DupsApplication.app/Contents/Frameworks/

    // change library:
    install_name_tool -id @executable_path/../Frameworks/libqwt.5.dylib DupsApplication.app/Contents/Frameworks/libqwt.5.lib

    // change executable:
    install_name_tool -change libqwt.5.dylib @executable_path/../Frameworks/libqwt.5.dylib DupsApplication.app/Contents/MacOS/DupsApplication

    Sorry if I am sending you down the wrong road. If there are any MacOS users out there, please chime in. You don't have to be a guru-- just post what little tidbit you know, and maybe all together we can figure out the undocumented truth.

    If particular, if anyone ever figures out how to properly set environment variables so that your MacOS application can use the default Qt and qwt binaries as they are installed in their default locations, please post your findings. I would dearly like to understand this process.

    Steve

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

    dup (17th July 2007)

  8. #7
    Join Date
    Jul 2007
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: qwt DYLD_LIBRARY_PATH on MacOsX

    thank you Steve !!!
    This time it's ok, it is working fine ! I must admit i didn't understood everything
    in the code you gave me, not so easy. I keep working on it and on the references
    you mentionned.
    thanks again
    Nicolas

  9. #8
    Join Date
    Jul 2007
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: qwt DYLD_LIBRARY_PATH on MacOsX

    After long hours on google i found an interesting link for the qwt installation:
    http://www.fhi-berlin.mpg.de/~jochen/Computer/MacTips

    First you define in .MacOS/environment.plist two environment variables CPLUS_INCLUDE_PATH and DYLD_LIBRARY_PATH both set to /usr/local/qwt/lib.
    After that you just change the identification name of the dynamic library with sudo install_name_tool -id /usr/local/qwt/lib/libqwt.5.dylib /usr/local/qwt/lib/libqwt.5.0.0.dylib and it works fine ! No need to define DYLD_LIBRARY_PATH inside xcode and to copy the library in the bundle.

  10. #9
    Join Date
    Nov 2008
    Posts
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11

    Default Re: qwt DYLD_LIBRARY_PATH on MacOsX

    Quote Originally Posted by dup View Post
    After long hours on google i found an interesting link for the qwt installation:
    http://www.fhi-berlin.mpg.de/~jochen/Computer/MacTips

    First you define in .MacOS/environment.plist two environment variables CPLUS_INCLUDE_PATH and DYLD_LIBRARY_PATH both set to /usr/local/qwt/lib.
    After that you just change the identification name of the dynamic library with sudo install_name_tool -id /usr/local/qwt/lib/libqwt.5.dylib /usr/local/qwt/lib/libqwt.5.0.0.dylib and it works fine ! No need to define DYLD_LIBRARY_PATH inside xcode and to copy the library in the bundle.
    Where do you find the ".MacOS/environment.plist" to edit it and add the variable?

    // Sal

  11. #10
    Join Date
    Nov 2008
    Posts
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11

    Default Re: qwt DYLD_LIBRARY_PATH on MacOsX

    Quote Originally Posted by dup View Post
    After long hours on google i found an interesting link for the qwt installation:
    http://www.fhi-berlin.mpg.de/~jochen/Computer/MacTips

    First you define in .MacOS/environment.plist two environment variables CPLUS_INCLUDE_PATH and DYLD_LIBRARY_PATH both set to /usr/local/qwt/lib.
    After that you just change the identification name of the dynamic library with sudo install_name_tool -id /usr/local/qwt/lib/libqwt.5.dylib /usr/local/qwt/lib/libqwt.5.0.0.dylib and it works fine ! No need to define DYLD_LIBRARY_PATH inside xcode and to copy the library in the bundle.
    ok, I created the environment.plist file under my ~/.MacOS/ and then executed the command sudo install_name_tool and when I run my app I get this messg:
    Qt Code:
    1. ../bin/simple.app/Contents/MacOS/simple dyld: Library not loaded: libqwt.5.dylib
    2. Referenced from: /Users/sal/Downloads/qwt-5.1.1/examples/simple_plot/../bin/simple.app/Contents/MacOS/simple
    3. Reason: image not found
    4. Trace/BPT trap
    To copy to clipboard, switch view to plain text mode 

    so I'm probably not doing something right --still. Any advice?

    // Sal

  12. #11
    Join Date
    Jan 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: qwt DYLD_LIBRARY_PATH on MacOsX

    Apparently one should forget about DYLD_LIBRARY_PATH, as it is an unfavourable method for defining library paths on the Mac. It caused no end of conflicts when compiling.

    The following EV are from the gcc users manual and perform the same objective.

    C_INCLUDE_PATH
    CPLUS_INCLUDE_PATH
    LIBRARY_PATH

    Personally, I use the command line, so these variables are defined in my global bash profile (/etc/profile). I use both the C and CPLUS variables just in case the compiler differentiates between the two source code files. Essentially the path is the same for the two variables, i.e.

    # /etc/profile
    export C_INCLUDE_PATH=/paths/to/your:/include/files
    export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH
    export LIBRARY_PATH=/what/ever/you/did:/for/DYLD_LIBRARY_PATH

    Also for posterity, the -I (include) and -L (lib) compiler flags seem to have problems finding required files and libraries on the Mac. But since I adopted the gcc EV I've had absolutely no problems.

    A.

Similar Threads

  1. QWT fails in debug build
    By steg90 in forum Qwt
    Replies: 1
    Last Post: 11th November 2011, 06:53
  2. Qwt 5.0.2
    By Uwe in forum Qt-based Software
    Replies: 1
    Last Post: 20th September 2007, 18:21
  3. How to upgrade Qwt 5.0.1 to Qwt 5.0.2
    By luffy27 in forum Qwt
    Replies: 1
    Last Post: 15th July 2007, 19:55
  4. Qwt 5.0.1
    By Uwe in forum Qt-based Software
    Replies: 0
    Last Post: 26th February 2007, 21:24
  5. use interesting QWT Library with QT3.X
    By raphaelf in forum Qwt
    Replies: 2
    Last Post: 23rd January 2006, 11:24

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.