PDA

View Full Version : libqwt_designer_plugin.dylib - Not a valid plugin



RobC
14th February 2012, 10:02
Hey folks,

After reading numerous posts, blogs and all sorts, I have finally decided I can't get QWT to work.

I'm running:

Qt Creator 2.0.1
Based on Qt 4.7.0 (64 bit)
Qwt 6.0.1

I've tried just about every suggestion known to man, yet the plugin refuses to work. Doing a search, the only dylib related to qwt seems to be 'libqwt_designer_plugin.dylib', is this right? Does QT log reasons as to why a plugin fails, or is it just down to trail and error?

Uwe
14th February 2012, 19:42
The plugin depends on the Qwt library - so the Creator also depends on it, when it wants to load the plugin. Is your environment ( library search path ) initialized properly when starting the Creator ?

Uwe

RobC
14th February 2012, 21:42
Would one expect there to be a dylib in /usr/local/qt-6.0.1 as well? Otherwise, I guess it just needs to point to the relevant framework directory in /usr/local/qt-6.0.1/lib (/usr/local/qt-6.0.1/lib/qwt.framework)?

I'm shockingly rusty with this stuff these days. Bad times.

RobC
15th February 2012, 14:45
I've set DYLD_LIBRARY_PATH to be /usr/local/qwt-6.0.1/lib/qwt.framework:/usr/local/qwt-6.0.1/lib/qwtmathml.framework, with no real change. :(

RobC
23rd February 2012, 16:56
If I link the libraries like normal, I get:

dyld: Library not loaded: qwt.framework/Versions/6/qwt
Referenced from: /blah....
Reason: image not found

I guess there is a problem with how the libraries are linked?

gedrite
10th March 2012, 23:00
Any progress on this? I have similar problem installing plugin into Qt Designer (I'm not using Qt Creator yet).

I even did as Uwe suggests

qmake
make
sudo make install

(I added sudo part).
I then copied the designer plugin to correct location in Qt, and copied qwt.framework to the Qt lib directory. I'm relatively new to Mac, so I'm sure it is something simple I've missed.

I'm using Qt 4.7.4 built from source on OS X Lion and Qwt 6.0.1

RobC
10th March 2012, 23:56
Hey,

In the end, it looks like permissions were my problem. Not sure how or why, as the install should have no effect, but in the end it just worked.

How does your .pro look?

gedrite
11th March 2012, 00:32
Not sure which .pro you mean (in src of plugin directory). However, I did not make any modifications to my .pro files before I built qwt.

- I started with Qt 4.7.4 from the qt-everywhere-opensource-src-4.7.4.tar.gz download. I built Qt using all default settings, and installed to my /usr/local/ directory so my Qt installation is in /usr/local/Trolltech/Qt-4.7.4 directory.

I then added the the path to my Qt install bin directory to my .bash_profile, so my system knows where my Qt apps are at when working in Terminal.

Qt Designer works fine so far.

- I then downloaded stable version of Qwt 6.0.1. I built and installed it using the following:
qmake -spec macx-g++
make
sudo make install

Qwt is now installed in /usr/local/qwt-6.0.1

I then copied my qwt.framework and qwtmathml.framework from my Qwt install location to my Qt install location, putting them in the lib directory. I guessed I should do this... but don't know for sure. Perhaps I should be specifying this location somewhere else for linker?

I then copied my libqwt_designer_plugin.dylib file to the Trolltech/Qt-4.7.4/plugins/designer directory.

When I run Qt Designer, About Plugins tells me the Qwt plugin is not a valid plugin.

That is all I know to do. I read about people making changes using otool to their libraries, but this is beyond me for now.

Thanks.

gedrite
13th March 2012, 02:20
...
That is all I know to do. I read about people making changes using otool to their libraries, but this is beyond me for now.

Thanks.

Sometimes it helps to talk to myself.

After using otool on my plugin, I've decided that my problem likely has to do with having wrong paths and id's in my plugin for the Qt Creator app bundle, and therefore I need to use otool and install_name_tool to patch things up to work right. Dear God, could this get a bit more complicated please? Yes, the instructions on the Qt site showing how to do this for Qwt5.2.1 are helpful, and I realize this is all for the best to ensure things work right. People complain of DLL Hell on Windows, but there is an equivalent on Mac (at least the burden is on the developer on the Mac, and not the end user). I guess I'm on the Mac learning curve ascent.... hope I make the top.

Question for RobC... what path and file did you set your DYLD_LIBRARY_PATH in? launchd.conf ? Perhaps .profile ?

gedrite
13th March 2012, 04:28
.....
After using otool on my plugin, I've decided that my problem likely has to do with having wrong paths and id's in my plugin for the Qt Creator app bundle, and therefore I need to use otool and install_name_tool to patch things up to work right.
.....

Progress.
I did get the Qwt designer plugin appearing in Qt Creator. There are instructions on this in the Qt Creator help online, but here is a summary of what I did....

Installed Qt SDK.
Built Qwt 6.0.1
Copied libqwt_designer_pligin.dylib from my qwt build into directory Qt Creator.app/Content/Plugins/designer
Copied qwt.framework and qwtmathml.framework from my Qwt build into Qt Creator.app/Content/Frameworks

Now, in my particular case, I had Qt 4.7.4 installed in /usr/local for some reason and built my Qwt against it. Therefore, running otool on my libqwt_designer_plugin.dylib showed paths for my Qt libraries as /usr/local/Trolltech/Qt-4.7.4/lib/....
You may have your libraries installed somewhere else, so you need to run otool on your plugin to get the path locations it is referring to, and substitute them in for my path below. To run otool, cd to the directory containing your plugin. Then issue "otool -L libqwt_designer_plugin.dylib". My command and output was this:

gedrite 38> otool -L libqwt_designer_plugin.dylib
libqwt_designer_plugin.dylib:
libqwt_designer_plugin.dylib (compatibility version 0.0.0, current version 0.0.0)
qwt.framework/Versions/6/qwt (compatibility version 6.0.0, current version 6.0.1)
/usr/local/Trolltech/Qt-4.7.4/lib/QtScript.framework/Versions/4/QtScript (compatibility version 4.7.0, current version 4.7.4)
/usr/local/Trolltech/Qt-4.7.4/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.7.0, current version 4.7.4)
/usr/local/Trolltech/Qt-4.7.4/lib/QtXml.framework/Versions/4/QtXml (compatibility version 4.7.0, current version 4.7.4)
/usr/local/Trolltech/Qt-4.7.4/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.7.0, current version 4.7.4)
/usr/local/Trolltech/Qt-4.7.4/lib/QtDesigner.framework/Versions/4/QtDesigner (compatibility version 4.7.0, current version 4.7.4)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1094.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

