11-03-2011 08:15 PM
I've been corresponding informally with a QNX person over the last week or so about a problem that has me puzzled as to its origins.
In short, I get errors reported in the Momentics IDE, for C++ files, that do not prevent a successful build, deployment, or execution on a real PlayBook. This is on NDK 1.0, installed on a quad-core desktop running 64-bit Ubuntu 11.04
I have created a number of projects using the "BlackBerry" wizard in the IDE, some as shared libraries, some as apps. All C++. Usually things are fine with a new project for a day or two, and then things start to go bad. I've tried to pinpoint exactly what triggers the bad things to start, and have had a couple of false hopes, but in the end nothing has turned out to be definitive. One thought I had was that projects seem to start going bad from the moment I checked them into a CVS repository (yeah I know CVS is evil, but it's a long-lived local repository that was already in place, and Eclipse has long had CVS as the default choice...don't yell at me for that).
Next thought was, some errors that pop out when launching the IDE, and periodically thereafter. I hadn't really noticed them for a while, because after installing the NDK I created a desktop icon to run the shell that launches the IDE...finally began to take notice when launching from a command window instead. There were no particular symptoms in the running of the IDE, but the startup spits up a bunch of stuff like:
(qde:29055): GdkPixbuf-CRITICAL **: gdk_pixbuf_get_width: assertion `GDK_IS_PIXBUF (pixbuf)' failed
(qde:29055): Gtk-CRITICAL **: IA__gtk_window_resize: assertion `width > 0' failed
/usr/lib/gtk-2.0/2.10.0/menuproxies/libappmenu.so: wrong ELF class: ELFCLASS64
Google turned up a number of issues reported specifically against 64-bit Ubuntu, having to do with a hard-coded library path somewhere in a Linux module, that erroneously results in several modules of the wrong mode being loaded when a 32-bit app is run on a 64-bit system. The file commands reports that the qde process (which the Momentics IDE is), is a 64-bit app. Regardless, I tried adding the following as recommended, to the IDE startup script:
and it seemed to have helped, for a while. The startup errors related to GDK went away, and project errors went away too, at first. But nothing seems to be a permanent fix, and the errors start creeping back.
What kind of errors you might ask...
I'm staring at one right now, where a function call in a .cpp file, is flagged in the IDE with an error icon, and the project has the "X" error icon attached to it. Hovering over the error flag, the error is reported as "Invalid arguments. Candidates are ..." and shows a function prototype that is a generation old. What I mean is, that older prototype existed before I changed it, by adding one parameter to the list. The prototype is defined in a header .hpp file, in a shared library project. The error is in an app .cpp file, which (correctly, it's been verified) references the shared lib for headers and library inclusion.
The strange part is this: the function prototype that the IDE very much wants me to use, is long gone. The header it appeared in has since been edited with a different argument list. It's been cleaned, built, re-cleaned, re-built, and the old prototype does not exist anywhere visible.
Further, the app that reports this error in the IDE builds completely, without reporting errors, from the Clean/Build menu items. Even further, I have deployed it and executed it on a physical PlayBook device. In other words, the code is correct, and the app and the shared lib it references are in complete agreement with each other.
And yet the IDE insists that the app contains an error, that a function call does not match a prototype that no longer exists in the form reported by the IDE.
At various stages this kind of error has gotten worse, especially with a mixture of C and C++ modules, with or without a shared lib being involved. I've had cases where the bbutil.c file, created by the wizard for a C app template, appears to be getting compiled by the IDE, as if it was C++. I was able to demonstrate that a C file was being processed, and yet the symbol __cplusplus was clearly defined during the compilation. This is a definate no-no. But at the same time, even with a multitude of errors reported by the IDE, I could Clean/Build/Run the app with no errors being reported by the non-IDE builder.
I've emailed samples of projects, stripped to bare minimum, to the QNX person mentioned earlier, and so far it has not been reproducable on that side, though it may have only been tried on a 32-bit Ubuntu system, not 64-bit.
There's nothing about the installation that is otherwise remarkable...standard installation of the bbndk1.0, nothing weird going on that I can tell.
And yet these IDE errors seem to start appearing at some point in the life of a project, and never go away...even though they don't prevent a successful build and deployment.
And I have to wonder...has anyone else seen anything remotely like this? Particularly those running 64-bit Ubuntu 10.04?
It is driving me (even more) crazy!
11-04-2011 07:39 AM
11-04-2011 09:35 AM
These errors that are presented show in the margin as little red bug icons, not Xes. Am I right?
If so, it appears that the C/C++ code index is drifting out of date and so the static analysis tooling (CDT's Codan) is working on stale data, reporting these problems.
You can try to remedy this by rebuilding your project's index (context menu "Index -> Rebuild"). Alternatively, disable the code analysis feature by unchecking everything in the "C/C++ -> Code Analysis" preferences.
11-04-2011 10:51 AM
Christian, that is correct, the individual error flags in the margins appear as bug icons, though it propagates upward to the top of the project as "X".
I just did the Index-> Rebuild, and the errors are now gone, so thanks for that tip!
So should I file this as a bug report? I don't think we should have to be manually managing the behind the scenes indexing which is otherwise invisible (until it breaks) ...something internal to the IDE should be keeping things in sync.
11-04-2011 10:57 AM
Yes, by all means, file a bug if this hasn't already been reported to the bug tracker. It's clearly errant behaviour, so whether it can be fixed or not, it should be reported as such.
11-04-2011 11:42 AM
When I loaded in the dosbox project and all the dependencies and compile the project it builds fine without errors, loads and runs on my playbook. After if I open up the one of the projects, for example the TouchControlOverlay dependency project, and open up TouchControlOverlay.cpp the IDE does something and starts showing an error.
I did not recompile anything, it just happens, Is similar to what you see?
What is wierd is the error is on strlen() saying it is invalid however string.h is included in the cpp.