Segmentation fault of svn build

Hi,

I succeeded in building the current svn revision of avogadro on
Debian lenny, but running the binary ended in a segfault. Please tell
what info I should give to diagnose this. here is the terminal
output:

~$ avogadro
System has OpenGL support.
Locale: "en_US"
Loaded translations (if needed) about to test OpenGL capabilities.
OpenGL capabilities found:
Double Buffering.
Direct Rendering.
Antialiasing.

Found Tool: “Align” - "Align molecules"
Found Tool: “AutoOptimization” - "Automatic Optimization Tool"
Found Tool: “AutoRotate” - "Auto Rotation Tool"
Found Tool: “Bond Centric Manipulate” - "Bond Centric Manipulation
Tool"
Found Tool: “Measure” - "Click to Measure Tool"
Found Tool: “Draw” - "Draws Things"
Found Tool: “Manipulate” - "Manipulation Tool"
Found Tool: “Navigate” - "Navigation Tool"
Found Tool: “Select/Rotate” - "Selection and Rotation Tool"
QGLContext::makeCurrent(): Cannot make invalid context current.
Found Extension: “Animation” - "Animation Plugin"
Found Extension: “ForceField” - "ForceField Plugin"
Found Extension: “GAMESS” - "GAMESS Input Deck Generator"
Found Extension: “Gaussian Input Deck” - "Gaussian input deck
generator"
Found Extension: “H2Methyl” - "H2Methyl Plugin"
Found Extension: “Hydrogens” - "Hydrogens Plugin"
Found Extension: “Orbitals” - "Orbital cube generator"
Found Extension: “Properties” - “Properties Plugin"
initializing python interpreter
"deleteAll.py”
"test.py"
Found Extension: “Python” - "Python helper things"
Found Extension: “Selections” - "Selection Plugin"
Found Extension: “UnitCell” - "Unit Cell Parameters Plugin"
SetMolecule Called!
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
GLWidget initialisation…
GLWidget initialised…
createObjects()
Segmentation fault

Cheers,
Karol


written by Karol Langner
Mon May 26 22:21:44 CEST 2008

Hi,

in order to say anything, a backtrace would be very useful… try running
avogadro in gdb (“gdb avogadro”, then “run”, then “bt” once it crashes).

That said, based on experience with previous crashes: did you install
openbabel and avogadro, or do you just use either of them from the builddir
without installation? Installing helps them find their own plugins – you can
install into some directory of your home dir, so you don’t do a system-wide
install.

Cheers,
Benoit

On Monday 26 May 2008 22:24:59 Karol M. Langner wrote:

Hi,

I succeeded in building the current svn revision of avogadro on
Debian lenny, but running the binary ended in a segfault. Please tell
what info I should give to diagnose this. here is the terminal
output:

~$ avogadro
System has OpenGL support.
Locale: "en_US"
Loaded translations (if needed) about to test OpenGL capabilities.
OpenGL capabilities found:
Double Buffering.
Direct Rendering.
Antialiasing.

Found Tool: “Align” - "Align molecules"
Found Tool: “AutoOptimization” - "Automatic Optimization Tool"
Found Tool: “AutoRotate” - "Auto Rotation Tool"
Found Tool: “Bond Centric Manipulate” - "Bond Centric Manipulation
Tool"
Found Tool: “Measure” - "Click to Measure Tool"
Found Tool: “Draw” - "Draws Things"
Found Tool: “Manipulate” - "Manipulation Tool"
Found Tool: “Navigate” - "Navigation Tool"
Found Tool: “Select/Rotate” - "Selection and Rotation Tool"
QGLContext::makeCurrent(): Cannot make invalid context current.
Found Extension: “Animation” - "Animation Plugin"
Found Extension: “ForceField” - "ForceField Plugin"
Found Extension: “GAMESS” - "GAMESS Input Deck Generator"
Found Extension: “Gaussian Input Deck” - "Gaussian input deck
generator"
Found Extension: “H2Methyl” - "H2Methyl Plugin"
Found Extension: “Hydrogens” - "Hydrogens Plugin"
Found Extension: “Orbitals” - "Orbital cube generator"
Found Extension: “Properties” - “Properties Plugin"
initializing python interpreter
"deleteAll.py”
"test.py"
Found Extension: “Python” - "Python helper things"
Found Extension: “Selections” - "Selection Plugin"
Found Extension: “UnitCell” - "Unit Cell Parameters Plugin"
SetMolecule Called!
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
GLWidget initialisation…
GLWidget initialised…
createObjects()
Segmentation fault

