Restrictions in creating a plugin - qt

Recently tried the plugin example of Qt.
It didn't work at all and I was confused as to the reason. Then found the solution on one of the forums.
Qt, Application and plugin all three have to be built with the same configuration (Release/Debug)
This works for me as I can build all three in Debug/Release mode. But if I want users to extend my application using plugins I need to provide debug build of my application. (If I provide release build, users will not be able to trouble-shoot the plugin). Qt source is available so it can be built in any mode.
I don't want to provide debug build of my application to users. Is there any work around for this restriction on build mode for plugins?
P.S. I understand users can debug with logging statements, but not sure how many prefer that approach.

This is because Qt has a so called build key which is just a string containing some Qt configuration information, this is documented in the Qt plugin Howto.
So you should just go ahead and provide a debug build of your application for the best results.

You can build debug version (to have compiled in debug configuration) and strip it out of all symbols etc.

Related

Cannot load sqlite.dll with QSQLITE2 Qt plugin

I use QtCreator + mingw.
I have compiled QSQLITE2 plugin. I simply entered plugin directory in Qt source code:
c:\Qt\Qt5.2.0\5.2.0\Src\qtbase\src\plugins\sqldrivers\sqlite
and I built it with my sqlite 2.8.17 that I have locally (as dll and header):
qmake "LIBS+=-Lc:\projects\lib -lsqlite" "INCLUDEPATH+=c:\projects\include"
make
make install
Everything builds okay.
Now, I have another DLL (also implemented as Qt plugin, a custom one), which makes use of QSQLITE2 Qt plugin. My own dll is also linked to sqlite.dll. So it looks like this:
my.dll depends on sqlite.dll
%QT_PLUGINS%\qsqlite2d.dll depends on sqlite.dll
my.dll uses qsqlite2d.dll through Qt's plugin engine
myApp.exe loads my.dll
Problem is that my application cannot load my.dll, because of invalid location access or something like that. I don't know any details and that's the problem.
The sqlite.dll is in the application directory when running it.
When I run application in debug mode, it crashes in some assembly file, but in stack trace I can see that it's somewhere inside sqlite.dll, in sqlite_step symbol. That's all I know.
Note 1) I have another plugin dll, the my3.dll, which uses QSQLITE plugin (it's for sqlite3) and is linked with sqlite3.dll and this one loads just fine. I have compiled QSQLITE plugin myself as well (even there was the one provided with Qt, that's because Qt linked statically to sqlite3 and I wanted it to link dynamically to sqlite3.dll).
Note 2) Both plugins work just fine under Linux.
Any hints what might be wrong? What else can I check?
EDIT:
I've just performed a test: I deleted my.dll from plugins to avoid loading it at all. Then I added code to main.cpp:
QSqlDatabase::addDatabase("QSQLITE2", ":memory:");
Thing is, that it also crashed, with the very same stack trace (at this very line, I debugged it). Thus I think there's something wrong with sqlite2 Qt plugin, but I'm still unable to tell what. I looked up for other sqlite.dll, I just downloaded the one from sqlite.org: http://www.sqlite.org/sqlitedll-2_8_17.zip - so it's official build, but it's the exactly the same file I had and it also fails the same way.
It turned out that qsqlite2d.dll cannot be linked sqlite.dll, because sqlite.dll is not compiled in debug mode. After recompiling application in release mode (thus using qsqlite2.dll, not qsqlite2d.dll), the plugin loads correctly and works.
This makes sense, but just one more thing that bugs me - qsqlited.dll (for sqlite3) had no problem linking with sqlite3.dll. No matter if I compiled debug or release - the single sqlite3.dll worked with both debug and release plugins. Anyone has an idea how is that possible? Please comment if you do, I'd appreciate it.

STS: Losing references in Java Build Path

I am using Spring Source Tool Suite 2.8.1 to implement Spring applications.
I frequently get build errors because references are lost for no apparent reason. In Right-click project in Package Explorer->Properties->Java Build Path->Order and Export, I find projects sometimes are deselected. And often packages are gone in Right-click project in Package Explorer->Properties->Java Build Path->Deployment Assembly.
Having to reset these settings frequently is frustrating. Is there some way I can work around these problems?
I have tried to update STS to the latest version, but the upgrade process fails with incomprehensible error messages. I want to avoid a clean install because setting up the environment again would probably be a nightmare.
Now that I know this is a maven project and you are adding references yourself, this is making sense to me. STS 2.8.x was the last STS to ship with the legacy m2e (maven plugin for Eclipse). It did not recognize build path entries added manually (it likes to have complete control over the classpath). So, what is likely happening is that you are adding these classpath entries and then an update project operation gets kicked off automatically. This will have the effect of removing all of your extra classpath entries.
You are best off doing the following:
Updgrading STS
Or just upgrading your m2e component (you will have to first uninstall the old m2e, but this should be taken care of automatically from the discovery update page).
Or, just accept the fact that you can't manually change your classpath with the legacy m2e.

