Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would like to learn the right way, or some neat technique, to discover why a compiled-from-source application just unaccountably quits. I am looking for approach advice, since it it easy enough to discover that the pre-compiled version from Ubuntu does work just fine.
My motivation is to explore, and maybe try to modify it a little for myself.
At my level of programming expertise, I have often used the "sh configure, make, make install" route; and sometimes made small changes to the code eg. changing a window size and similar. C and C++ tutorials teach the main rules, but I am no expert at classes, structures or obscure expression tricks.
The application is a QT type called "qantenna", used for electromagnetic simulation of antennas. The source I downloaded from SourceForge. Although a KDE application, the repository version seems to run just fine on my Ubuntu 9.10 Karmic (soon to become Lucid), on its Gnome desktop.
The compiled version behavior is that the main window opens and runs OK, with the GUI view operating with fully alterable views. As soon as a valid antenna file is loaded, the whole application instantly quits.
How does one deal with an application that gives no chance to catch it doing things wrong?
Sounds like your application is having a "Segmentation Fault", which means there should be a "core" file somewhere in the directory the application was started in (or perhaps your home directory).
You can attempt to analyze the "core" file (not an area of my expertise, I'm afraid), or you can try to run your application within a debugger (something I've had to restore to from time to time).
The core files are disabled by default in most distribution, you have to turn it on, Google can help on that. About gdb, just open the application in gdb, the write run then, once crashed "backtrace". If you compiled the program with debug support, it will print the reference in the code where the application crashed.
You could start the application from a terminal
For more debugging you can use strace
Thanks much for the suggestion. The output from strace is huge! Unfortunately, it also significantly modifies the displayed behavior.
Even so - I can see where strace can be useful.
On a side note, I would check the config.log and output during compilation for any grevious errors. There's probably a library problem somewhere...
Thanks much xeleema
You could be right about the library.
My first try into checking this one out was to simply set it off in a terminal, instead of using a desktop icon launcher. First I cd to the <path>/bin where the executable got made. The result is as follows..
Code:
<path>/bin$ ./qantenna
(QUrl("file:///usr/local/share/doc/qantenna/examples") )
NEC output parser - The file does not exist (Yes - we know! The app has to make it first!)
ASSERT failure in QList<T>::at: "index out of range", file /usr/include/qt4/QtCore/qlist.h, line 395
Aborted
<path>/bin$
// From qlist.h
393 template <typename T>
394 inline const T &QList<T>::at(int i) const
395 { Q_ASSERT_X(i >= 0 && i < p.size(), "QList<T>::at", "index out of range");
396 return reinterpret_cast<Node *>(p.at(i))->t(); }
I guess somewhere in the source code, QList<T> was used, possibly in unwise manner. This does not mean I know what it is, or what to do with it when I find it. This is one of those situations where some major experiences learning GNU Debug and Classes has first to be done. Best way is to get into trying to do it - I think..
// From qlist.h
393 template <typename T>
394 inline const T &QList<T>::at(int i) const
395 { Q_ASSERT_X(i >= 0 && i < p.size(), "QList<T>::at", "index out of range");
396 return reinterpret_cast<Node *>(p.at(i))->t(); }
I'll let you in on a little coding secret; It's (almost) never the line number the program says it is. Usually it's the line right before the line number it reports.
In this case, however, I will definetly have to agree with you; this is quite a bit out of my range (pardon the pun).
I'm half tempted to ask you; Is there a newer version of the source code for what you're compiling out there somewhere?
Perhaps you could recompile and double-check for any errors?
Maybe a kind moderator can move your thread over to Programming?
(I'm not sure if you, as the Original Poster, could move the thread...I've never started a thread here before...)
Maybe a kind moderator can move your thread over to Programming?
Good luck!
Thats OK - its in the right place. The software issue is now with the application creator. I can learn programming in another place.
I have managed to find the originator of the code, and he has had this reported before, though not (so far) been able to reproduce it. We now have some help!
It would seem that the way to deal with programs that suddenly crash is to repeatedly crash them while gathering as many clues as possible using strace, and monitoring the tail of dmesg. Compiling it with debugging symbols option, and using breakpoints at the suspect places will eventually reveal it.
Wait, what? Tailing dmesg? I'm curious, how do you do this?
(A quick copy/paste of the command you use would be most helpful)
I have used it before to monitor the activity of a program, but only as a copied technique. I was able to see the last 10 lines of dmesg continuously updated every second in a terminal, while I was trying to discover what caused a (different) program mal-behavior.
Particularly - note the -f option from.. tail [+ number] [-l] [-b] [-c] [-r] [-f] [-c number | -n number] [file]
It stands for "follow", and will allow the tail command to enter an endless loop updated every second.
You can leave any number of various file tell-tails continuously updating on the desktop, mostly useful ones from /var/log. You can set the number of lines, and the snapshot interval.
It might be something like -
Quote:
~$tail -l 15 -f /var/log/dmesg
The are more clever variants that will only update when there is some new change to show. An example is inotail which is a souped-up version of tail
If you are really a determined log-watch geek, I have also heard of multitail which delivers a many-coloured version that does something like tail, grep, diff, watch all at once.
I should not mislead you folks into thinking I am any kind of expert about tail -f, inotail, or multitail. Its easy enough to make the log monitoring work. The real deal is understanding what you read when they deliver, and knowing what to do about it.
By using a combination of tail -f on logfiles, and watching processes in Gnome System Monitor, and also getting down & dirty with a dev tool called QDevelop running in debug mode, plus an inspired guess from the program maintainer that crucial dependencies may be missing, did finally cure this one.
I should not have got here at all - given that the needed program and library WAS mentioned in the documentation
Installing pre-compiled from the repository just automatically pulls it all in. Trying to run the application without the other program and its library present is what causes the instant crash.
Ah, I see. Most of my systems do not have a /var/log/dmesg file. I was under the assumption someone was able to get 'dmesg' to run and show a constantly updating screen, possibly by using a for-loop like
Thanks much for the suggestion. The output from strace is huge! Unfortunately, it also significantly modifies the displayed behavior.
Even so - I can see where strace can be useful.
You can run your program in one shell, then with the "ps" command find the PID (Process ID Number). Then in a different screen connect to the PID with strace.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.