Ok, I think this is the exact procedure I used (I've pieced it together after I got everything working).
I issue the next 6 commands to patch up the paths, relative to the executable path:



sudo install_name_tool -change /usr/local/Trolltech/Qt-4.7.4/lib/QtScript.framework/Versions/4/QtScript @executable_path/../Frameworks/QtScript.framework/Versions/4/QtScript libqwt_designer_plugin.dylib

sudo install_name_tool -change /usr/local/Trolltech/Qt-4.7.4/lib/QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore libqwt_designer_plugin.dylib

sudo install_name_tool -change /usr/local/Trolltech/Qt-4.7.4/lib/QtXml.framework/Versions/4/QtXml @executable_path/../Frameworks/QtXml.framework/Versions/4/QtXml libqwt_designer_plugin.dylib

sudo install_name_tool -change /usr/local/Trolltech/Qt-4.7.4/lib/QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui libqwt_designer_plugin.dylib

sudo install_name_tool -change /usr/local/Trolltech/Qt-4.7.4/lib/QtDesigner.framework/Versions/4/QtDesigner @executable_path/../Frameworks/QtDesigner.framework/Versions/4/QtDesigner libqwt_designer_plugin.dylib


Now, I need to patch up my qwt lib in Qt Creator.app/Contents/Frameworks/qwt.framework/Versions/6/ So, in Terminal cd to that location.
Running otool on qwt gives me this:

gedrite 58> otool -L qwt
qwt:
qwt.framework/Versions/6/qwt (compatibility version 6.0.0, current version 6.0.1)
/usr/local/Trolltech/Qt-4.7.4/lib/QtSvg.framework/Versions/4/QtSvg (compatibility version 4.7.0, current version 4.7.4)
/usr/local/Trolltech/Qt-4.7.4/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.7.0, current version 4.7.4)
/usr/local/Trolltech/Qt-4.7.4/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.7.0, current version 4.7.4)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1094.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

To patch it up, I issued these commands:


sudo install_name_tool -id @executable_path/../Frameworks/qwt.framework/Versions/6/qwt qwt

sudo install_name_tool -change /usr/local/Trolltech/Qt-4.7.4/lib/QtSvg.framework/Versions/4/QtSvg @executable_path/../Frameworks/QtSvg.framework/Versions/4/QtSvg qwt

sudo install_name_tool -change /usr/local/Trolltech/Qt-4.7.4/lib/QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui qwt

sudo install_name_tool -change /usr/local/Trolltech/Qt-4.7.4/lib/QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore qwt

Regarding qwtmathml.framework, I am guessing you use the same procedure as you used for qwt, substituting the relevant dependencies of course.

Now I have Qwt appearring in my Designer plugin in Qt Creator. I have not built any apps yet, so no idea if I got it all right.