Results 1 to 5 of 5

Thread: Qwt and Mac OSX 10.11.2

  1. #1
    Join Date
    Sep 2009
    Location
    Germany
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qwt and Mac OSX 10.11.2

    Hello,

    has anyone already had success to get Qwt (I'm using the qwt-6.1-multiaxes branch) working with Qt 5.5 under Mac OS X 10.11.2?

    Compilation was no problem, but when I try to start one of the examples, the program crashed with the following output:

    Starting /Users/.../qwt-6.1-multiaxes/examples/bin/sinusplot.app/Contents/MacOS/sinusplot...
    dyld: Library not loaded: libqwt.so.6.3
    Referenced from: /Users/.../qwt-6.1-multiaxes/examples/bin/sinusplot.app/Contents/MacOS/sinusplot
    Reason: image not found

    Ok, so the problem seems to be that the program is not able to find the dylib. Compiling qwt with unmodified qwtconfig.pri produces

    qwt.framework
    qwtmathml.framework

    in /usr/local/qwt-6.3.0-svn/lib.

    Manually setting DYLD_LIBRARY_PATH to /usr/local/qwt-6.3.0-svn/lib does not help.

    I assume, the problem is something related to System Integrity Protection settings?

    Do I have to copy the qwt.framework to another location?

    Also tried using qwt under Ubuntu 15.10, this works flawlessly.

    Any help is greatly appreciated...

  2. #2

    Default Re: Qwt and Mac OSX 10.11.2

    Hello,

    I just compiled qwt-6.1.3 from the svn repository on osx 10.11.2. I modified qwtconfig.pri as follows:

    #QWT_INSTALL_PLUGINS = $$[QT_INSTALL_PREFIX]/plugins/designer
    #QWT_CONFIG += QwtDll
    QWT_CONFIG += QwtPlot
    QWT_CONFIG += QwtWidgets
    #QWT_CONFIG += QwtMathML
    QWT_CONFIG += QwtDesigner
    QWT_CONFIG += QwtExamples
    QWT_CONFIG += QwtPlayground
    macx:!static:CONFIG(qt_framework, qt_framework|qt_no_framework) {

    # QWT_CONFIG += QwtFramework
    }


    (Note that I'm not listing every single option in the config file). I've never had good success with compiling qwt as a framework package, it just never seems to work for me, and I prefer to compile qwt as a static library rather than a dll. Anyway, with a config file like this I was able to compile qwt and run the examples. And of course, to use qwt in your own application you'll have to set the INCLUDEPATH and LIBS appropriately. Hope that helps.

  3. #3
    Join Date
    Sep 2009
    Location
    Germany
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qwt and Mac OSX 10.11.2

    Hello Bob,

    Thank you very much for your reply! But I am still messing around with qwt. After modifying the qwtconfig.pri, I recompiled the qwt project (from within Qt creator, or should I use the command line?). All went ok, and in the output directory are now the following files: libqwt.a and libqwt.prl. So I have compiled qwt as static library.

    I opened the sinusplot example and added the library to the project:

    Qt Code:
    1. macx: LIBS += -L$$PWD/../../../build-qwt-Desktop_Qt_5_5_1_clang_64bit-Debug/lib/ -lqwt
    2.  
    3. DEPENDPATH += $$PWD/../../../build-qwt-Desktop_Qt_5_5_1_clang_64bit-Debug
    4.  
    5. macx: PRE_TARGETDEPS += $$PWD/../../../build-qwt-Desktop_Qt_5_5_1_clang_64bit-Debug/lib/libqwt.a
    To copy to clipboard, switch view to plain text mode 

    Tried to start it, but the program is still complaining "dyld: Library not loaded: libqwt.so.6.3", seems it is expecting a dynamic library.

    Did I miss something? Some kind of settings in the .pro file?

    Please have patience with me, I'm just beginning development with Qt under Max OS X

    I would be grateful for a little bit further assistance,

    Joerg

  4. #4

    Default Re: Qwt and Mac OSX 10.11.2

    Hi Joerg, I'm not sure why it's still looking for a dynamic library. Check that qwtconfig.pri has QWT_CONFIG += QwtDll is commented out, and CONFIG += static added. Then delete the build-*** directories, re-run qmake, and try building it again and see if that fixes it?

    I did some osx development last night, and kept track of what I did to get my app to compile and link on qwt. Let me preface this by saying that I don't usually do much development on OSX. I just work through the compiler and linker errors until I get something to work, so there might be a better way (such as compiling as a framework package perhaps), and I might not be putting some of the commands in the 'best' places - I just hack at files until I get things working and move on.

    First, I'm using these versions
    Qt Code:
    1. Apple 10.11.2
    2. Xcode version 7.2 (7C68)
    3. Apple LLVM version 7.0.2 (clang-700.1.81)
    4. Target x86_64-apple-darwin15.2.0
    5. Thread model: posix
    To copy to clipboard, switch view to plain text mode 

    I modify qwt.pro as follows:
    Qt Code:
    1. CONFIG += c++11
    2. QMAKE_CXXFLAGS_CXX11 = -std=c++14 -stdlib=libc++
    To copy to clipboard, switch view to plain text mode 

    I modify qwtconfig.pri as follows:
    Qt Code:
    1. CONFIG += debug_and_release
    2. CONFIG += static
    3.  
    4. QWT_INSTALL_PLUGINS = $${QWT_INSTALL_PREFIX}/plugins/designer
    5.  
    6. #QWT_CONFIG += QwtDll
    7. QWT_CONFIG += QwtPlot
    8. QWT_CONFIG += QwtWidgets
    9. QWT_CONFIG += QwtSvg
    10. #QWT_CONFIG += QwtOpenGL
    11. #QWT_CONFIG += QwtMathML
    12. #QWT_CONFIG += QwtDesigner
    13. #QWT_CONFIG += QwtExamples # commented out to increase the speed of the build when getting build environment working
    14. #QWT_CONFIG += QwtPlayground # commented out to increase the speed of the build when getting build environment working
    15.  
    16. macx:!static:CONFIG(qt_framework, qt_framework|qt_no_framework) {
    17.  
    18. # QWT_CONFIG += QwtFramework
    19. }
    20.  
    21. unix {
    22.  
    23. #QWT_CONFIG += QwtPkgConfig
    24. }
    To copy to clipboard, switch view to plain text mode 


    Then I build qwt in both Release, and Debug configurations. On windows it will produce both qwt.lib and qwtd.lib with one build because of the debug_and_release flag, but on osx I had to do two separate builds. I copy the build-****/lib/qwt.lib file to the $(QWT_DIR)/lib directory. This is not necessary, I just find this easier to stay organized this way when linking, but you can keep the .lib wherever you want as long as you specify the location properly with the -L linker flag, I use the $QWT_LIB variable defined below. Also note that I had to rename the debug .lib file to qwtd.lib from qwt.lib manually to differentiate it from the release build.


    Now, my applications .pro file looks like the following:

    Qt Code:
    1. QT += core gui
    2.  
    3. CONFIG += c++11
    4. QT += svg
    5. QMAKE_CXXFLAGS_CXX11 = -std=c++14 -stdlib=libc++
    6.  
    7. INCLUDEPATH+=$$(QWT_INCLUDE)
    8. debug:LIBS += -L$$(QWT_LIB) -lqwtd
    To copy to clipboard, switch view to plain text mode 


    I like to use the "Batch Edit" feature to bring in the environment variables. So, for example, for each build configuration/kit go to: Projects->Build Environment->Details->Batch Edit, and add in something like this, modified for the paths on your system of course:

    Qt Code:
    1. BOOST_INCLUDE=C:\Cpp\boost_1_60_0_msvc12_64\
    2. QWT_INCLUDE=C:\Cpp\qwt-6.1\src
    3. QWT_LIB=C:\Cpp\qwt-6.1\lib32
    To copy to clipboard, switch view to plain text mode 


    Anyway, that is what I did to do some coding last night. Like I said, I just hack at files until the errors go away, and I might be making it harder for myself by not going with a dynamic library, or not using a framework package, so there might be better ways, and some of the modifications to the above files might not be necessary. I hope this helps. Cheers.

  5. #5
    Join Date
    Sep 2009
    Location
    Germany
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qwt and Mac OSX 10.11.2

    Hi,

    after having very little time to fiddle around with this subject (work related) I have finally got this thing functional. No chance with the dylib, but statical linking, as Bob had suggested, works.
    Recompiling Qwt requires commenting out

    #QWT_CONFIG += QwtDll

    in the qwtconfig.pri.

    Then, in the application using the static library one has to add the following line in the applications .pro file (change the path to meet your needs):

    LIBS += -L$$PWD/../../../build-qwt-Desktop_Qt_5_6_0_clang_64Bit-Debug/lib/ -lqwt

    Now it should work.

    Regards,

    Joerg

    P.S.: Thank you for your help, Bob.

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.