BlackBerry 10 C-ARES - qt

I am writing an application that uses C-ARES to resolve DNS. The C-ARES library available with the system doesn't support ares_parse_naptr_reply, something that I really need. I tried to compile c-ares as an external library (version 1.9.1, which we use in other platforms such as Android and IOS), but it still doesn't work. I think that the compiler continues to include c-ares system headers first, something that I don't want.
When I run my application, I get this message:
QSocketNotifier: Can only be used with threads started with QThread
and the following code error from C-ARES: 11 (ARES_ECONNREFUSED)
What am I doing wrong? Is there a way to fix this situation? Something to include in the compilation of this library?
Thanks

The problem is now solved! If you ever get this error, please check that ares_init has access to the resolv.conf file of the platform. that was my problem!

Related

QtDbus is not working in Qt5.4.1 on Windows 7

When I run the Qt Creator dbus examples, they couldn't run, is there any settings or stuff for working QtDbus module or any prerequistics?
for example in chat project:
if (!QDBusConnection::sessionBus().isConnected()) {
qWarning("Cannot connect to the D-Bus session bus.\n"
"Please check your system settings and try again.\n");
return 1;
}
returns 1 and program terminated.
Finally I found the solution:
For QtDbus module get working, The 3rd party Dbus module must be installed in Windows:
Dbus Windows Installer Download
After downloading and installing Dbus, it gets working without any configuration. (for working QtDbus, dbus-daemon.exe must be running)
Thankyou, you gave me the clues i needed to get started. However, in order to move with the times and keep this topic up to date...
I am using Qt 5.7.0 and no matter what I tried I could not get dbus v1.4.2 or 1.4.6 from your link to work with Qt.
It seems for Qt 5.7.0 a newer version of DBus is needed (I don't know the technical detail of why this is the case)... luckily I have stumbled across 1.8.10 prebuilt:
http://lists.qt-project.org/pipermail/development/2014-December/019502.html
All credit should go to the original compiler of this package, not to me, but if the link goes down, I will do my best to rehost and update, just drop
me a comment.
All QDBus examples from Qt5.7.0 work out of the box with this version.
For anyone who is inclined to start fiddling with bus addresses, environment variables, config files, etc... try this later build FIRST!
Obviously, this version is just a zip, not an installer - so you need to add the "bin" folder to your $PATH.

QML fails to load

I am a beginner to QML, just wanted to test the Hello WOrld program with it. It fails:
/home/saman# /home/saman/QtSDK/Simulator/Qt/gcc/bin/qmlviewer
Qml debugging is enabled. Only use this in a safe environment!
Cannot find any Simulator supporting Qt version 4.7.4.0.
Aborted
I need to know how to solve it.
It looks like you have not installed the Qt-SDK properly. Try to follow the installation instructions that came with the SDK or install it through your distributions package manager.
Try installing SDK (Qtcreator & Qt Kit) from https://download.qt.io/archive/qt/5.0/5.0.0/ (download required version depending on the platform you are working). This would inturn contain samples & demos which will work flawlessly.
All the best!

Qt debug won't stop on breakpoint

I just installed qt creator sdk and the windows debug thing. When I try to debug the debugger comes with the warning:
Preferred debugger engine for debugging binaries of type 'x86-windows-msys-pe-23bit' is not available.
The debugger engine Cdb engine will be used as a fallback
Details: There is no gdb binary available for binaries in format 'x86-windows-msys-pe-32bit'
Then the program start building.
When I set breakpoints into the program the debugger won't stop at de breakpoints. I've tried a lot of things to let the debugger work properly but nothing has helped so far. If anybody has a suggestion please let me know. I think it maybe has something to do with the compiler I'm using which is something like mingw but i have no idea how to set another compiler or something like that
Since you do not know msys, most likely you do not need the msys compiler, try mingw compiler itself from here.
make sure to install gcc, and gdb.
Since you did not mention I assume it is Windows, as a side note, if gdb gave you headache on Windows please use the mingw version bundled with Code::Blocks it is probably older though (look for the one that comes with mingw bundled).
You need to get either gdb/cdb installed with Qt to be able to debug your code. Try editing the options in Tools->Options in Qt Creator and pointing to correct gdb paths. That should solve this problem. There are other options available there to configure the gdb options in the settings dialog.

How to make Qt aware of the QMYSQL driver

I'm trying to access a MySql database from a Qt application but I get the following error:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QSQLITE2
I find this very strange cause I have libqsqlmysql.so on my Qt folder. I have even tried to compile the MySql driver as a static plugin and add it to my .pro file as:
QTPLUGIN += qsqlmysql
But this also generates the same runtime error (it must've found the plugin cause there's no error compiling the application)
What am I missing? I would like to avoid having to compile Qt from source cause this will have to work seamlessly on the deploy machines as well.
BTW: Even though I'm developing and testing on Linux I will need to support Windows. Will I experience this same issue on Windows? How can I compile and link the MySql driver in both Linux and Windows?
The solution:
After following #Sergey's recommendations I did an strace of the application redirecting the output to grep so I could search for 'mysql' and for my surprise the application wasn't looking for the plugin at QTDIR/plugins/sqldrivers where I had libqsqlmysql.so, it was looking at QTDIR/lib. After copying the plugin to the lib folder the MySql connection worked.
Try opening the shared library with dlopen() and see if it loads and if not, what dlerror() tells you. I always run into similar problems on Windows. LoadLibrary()/GetLastError() saved me numerous times (last time it was because of a wrong version of some libiconv/libintl DLL). Running ldd on the plugin may also help.
If dlopen() works fine, try to load the plugin with QPluginLoader. If it doesn't load, then check the buildkey of the plugin. I usually do it the dirty way by running strings on the plugin and then looking for strings like "buildkey" or "QT_PLUGIN_VERIFICATION_DATA". Just looking at the build key and around it may give you an idea. For example, you may realize that you have compiled your plugin in the release mode while your application is compiled in the debug mode. In such case the build key won't match and the plugin won't load. Everything in the build key must match your configuration. Note that the version and the build key are checked differently: the build key must match exactly (or match some black magic called QT_BUILD_KEY_COMPAT), but in the version only the major version must match exactly, the minor version must be the version of Qt the plugin was compiled with or later and the patch level is ignored. So if your plugin was compiled with Qt 4.x.y then it will work with Qt versions 4.z.* where z>=x. This actually makes sense.
If the build key looks okay (which is unlikely if you got to this point), you may wish to look at QLibraryPrivate::isPlugin() source code to figure out what's wrong, but that doesn't look like an easy task to me (although running this in a debugger may help).
If QPluginLoader does load the plugin, check if it is in the right directory and has correct permissions. If you still didn't solve the problem by this point, it's time to look at the SQL module source code that actually loads these plugins. But it is extremely unlikely. I ran into this problem many, many times and it was always either the library not loading or the build key not matching.
Another way to go after QPluginLoader loads the plugin successfully is to use strace to figure out whether the program at least tries to open the plugin file. Searching for something like "sqldrivers" or "plugins" in the strace output should also give away the directory where Qt is searching for its plugins and specifically SQL drivers.
Update
Is it possible to compile the driver as a static plugin and don't worry about anything? Let's try:
d:\Qt4\src\plugins\sqldrivers\psql>qmake CONFIG+=static LIBS+=-Ld:/programs/Post
greSQL/lib INCLUDEPATH+=d:/programs/PostgreSQL/include
d:\Qt4\src\plugins\sqldrivers\psql>make
It compiles fine and now I got libqsqlpsql.a (release) and libqsqlpsqld.a (debug) in QTDIR/plugins/sqldrivers (it is the right place on Windows). I am using PostgreSQL driver here, but I don't think it will be any different for MySQL which I just don't have installed. Ok, let's compile some real program with it:
d:\alqualos\pr\archserv>qmake QTPLUGIN+=qsqlpsql PREFIX=d:/alqualos LIBS+=-Ld:/g
nu/lib INCLUDEPATH+=d:/gnu/include LIBS+=-Ld:/programs/PostgreSQL/lib LIBS+=-lpq
Note that I had to manually link to libpq, otherwise the linker would complain about undefined references. The funny thing is, qmake knows that qsqlpsql is located in QTDIR/plugins/sqldrivers and sets compiler and linker options accordingly. So it still needs to be in the right place to work, only you don't have to worry about your users running into the same problem as it is only used during compilation. An alternative would be to just use LIBS+=-Lpath/to/plugin LIBS+=-lqsqlpsql instead of QTPLUGIN+=qsqlpsql, at least the docs say that it should work, but I haven't tested it.
In order for the application to actually use the plugin I had to put the following in my main unit (CPP file):
#include <QtPlugin>
Q_IMPORT_PLUGIN(qsqlpsql)
It works! Also, from what I've been able to figure out from the sources, the build key and the version are checked only when a plugin is dynamically loaded (all the relevant stuff is in the QLibrary's private class, not even QPluginLoader's). So the resulting executable may (or may not, depending on the binary compatibility) work even with different versions and builds of Qt, although using it with older versions may trigger some bugs that were fixed later.
It is also worth noting that the order for loading SQL drivers is this: use the driver statically linked into Qt if available, then look for a driver registered manually with QSqlDatabase::registerSqlDriver(), then look for a driver statically imported into the application (the way described above), and finally try to load a shared plugin. So when you link statically, your users won't be able to use dynamically linked drivers they may already have, but will be able to use drivers linked statically into Qt (like in Ubuntu).
I compiled QT first and then realised that I need mysql as well. So I compiled mysql plugin by
executing following command in QT-DIR\src\plugins\sqldrivers\mysql folder.
Mysql plugin compile command
qmake "INCLUDEPATH+=$$quote(C:\Program Files\MySQL\MySQL Server 5.5\include)" "LIBS+=$$quote(C:\Program Files\MySQL\MySQL Server 5.5\lib\libmysql.lib)" mysql.pro
Plugings are then created in created in folder QT-DIR\plugins\sqldrivers.
However, when I tried to use it in my code. It failed with following error.
Error msg
QSqlDatabase: QMYSQLDriver driver not loaded
Solution
After some googling and checking Path variable I realised that the Mysql server lib
( C:\Program Files\MySQL\MySQL Server 5.5\lib) directory was not in my Path variable. I expect that the dll in this folder are used by the plugin at runtime. After including Mysql server lib in Path variable everything worked smoothly. Hope this information saves some hair on other programmers scalp, as I uprooted quite a few. :D
Last time I looked at this you needed to rebuild Qt from source and include the appropriate MySQL source.
Building Qt from the sources is not hard, it just takes a while. You are likely to have the required tools already.
A possible workaround may be to access the back-end over ODBC instead.
In order for your app to pick up the plugin at runtime, the shared library implementing the MySQL plugin needs to be placed in the correct directory. The best way of determining that directory is to check the output of QCoreApplication::libraryPaths. You can also force specific paths by using a qt.conf file.
Please note that plugins must be placed in subdirectories within the plugin path, and the final part of the path name (i.e., the parent directory of the shared libraries) cannot be changed. SQL drivers need to go in a directory named sqldrivers, i.e. <pluginpath>/sqldrivers. For more details on plugin directories, see How to Create Qt Plugins.
I was experiencing this same issue as well. I've been installing and experimenting with a lot of different Python tools and UIs. I then uninstalled everything python related. I did a fresh install of Python 3.2, PyQT 3.2, and Eric5. No more errors with the QMySQL driver.
well i have had this issue, and after a lot of time, and different tools, i found that QT ( on windows, have not been able to test on Linux.) loads the "QSQLMYSQL.." when requested, but before runtime the lib ("QSQLMYSQL..") file must reside on one of the searched paths (QApp.libraryPaths()) inside a folder called "sqldrivers".. otherwise QT will just ignore the file, even if it is at some other point inside the searched path.
what i did was to monitor the dependency of a sample app, and when i removed the "QSQLMYSQL.." dll from "plugins\sqldrivers\" it failed, but when i maded a folder inside the app folder, called "sqldrivers" and placed the "QSQLMYSQL..." inside there, it loaded.
what i have is mysql 5.5, qt 4.7.4.
hope anyone can use this, and if anyone knows more about it, i would like to know where to find it(http://doc.qt.nokia.com/stable/sql-driver.html, is the closest you can get to the information about the folder structur). :P
This may also happen if your QMYSQL plugin is linked against the "wrong" mysql_client.a or it isn't in the LD_LIBRARY_PATH. I had this problem on OSX because mysql was installed via ports, and I fixed it with:
install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient_r.18.dylib libqsqlmysql.dylib

Could not open the editor: Assertion failed:

when i open .mxml flex file in eclipse it gives error
Could not open the editor: Assertion failed:
Does any one know about it
First of all you can give which operating System and version, IDE version, Flex plugin version, detail of error message. You can try ;
Check eclipse and flex plugin version compatibility if you use flex plugin. (If you use Linux operating system flex plugin compatible with eclipse 3.3 ide if not You can try to install flex plugin on eclipse 3.3 if you use 3.4 or 3.5 and so on)
You can download full package of flex ide instead of flex plugin on eclipse
I think its better to stop searching when you are in Flash and Linux. Here in this link its very much transparent. I tried all the fix provided out there, nothing did really worked what new comers are looking for.
Details: http://labs.adobe.com/technologies/flex/flexbuilder_linux/releasenotes.html#sysreq
Note: GUI will never work, which we are thinking and Autocomplete etc will also not work. So Flash and Linux is actually useless and time lose. The best thing is keep reporting Adobe for this. Because they are counting our Linux Vote.
Try changing your current workspace to another one, it helped in my case.
If you have disabled asking for workspace at startup you can change it here:
Window > Preferences > General > Startup and Shutdown
I just got the same error, after moving my project to a new computer. Turns out the build paths needed to be changed in the new computer. After updating those it seemed to fix the problem.
I struggled with this a couple of hours: my own "solution" to this was that I had Eclipse Galilieo / Weblogic 10.3.2 / Windows 7 set up correctly, but was accidently opening an old Eclipse Helios install pointed to the same projects. In other words yes, its likely a slight path difference or a new name for an updated resource along one of your paths. "assertion failed" is such a generic exception that you could get with so many different softwares, that I thought this input wouldnt hurt...

Resources