#93 Win32 Python 2.3 Togl install segfaults

Tk (7)
Mike C. Fletcher

PyOpenGL 2.0.1 will segfault when trying to install
togl 1.6 for Tk 8.4 under Python 2.3. This is because
the tkStubsPtr is a null pointer when togl.c line 726
is executed.


There are two versions of the Tk dll getting
loaded, with the one that actually gets called to
register the DLL not having a reference. This is quite
likely given that there are two versions of the dlls
installed on my machine (and likely anyone who's tried
to build, given the current build instructions).

The Tk instance we're creating hasn't yet been
initialised, for instance via mainloop (or whatever
does it, I've not yet tracked through the Tk code to
find out where that initialisation is supposed to
occur), so it's missing the stub pointers. This seems
less likely, but will look into it tomorrow if the
other approach doesn't pan out.

You know, funny thing is, the entire Togl build and
installation boils down to about 5 lines of commands
once you do all the substitutions and simplify it down
to what actually needs to get done on any *particular*
system. All the togl-setup code really is just
figuring out which libraries to use, which paths to
include, etceteras. Sigh.

Anyway, now that I've got the darn thing building in
debug mode and dropping into a debugger when the error
occurs I'll hopefully be able to track down the cause
tomorrow and have a building PyOpenGL for Python 2.3.


  • Logged In: YES

    Well, as discussed before, this just isn't going to get
    fixed unless someone else steps up to the plate. Marking as
    low priority and no assignation in case someone does want to
    step up.

    • assigned_to: mcfletch --> nobody
    • labels: 338828 --> Tk
    • priority: 8 --> 1
    • status: open --> open-wont-fix
    • assigned_to: nobody --> mcfletch
    • status: open-wont-fix --> closed-fixed
  • Logged In: YES

    I've back-ported the dev-2_1 branch's build_togl command,
    which includes the ability to specify the tcl and tk source
    directories from the command line, and which avoids calling
    the tk buildpkg command to avoid this silly crash.

  • Logged In: NO

    I seem to have a similar problem on Linux Fedora Core 2
    installing Importing Tk crashes python. valgrind reports
    >>> import sys
    >>> from Image import *
    >>> from OpenGL.GL import *
    >>> from OpenGL.Tk import *
    ==19038== Invalid read of size 4
    ==19038== at 0x807AF9F: PyObject_Free (in /usr/bin/python)
    ==19038== by 0x80934CB: (within /usr/bin/python)
    ==19038== by 0x8083221: (within /usr/bin/python)
    ==19038== by 0x80A72BB: (within /usr/bin/python)
    ==19038== Address 0x1B9F8010 is 12 bytes after a block of
    size 12 alloc'd
    ==19038== at 0x1B904A7C: malloc (vg_replace_malloc.c:131)
    ==19038== by 0x44564E: TclpAlloc (in /usr/lib/libtcl8.4.so)
    ==19038== by 0x44BDF8: Tcl_Alloc (in /usr/lib/libtcl8.4.so)
    ==19038== by 0x477EF6: Tcl_GetIndexFromObjStruct (in
    ==19038== Invalid read of size 4
    ==19038== at 0x1C29720E: Togl_Init (togl.c:722)
    ==19038== by 0x48B95F: Tcl_LoadObjCmd (in
    ==19038== by 0x447C04: TclEvalObjvInternal (in
    ==19038== by 0x44858B: Tcl_EvalEx (in /usr/lib/libtcl8.4.so)
    ==19038== Address 0x464 is not stack'd, malloc'd or
    (recently) free'd
    ==19038== Process terminating with default action of signal
    11 (SIGSEGV)
    ==19038== Access not within mapped region at address 0x464
    ==19038== at 0x1C29720E: Togl_Init (togl.c:722)
    ==19038== by 0x48B95F: Tcl_LoadObjCmd (in
    ==19038== by 0x447C04: TclEvalObjvInternal (in
    ==19038== by 0x44858B: Tcl_EvalEx (in /usr/lib/libtcl8.4.so)
    ==19038== ERROR SUMMARY: 11673 errors from 73 contexts
    (suppressed: 235 from 2)
    ==19038== malloc/free: in use at exit: 4700493 bytes in
    31820 blocks.
    ==19038== malloc/free: 103856 allocs, 72036 frees, 26575955
    bytes allocated.
    ==19038== For a detailed leak analysis, rerun with:
    ==19038== For counts of detected errors, rerun with: -v
    and seg faults. Togl1.6 is used. The line it crashes is
    Do you have any changes I might try?
    - Peter

  • Logged In: YES

    Nobody: This is almost certainly an entirely different
    problem than the installer seg-faulting. Only thing I can
    suggest is to check that the Tk/Tcl versions match, as it
    looks like either an attempt to load the wrong .so, or a
    mis-matched header.