How to specify build, deployment, and run configuration in a Qt Creator `.pro.shared` file?

I can see from the documentation on https://qt-project.org/doc/qtcreator-2.6/creator-sharing-project-settings.html how to create a .pro.shared file that standardizes Editor settings.
But there's no mention of build configurations, build steps, deployment methods, or run configurations.
I tried just renaming my .pro.user file (which includes custom build, deployment, and run configuration) to .pro.shared, but when I reopened the project, I got the defaults.
What's the right way to specify these settings in a .pro.shared file?
So short answer: You can't. Those settings are the reason why it is a .user file: They reference settings that are specific to one Qt Creator instance.
Long answer: We are moving to support this use case better, 2.6 was a huge step in that direction. With 2.6 you might be able to share build/deploy/run settings, but you need to make sure everybody using that .user file has compatible kits with exactly the same ids. You also need to make sure that everybody is using the same paths to sources, builds, operating system, etc. which limits its use quite a bit.
This might work e.g. with the Qt 5 kit installed by the official Qt 5 packages or with kits created specially for your setup. This will fail in any setup where you do not have tight control over all the development setups! On the other hand: If somebody is using a non-default setup of creator (kits, paths, etc.) then creator will just throw away some or all kit defined in the .user file of the project and will then continue, asking for kits to use. That is exactly what you will get without a .shared/.user file available at all.
Please be aware that as far as I know nobody ever tested such a setup. So you will most likely run into bugs and misbehavior... if you do: Please file bug reports at https://bugreports.qt.io/ ;-)
If you have only one environment you are targeting with your development, then you can get pretty far by having that environment set up (e.g. you only have one compiler/Qt version/kit defined that is exactly what you want everybody to use). Creator will then just default to that one, even if you have no .user file at all.

How to version control a Flex/Flash Builder application's release build files using Subclipse?

I need to store the release build of my Flash Builder (Flex) application in Subversion. When I try to add it to version control via Subclipse I get a warning telling me that I have asked to version control one or more resources that otherwise would have been ignored. Does anyone know why this is happening, and how I can get around it? I've gotten around this one time in the past by adding the build release's directory to the repository using another Subversion client, i.e. outside of Eclipse/Flash Builder, but when I rebuilt the release later I was unable to get Subclipse to see the changes between the base/head revisions and the new local versions of the build release files.
I realize that what I'm doing is non-standard and I suspect that there are default svn:ignore settings someplace which are causing this to happen, but I can't figure out where these are in order to modify/bypass them. Or maybe there's something else going on?
Thanks in advance for any insight and/or help with this issue.
This is an Eclipse-specific feature. Eclipse has a feature where files that are produced by compilers or generates inside Eclipse can be marked in Eclipse as "derived" resources. Eclipse team providers are supposed to ignore these files automatically. AFAIK, that is the only reason the feature exists.
So Subclipse still allows you to manually choose one of these files to version, but it warns you that you selected files that Eclipse said to ignore.
It is possible (but I have no idea) that Flex Builder has some setting to control whether or not it marks these files as derived.

Environment-dependent compilation properties in Flex/AIR

I'm building a Flex/AIR application that connects to a remote server, the URL of which changes depending on the environment (development/production, and possibly others). For now, this URL parameter is hardcoded in my root application MXML file but it means I have to change it everytime I build my app for a different environment.
Is there a way to externalize such a parameter so that when Flash Builder automatically builds my app (in development mode), it uses the development URL (http://localhost...) and when Flash Builder exports a release build, it uses the production URL (http://www.mycompany.com/myapp)?
Flex compiler supports something called Conditional compilation, you an read about it here: link. The problem is that it still doesn't give you an way to check if you're exporting a release build or building for debug. Probably the simplest way to achieve that is to use ANT for compilation of the release build and use the conditional compilation from there.

Resources