PDA

View Full Version : Where is QtPrintSupport framework



Gretsch
27th January 2015, 12:40
Just compiled an app on Mac os and I've #included QtPrintSupport and also QT += printsupport but the app crashes with the following message:


dyld: Library not loaded: /Users/norbertszabo/Qt/5.3/clang_64/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport
Referenced from: /usr/lib/libNCReport.2.dylib
Reason: image not found
The program has unexpectedly finished.

I can't find the folder mentioned above in finder, is the library/framework missing from the Qt install or something else ?

Gretsch
27th January 2015, 22:12
Google search for Norbert Szabo appears that he has contributed to the NCReport lib and I think the path may be hard coded in the library, unless I'm wrong ??

jefftee
27th January 2015, 22:44
libNCReport is, I'm sure, from the NCReport library here: https://www.nocisoft.com/ncreport.html. It's not part of the Qt5 distribution and must be referenced by your code or other 3rd party libraries you may be trying to use.

Any of that ring a bell?

If that library path is indeed embedded in libNCReport, you can change the name using the install_name_tool to the correct Qt5 framework on your system, or even better, a relative link to your app bundle (i.e. @rpath/ or @executable_path/../Frameworks, etc).

Gretsch
28th January 2015, 07:35
I'm not sure about that, I found QTPrintSupport.framework in ~/Qt/5.4/clang_64/lib so that tells me Qt is providing print support and NCReport is looking elsewhere for the library.

Anyhow I tried copying the files into /usr/lib but that didn't help. It appears to me that print support has changed in this version of Qt as I didn't have this problem when I last compiled it under Linux 2 years ago.

jefftee
28th January 2015, 07:59
I'm not sure about that, I found QTPrintSupport.framework in ~/Qt/5.4/clang_64/lib so that tells me Qt is providing print support and NCReport is looking elsewhere for the library.
Your problem isn't including print support in your application. Your problem is the NCReport dynamic library has a dependency on the QtPrintSupport library but the dynamic library /usr/lib/libNcReport.2.dylib is looking for and expecting QtPrintSupport to live in a path that doesn't exist on your computer.

Did you look at install_name_tool as I suggested to change the location that /usr/lib/libNCReport.2.dylib is looking for the QtPrintSupport framework?

Run otool -L /usr/lib/libNCReport.2.dylib to see the dependencies that libNCReport has. You can use install_name_tool to then change the path for any Qt framework dependencies to a path that is correct on your system. I suggest when you do this, you use @rpath or @executable_path to prevent from hard coding another path which will also likely not exist on any systems your app is installed on.

Gretsch
28th January 2015, 11:28
OK I ran otool on the NCReport lib and yes I can now see what you're talking about, in fact all references to the Qt library is hard coded.
For now, I did hard coded a new path into libNCReport.

From what I've read, to use @executable_path all the files have to be copied to a Contents/Frameworks folder of my app folder. That means a lot of the Qt library!
Correct me if I'm wrong.

jefftee
28th January 2015, 16:11
From what I've read, to use @executable_path all the files have to be copied to a Contents/Frameworks folder of my app folder. That means a lot of the Qt library!
Correct me if I'm wrong.
macqtdeploy automatically copies the Qt framework and plugins to the bundle, so it's really not hard to do. You should use macqtdeploy to bundle your app, which will ensure your app is distributed with the required version of the Qt framework and allows you to use @executable_path that refers to the framework inside your bundle, which will prevent you from running into compat issues with the installed version of Qt or the situation where the user does not even have Qt installed, etc.

Only downside is it increases the size of your bundle significantly, but not a big deal in today's world IMHO.