Cheers,
Karol

Another thing:

On Monday 26 May 2008 22:24:59 Karol M. Langner wrote:

QGLContext::makeCurrent(): Cannot make invalid context current.

this is an opengl error, it may or may not matter at all, but it’s important
to know: can you run any opengl app on this system, with this user?

Cheers,
Benoit

On Monday 26 May 2008, Benoît Jacob wrote:

Hi,

in order to say anything, a backtrace would be very useful… try
running avogadro in gdb (“gdb avogadro”, then “run”, then “bt” once
it crashes).

No problem. here goes starting from where I left off:

SetMolecule Called!
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
GLWidget initialisation…
GLWidget initialised…
createObjects()

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2acfcd694580 (LWP 27174)]
0x00002acfca458899 in strstr () from /lib/libc.so.6
(gdb) bt
#0 0x00002acfca458899 in strstr () from /lib/libc.so.6
#1 0x00002acfc8bd0bdf in
Avogadro::TextRendererPrivate::isGLExtensionSupported ()
from /usr/local/lib/libavogadro.so.0
#2 0x00002acfc8bd0c7d in Avogadro::TextRenderer::begin ()
from /usr/local/lib/libavogadro.so.0
#3 0x00002acfc8ba4989 in Avogadro::GLPainter::drawText ()
from /usr/local/lib/libavogadro.so.0
#4 0x00002acfc8b90075 in Avogadro::GLWidget::renderDebugOverlay ()
from /usr/local/lib/libavogadro.so.0
#5 0x00002acfc8b9387e in Avogadro::GLWidget::render ()
from /usr/local/lib/libavogadro.so.0
#6 0x00002acfc8b8ff28 in Avogadro::GLWidget::paintGL ()
from /usr/local/lib/libavogadro.so.0
#7 0x00002acfc8b8fe7e in Avogadro::GLWidget::paintEvent ()
from /usr/local/lib/libavogadro.so.0
#8 0x00002acfc73a33c5 in QWidget::event ()
from /usr/lib/libQtGui.so.4
#9 0x00002acfc6f2d3c8 in QGLWidget::event ()
from /usr/lib/libQtOpenGL.so.4
#10 0x00002acfc8b8fded in Avogadro::GLWidget::event ()
from /usr/local/lib/libavogadro.so.0
#11 0x00002acfc73554df in QApplicationPrivate::notify_helper ()
from /usr/lib/libQtGui.so.4
#12 0x00002acfc735a0b5 in QApplication::notify ()
from /usr/lib/libQtGui.so.4
#13 0x00002acfc822fbd9 in QCoreApplication::notifyInternal ()
from /usr/lib/libQtCore.so.4
#14 0x00002acfc73abb3c in ?? () from /usr/lib/libQtGui.so.4
#15 0x00002acfc73a66a1 in QWidgetPrivate::drawWidget ()
from /usr/lib/libQtGui.so.4
#16 0x00002acfc74ee923 in QWidget::repaint ()
from /usr/lib/libQtGui.so.4
#17 0x00002acfc74eeabb in ?? () from /usr/lib/libQtGui.so.4
#18 0x00002acfc73a31a7 in QWidget::event ()
from /usr/lib/libQtGui.so.4
#19 0x00002acfc6f2d3c8 in QGLWidget::event ()
from /usr/lib/libQtOpenGL.so.4
#20 0x00002acfc8b8fded in Avogadro::GLWidget::event ()
from /usr/local/lib/libavogadro.so.0
#21 0x00002acfc73554df in QApplicationPrivate::notify_helper ()
from /usr/lib/libQtGui.so.4
#22 0x00002acfc735a0b5 in QApplication::notify ()
from /usr/lib/libQtGui.so.4
#23 0x00002acfc822fbd9 in QCoreApplication::notifyInternal ()
from /usr/lib/libQtCore.so.4
#24 0x00002acfc8230efb in QCoreApplicationPrivate::sendPostedEvents ()
from /usr/lib/libQtCore.so.4
#25 0x00002acfc8258b03 in ?? () from /usr/lib/libQtCore.so.4
#26 0x00002acfcb0330f2 in g_main_context_dispatch ()
from /usr/lib/libglib-2.0.so.0
#27 0x00002acfcb036396 in ?? () from /usr/lib/libglib-2.0.so.0
#28 0x00002acfcb03682f in g_main_context_iteration ()
from /usr/lib/libglib-2.0.so.0
#29 0x00002acfc8258dff in QEventDispatcherGlib::processEvents ()
from /usr/lib/libQtCore.so.4
#30 0x00002acfc73de20f in ?? () from /usr/lib/libQtGui.so.4
#31 0x00002acfc822f055 in QEventLoop::processEvents ()
from /usr/lib/libQtCore.so.4
#32 0x00002acfc822f1ab in QEventLoop::exec ()
from /usr/lib/libQtCore.so.4
#33 0x00002acfc82311f9 in QCoreApplication::exec ()
from /usr/lib/libQtCore.so.4
#34 0x0000000000445ff8 in main ()

