Results 1 to 8 of 8

Thread: Running QWT Examples in Mac OS X

  1. #1
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Running QWT Examples in Mac OS X

    Hello everyone,

    I'm trying to run the Qwt examples. I've downloaded qwt-6.0.0-rc5 and ran:

    qmake -spec macx-g++
    make
    make install

    The compliation had no errors and built all the examples. However, when I go to the examples/bin directory and try opening any of the examples, I get an error "sinusplot cannot be opened because of a problem...". I made no modifications of the qwtconfig.pri file. I am using Mac OS X with the Qt binary SDK.

    Any help would be greatly appreciated, I'm not too familiar with the Mac OS X build and linking environment.

  2. #2
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Running QWT Examples in Mac OS X

    Just more information from the Problem Report:

    Exception Type: EXC_BREAKPOINT (SIGTRAP)
    Exception Codes: 0x0000000000000002, 0x0000000000000000
    Crashed Thread: 0

    Dyld Error Message:
    Library not loaded: qwt.framework/Versions/6/qwt
    Referenced from: /Users/lynchkp/Desktop/qwt-6.0.0-rc5/examples/bin/radio.app/Contents/MacOS/radio
    Reason: image not found

    Are the libraries being incorrectly installed?

  3. #3
    Join Date
    Sep 2010
    Posts
    35
    Thanks
    5
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Running QWT Examples in Mac OS X

    No, they are correctly installed, they should be in /usr/local/qwt-6.0.0-rc5/lib. But this directory is not in your PATH, therefore the library cannot be loaded on startup of the application. One possibilty is to add this directory to your PATH variable, or you make a softlink:

    sudo ln -s /usr/local/qwt-6.0.0-rc5/lib/qwt.framework/qwt /usr/lib/qwt

  4. #4
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Running QWT Examples in Mac OS X

    Works like a dream! Thanks so much!

  5. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Running QWT Examples in Mac OS X

    Quote Originally Posted by mariposa View Post
    One possibilty is to add this directory to your PATH variable ...
    AFAIK on the Mac it is the DYLD_LIBRARY_PATH variable, but who knows - I have never seen a Mac myself.

    Uwe

  6. #6
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Running QWT Examples in Mac OS X

    Thanks for the help Uwe, I have another question if you dont mind.

    I'm having the same trouble as many other people on this forum have mentioned, I'm not very familiar with dynamic libraries (my background is aerospace engineering not computer programming). I've been able to build my programs using the FFTW and ALGLIB libraries just fine by placing their *.h files in /usr/local/include and including them in my programs. Is this also a valid approach with Qwt, where I can move the header files to that directory as well?

    I've read a few articles about dynamic linking but I've been more confused after reading them. If you have any pertinent advice or a good website regarding it (man ld didn't provide much insight), I'd greatly appreciate it. Once I get it all working, I'll try to put together a consise writeup so people using OS X can jump into it a bit easier.

    Thanks!

  7. #7
    Join Date
    Sep 2010
    Posts
    35
    Thanks
    5
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Running QWT Examples in Mac OS X

    I am not an expert whith respect to dynamic linking, but as far as I know, it is not a good idea to copy all the include files to /usr/local/include, because you will have to repeat that step each time you update them. You should rather specify the path to the include files of the concerning libraries by adding it to the INCLUDEPATH variable in your .pro file:

    INCLUDEPATH *= /path/to/the/headers/of/library1 /path/to/the/headers/of/library2

    You probably also will have to tell the linker to link against the library by adding this line:

    LIBS += -lgsl\
    -lgslcblas

    Here I used the GNU Scientific Library (GSL) as an example. The linker options for your libraries will of course differ.

    To add the Qwt libraries you can use the "CONFIG" variable in your .pro file:

    CONFIG += qwt

    Furthermore you have to tell qmake where the .pri file of qwt is:

    qmake -set QMAKEFEATURES /usr/local/qwt-6.0.0-rc5/features

    These two steps should be sufficient for using qwt.

  8. #8
    Join Date
    Oct 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Running QWT Examples in Mac OS X

    Not sure if I'm making any sloppy mistakes here, but this basic procedure worked for me (Qt 4.7.3, Qwt 6.0.2 svn 1225, examples/curvdemo1), gleaned from http://doc.qt.digia.com/stable/deployment-mac.html.

    Step 1: add Qt libraries as "private frameworks"
    Qt Code:
    1. /Developers/Tools/Qt/macdeployqt examples/bin/curvdemo1.app
    To copy to clipboard, switch view to plain text mode 

    Step 2: add qwt to the app bundle (I think the curvdemo1 binary's dependencies get migrated correctly - i.e., you don't have to run install_name_tool on curvdemo1 - but you can always run this before Step 1 to be sure)
    Qt Code:
    1. cp -R lib/qwt.framework examples/bin/curvdemo1.app/Contents/Frameworks
    To copy to clipboard, switch view to plain text mode 

    Step 3: fix qwt's dependencies (determine by using "otool -L" on qwt)
    Qt Code:
    1. install_name_tool -id @executable_path/../Frameworks/qwt.framework/Versions/6/qwt examples/bin/curvdemo1.app/Contents/Frameworks/qwt.framework/Versions/6/qwt
    2. install_name_tool -change QtSvg.framework/Versions/4/QtSvg @executable_path/../QtSvg.framework/Versions/4/QtSvg examples/bin/curvdemo1.app/Contents/Frameworks/qwt.framework/Versions/6/qwt
    3. # and repeat "install_name_tool -change" line for QtCore and QtGui
    To copy to clipboard, switch view to plain text mode 

    Expected result: user can double click on curvdemo1.app without installing anything on a clean computer

Similar Threads

  1. Qt 4.7.0 compiles all tools and examples, but they all crash on running
    By prophetofreason in forum Installation and Deployment
    Replies: 0
    Last Post: 13th October 2010, 16:32
  2. Problem running QwtPolar examples
    By MSUdom5 in forum Qwt
    Replies: 4
    Last Post: 11th March 2010, 18:26
  3. Prblem in Building and running Examples.
    By Tarun in forum Qt Programming
    Replies: 1
    Last Post: 21st January 2010, 13:45
  4. Running Qt Creator examples
    By Saman in forum Newbie
    Replies: 5
    Last Post: 5th May 2009, 20:21
  5. Replies: 1
    Last Post: 17th May 2006, 00:23

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.