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.
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:
Code:
macx: LIBS += -L$$PWD/../../../build-qwt-Desktop_Qt_5_5_1_clang_64bit-Debug/lib/ -lqwt
DEPENDPATH += $$PWD/../../../build-qwt-Desktop_Qt_5_5_1_clang_64bit-Debug
macx: PRE_TARGETDEPS += $$PWD/../../../build-qwt-Desktop_Qt_5_5_1_clang_64bit-Debug/lib/libqwt.a
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
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
Code:
Apple 10.11.2
Xcode version 7.2 (7C68)
Apple LLVM version 7.0.2 (clang-700.1.81)
Target x86_64-apple-darwin15.2.0
Thread model: posix
I modify qwt.pro as follows:
Code:
CONFIG += c++11
QMAKE_CXXFLAGS_CXX11 = -std=c++14 -stdlib=libc++
I modify qwtconfig.pri as follows:
Code:
CONFIG += debug_and_release
CONFIG += static
QWT_INSTALL_PLUGINS = $${QWT_INSTALL_PREFIX}/plugins/designer
#QWT_CONFIG += QwtDll
QWT_CONFIG += QwtWidgets
QWT_CONFIG += QwtSvg
#QWT_CONFIG += QwtOpenGL
#QWT_CONFIG += QwtMathML
#QWT_CONFIG += QwtDesigner
#QWT_CONFIG += QwtExamples # commented out to increase the speed of the build when getting build environment working
#QWT_CONFIG += QwtPlayground # commented out to increase the speed of the build when getting build environment working
macx:!static:CONFIG(qt_framework, qt_framework|qt_no_framework) {
# QWT_CONFIG += QwtFramework
}
unix {
#QWT_CONFIG += QwtPkgConfig
}
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:
Code:
QT += core gui
CONFIG += c++11
QT += svg
QMAKE_CXXFLAGS_CXX11 = -std=c++14 -stdlib=libc++
INCLUDEPATH+=$$(QWT_INCLUDE)
debug:LIBS += -L$$(QWT_LIB) -lqwtd
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:
Code:
BOOST_INCLUDE=C:\Cpp\boost_1_60_0_msvc12_64\
QWT_INCLUDE=C:\Cpp\qwt-6.1\src
QWT_LIB=C:\Cpp\qwt-6.1\lib32
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.
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.