I can only only speculate what that means exactly. Hope it helps.

That said, based on experience with previous crashes: did you
install openbabel and avogadro, or do you just use either of them
from the builddir without installation? Installing helps them find
their own plugins – you can install into some directory of your
home dir, so you don’t do a system-wide install.

Cheers,
Benoit

I installed both openbabel and avogadro from svn, to /usr/local.

Regards,
Karol


written by Karol Langner
Mon May 26 23:25:26 CEST 2008

On Monday 26 May 2008, Benoît Jacob wrote:

Another thing:

On Monday 26 May 2008 22:24:59 Karol M. Langner wrote:

QGLContext::makeCurrent(): Cannot make invalid context current.

this is an opengl error, it may or may not matter at all, but it’s
important to know: can you run any opengl app on this system, with
this user?

Cheers,
Benoit

Of course, I don’t know why I didn’t think of that since I upgraded
some opengl packages today and forgot to rebuild my nvidia drivers.
After doign that, everything works fine.

Thanks alot for the hint!

  • Karol


written by Karol Langner
Mon May 26 23:40:45 CEST 2008

Hi,

it really is an OpenGL error. Since the crash occured in
isGLExtensionSupported, which is standard code taken from opengl.org, it
can’t be a bug in avogadro. So your problem is that on your system you can’t
use OpenGL.

Can you confirm that other opengl apps also fail to run on you system, with
the same user (the latter point is important)? E.g. glxgears?

Cheers,
Benoit

On Monday 26 May 2008 23:29:20 Karol M. Langner wrote:

On Monday 26 May 2008, Benoît Jacob wrote:

Hi,

in order to say anything, a backtrace would be very useful… try
running avogadro in gdb (“gdb avogadro”, then “run”, then “bt” once
it crashes).

No problem. here goes starting from where I left off:

SetMolecule Called!
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
GLWidget initialisation…
GLWidget initialised…
createObjects()

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2acfcd694580 (LWP 27174)]
0x00002acfca458899 in strstr () from /lib/libc.so.6
(gdb) bt
#0 0x00002acfca458899 in strstr () from /lib/libc.so.6
#1 0x00002acfc8bd0bdf in
Avogadro::TextRendererPrivate::isGLExtensionSupported ()
from /usr/local/lib/libavogadro.so.0
#2 0x00002acfc8bd0c7d in Avogadro::TextRenderer::begin ()
from /usr/local/lib/libavogadro.so.0
#3 0x00002acfc8ba4989 in Avogadro::GLPainter::drawText ()
from /usr/local/lib/libavogadro.so.0
#4 0x00002acfc8b90075 in Avogadro::GLWidget::renderDebugOverlay ()
from /usr/local/lib/libavogadro.so.0
#5 0x00002acfc8b9387e in Avogadro::GLWidget::render ()
from /usr/local/lib/libavogadro.so.0
#6 0x00002acfc8b8ff28 in Avogadro::GLWidget::paintGL ()
from /usr/local/lib/libavogadro.so.0
#7 0x00002acfc8b8fe7e in Avogadro::GLWidget::paintEvent ()
from /usr/local/lib/libavogadro.so.0
#8 0x00002acfc73a33c5 in QWidget::event ()
from /usr/lib/libQtGui.so.4
#9 0x00002acfc6f2d3c8 in QGLWidget::event ()
from /usr/lib/libQtOpenGL.so.4
#10 0x00002acfc8b8fded in Avogadro::GLWidget::event ()
from /usr/local/lib/libavogadro.so.0
#11 0x00002acfc73554df in QApplicationPrivate::notify_helper ()
from /usr/lib/libQtGui.so.4
#12 0x00002acfc735a0b5 in QApplication::notify ()
from /usr/lib/libQtGui.so.4
#13 0x00002acfc822fbd9 in QCoreApplication::notifyInternal ()
from /usr/lib/libQtCore.so.4
#14 0x00002acfc73abb3c in ?? () from /usr/lib/libQtGui.so.4
#15 0x00002acfc73a66a1 in QWidgetPrivate::drawWidget ()
from /usr/lib/libQtGui.so.4
#16 0x00002acfc74ee923 in QWidget::repaint ()
from /usr/lib/libQtGui.so.4
#17 0x00002acfc74eeabb in ?? () from /usr/lib/libQtGui.so.4
#18 0x00002acfc73a31a7 in QWidget::event ()
from /usr/lib/libQtGui.so.4
#19 0x00002acfc6f2d3c8 in QGLWidget::event ()
from /usr/lib/libQtOpenGL.so.4
#20 0x00002acfc8b8fded in Avogadro::GLWidget::event ()
from /usr/local/lib/libavogadro.so.0
#21 0x00002acfc73554df in QApplicationPrivate::notify_helper ()
from /usr/lib/libQtGui.so.4
#22 0x00002acfc735a0b5 in QApplication::notify ()
from /usr/lib/libQtGui.so.4
#23 0x00002acfc822fbd9 in QCoreApplication::notifyInternal ()
from /usr/lib/libQtCore.so.4
#24 0x00002acfc8230efb in QCoreApplicationPrivate::sendPostedEvents ()
from /usr/lib/libQtCore.so.4
#25 0x00002acfc8258b03 in ?? () from /usr/lib/libQtCore.so.4
#26 0x00002acfcb0330f2 in g_main_context_dispatch ()
from /usr/lib/libglib-2.0.so.0
#27 0x00002acfcb036396 in ?? () from /usr/lib/libglib-2.0.so.0
#28 0x00002acfcb03682f in g_main_context_iteration ()
from /usr/lib/libglib-2.0.so.0
#29 0x00002acfc8258dff in QEventDispatcherGlib::processEvents ()
from /usr/lib/libQtCore.so.4
#30 0x00002acfc73de20f in ?? () from /usr/lib/libQtGui.so.4
#31 0x00002acfc822f055 in QEventLoop::processEvents ()
from /usr/lib/libQtCore.so.4
#32 0x00002acfc822f1ab in QEventLoop::exec ()
from /usr/lib/libQtCore.so.4
#33 0x00002acfc82311f9 in QCoreApplication::exec ()
from /usr/lib/libQtCore.so.4
#34 0x0000000000445ff8 in main ()

I can only only speculate what that means exactly. Hope it helps.

That said, based on experience with previous crashes: did you
install openbabel and avogadro, or do you just use either of them
from the builddir without installation? Installing helps them find
their own plugins – you can install into some directory of your
home dir, so you don’t do a system-wide install.

Cheers,
Benoit

I installed both openbabel and avogadro from svn, to /usr/local.

Regards,
Karol

Karol M. Langner wrote:

On Monday 26 May 2008, Benoît Jacob wrote:

Hi,

in order to say anything, a backtrace would be very useful… try
running avogadro in gdb (“gdb avogadro”, then “run”, then “bt” once
it crashes).

No problem. here goes starting from where I left off:

SetMolecule Called!
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
GLWidget initialisation…
GLWidget initialised…
createObjects()

As Benoit said this looks very much like and OpenGL error. It would be
helpful to know what operating system you are using, video card, driver
etc. makeCurrent() should never really fail as then we have no OpenGL
device to render to. It would be good to know if other OpenGL
applications work - for example glxgears on Linux.

Thanks,

Marcus

Karol M. Langner wrote:

On Monday 26 May 2008, Benoît Jacob wrote:

Another thing:

On Monday 26 May 2008 22:24:59 Karol M. Langner wrote:

QGLContext::makeCurrent(): Cannot make invalid context current.

this is an opengl error, it may or may not matter at all, but it’s
important to know: can you run any opengl app on this system, with
this user?

Cheers,
Benoit

Of course, I don’t know why I didn’t think of that since I upgraded
some opengl packages today and forgot to rebuild my nvidia drivers.
After doign that, everything works fine.

Thanks alot for the hint!

That is great to hear - may be we can make some further improvements to
fail a little more gracefully on systems with broken OpenGL though :slight_smile:

Glad you got it working.

Thanks,

Marcus

On Monday 26 May 2008, Marcus D. Hanwell wrote:

Karol M. Langner wrote:

On Monday 26 May 2008, Benoît Jacob wrote:

Hi,

in order to say anything, a backtrace would be very useful…
try running avogadro in gdb (“gdb avogadro”, then “run”, then
"bt" once it crashes).

No problem. here goes starting from where I left off:

SetMolecule Called!
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
GLWidget initialisation…
GLWidget initialised…
createObjects()

As Benoit said this looks very much like and OpenGL error. It would
be helpful to know what operating system you are using, video card,
driver etc. makeCurrent() should never really fail as then we have
no OpenGL device to render to. It would be good to know if other
OpenGL applications work - for example glxgears on Linux.

My system is Debian lenny (testing). The graphic card is GeForce 7300
SE with the recent nVidia Linux x86_64 driver (version 169.12)
installed from source.

That is not important, though, since as I wrote a moment ago,
recompiling the nVidia drivier fixed the problem, which arose becuase
I upgraded some opengl packages in my debian box this morning that
overwrote the nvidia libraries. Before recompiling, of course no
other OpenGL application worked. I checked with xscreensaver, which
did handle the situation more intelligently than avogadro (that is,
blank preview screen instead of crash).

So, to sumamrize, it would be helpful for guys like me if avogadro did
not crash when encountered with broken/mismatched OpenGL libraries -
perhaps a dialog? I honestly thought it was a bug.

If I can help further, please let me know.

All the best,
Karol


written by Karol Langner
Tue May 27 00:19:24 CEST 2008

On Tuesday 27 May 2008 00:33:15 Karol M. Langner wrote:

So, to sumamrize, it would be helpful for guys like me if avogadro did
not crash when encountered with broken/mismatched OpenGL libraries -
perhaps a dialog? I honestly thought it was a bug.

With revision 1442, avogadro now checks for the GL context’s validity at
initialization time. This should cover your case, and according to QtOpenGL
documentation there are more cases where that could be useful.

It outputs to the console, not to a message box; a user who was able to mess
up his opengl setup is also able to look at console output – as you did :wink:

Benoit

On Tuesday 27 May 2008, Benoît Jacob wrote:

On Tuesday 27 May 2008 00:33:15 Karol M. Langner wrote:

So, to sumamrize, it would be helpful for guys like me if
avogadro did not crash when encountered with broken/mismatched
OpenGL libraries - perhaps a dialog? I honestly thought it was a
bug.

With revision 1442, avogadro now checks for the GL context’s
validity at initialization time. This should cover your case, and
according to QtOpenGL documentation there are more cases where that
could be useful.

It outputs to the console, not to a message box; a user who was
able to mess up his opengl setup is also able to look at console
output – as you did :wink:

Fair enough :slight_smile: I will mess up my box intentionally again tommorow and
let you know how it turns out.

  • Karol


written by Karol Langner
Tue May 27 01:36:08 CEST 2008

On Tuesday 27 May 2008, Karol M. Langner wrote:

On Tuesday 27 May 2008, Benoît Jacob wrote:

On Tuesday 27 May 2008 00:33:15 Karol M. Langner wrote:

So, to sumamrize, it would be helpful for guys like me if
avogadro did not crash when encountered with broken/mismatched
OpenGL libraries - perhaps a dialog? I honestly thought it was
a bug.

With revision 1442, avogadro now checks for the GL context’s
validity at initialization time. This should cover your case, and
according to QtOpenGL documentation there are more cases where
that could be useful.

It outputs to the console, not to a message box; a user who was
able to mess up his opengl setup is also able to look at console
output – as you did :wink:

Fair enough :slight_smile: I will mess up my box intentionally again tommorow
and let you know how it turns out.

  • Karol

Better now, with the “Invalid OpenGL context.” message showing up
instead of a segmentation fault.

Cheers!
Karol


written by Karol Langner
Tue May 27 17:08:41 CEST 2008

On May 27, 2008, at 11:08 AM, Karol M. Langner wrote:

It outputs to the console, not to a message box; a user who was
able to mess up his opengl setup is also able to look at console
output – as you did :wink:
Better now, with the “Invalid OpenGL context.” message showing up
instead of a segmentation fault.

Would it be better to at least pop up a QMessageBox to explain the
fault and then exit? This seems like a pretty easy fix. Maybe I’ll try
it, although I don’t have an easy way to test. :slight_smile:

Cheers,
-Geoff

Done in r1447. The message is also tr’ed, and still echoed to qDebug().

Cheers,
Benoit

On Tuesday 27 May 2008 17:42:01 Geoffrey Hutchison wrote:

Would it be better to at least pop up a QMessageBox to explain the
fault and then exit? This seems like a pretty easy fix. Maybe I’ll try
it, although I don’t have an easy way to test. :slight_smile:

Cheers,
-Geoff