Results 1 to 9 of 9

Thread: 0.8.1 mingw32 crush when Core is deinit

  1. #1
    Knight
    Join Date
    Feb 2009
    Location
    I looked through my window, there are no signs ... but, its definitely planet Earth.
    Posts
    88

    Default 0.8.1 mingw32 crush when Core is deinit

    Hello,

    I'm new to ClanLib and first I need to say amazing! Keep up the good work! Everything works fine until CL_SetupCore::deinit() is called. I'm using 0.8.1 version of your lib and in TicTacToe game breaks, here's backtrace:

    #0 00403660 CL_OpenGLState_Generic::save(this=0x3f83b8) (opengl_state_generic.cpp:299)
    #1 00414CE5 CL_OpenGLState_Generic::~CL_OpenGLState_Generic(th is=0x3f83b8) (opengl_state_generic.cpp:68)
    #2 00547FCF CL_SharedPtr_Deleter<CL_OpenGLState_Generic, CL_OpenGLState_Generic>::~CL_SharedPtr_Deleter(thi s=0x3f88a8) (../../Sources/API/GL/../Core/System/sharedptr.h:58)
    #3 0041F528 CL_OpenGLState::~CL_OpenGLState(this=0x3f8398) (../../Sources/API/GL/../Core/System/sharedptr.h:187)
    #4 0041FFC0 CL_GLStateChecker::~CL_GLStateChecker(this=0x21800 48) (gl_state_checker.cpp:90)
    #5 0041C219 CL_GraphicContext_OpenGL::~CL_GraphicContext_OpenG L(this=0x3f8150) (graphic_context_opengl.cpp:70)
    #6 004349D0 CL_GraphicContext::~CL_GraphicContext(this=0x3f42f c) (graphic_context.cpp:61)
    #7 004191C7 CL_DisplayWindow_OpenGL::~CL_DisplayWindow_OpenGL( this=0x3f4148) (WGL/display_window_opengl.cpp:79)
    #8 0043E8CE CL_DisplayWindow_Generic::release_ref(this=0x3f414 8) (display_window_generic.cpp:65)
    #9 004271C8 CL_DisplayWindow::~CL_DisplayWindow(this=0x22fe00) (display_window.cpp:90)
    #10 00402065 TicTacToeApp::main(this=0x5d0020) (C:/useful/wxWidgets/samples/projekat ClanLib TicTacToe/TicTacToeApp.cpp:36)
    #11 004027CE WinMain(hInstance=0x400000, hPrevInstance=0x0, lpCmdLine=0x241f2e "", nCmdShow=10) (Win32/clanapp.cpp:84)
    #12 0053FBEA main() (c:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_list.h:1164)

    It breaks on line 299 of opengl_state_generic.cpp which is: state_texture_2d = clIsEnabled(CL_TEXTURE_2D);

    Regards

  2. #2
    Knight
    Join Date
    Feb 2009
    Location
    I looked through my window, there are no signs ... but, its definitely planet Earth.
    Posts
    88

    Default

    ADDITION TO PREVIOUS:

    During compilation there was an error compiler reported, it seemed that boolean type was declared as int instead of unsigned char, so I altered the file and instead of int boolean type was unsined char. Now, I see that inside CL_Core::deinit there are methods that expect this type to be int and 4 bytes. Could this be a source of crash?

    At the time, it seemed logical for me to alter that single file instead all the other files that were based on boolean being unsigned char. I'm having mingw 3.4.5, how's it possible that original mingw include files expect unsigned char for boolean type and your include files expect it to be int?

  3. #3
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Try using the preferred way of initializaing, instead of the static functions:

    // Initialize ClanLib base components
    CL_SetupCore setup_core;

    // Initialize the ClanLib display component
    CL_SetupDisplay setup_display;

    // Initialize the ClanLib GL component
    CL_SetupGL setup_gl;

    // Create a display window
    CL_DisplayWindow window("ClanLib application", 640, 480);

    etc

  4. #4
    Knight
    Join Date
    Feb 2009
    Location
    I looked through my window, there are no signs ... but, its definitely planet Earth.
    Posts
    88

    Default

    Sphair thanks, its working, I assume destructor is doing all the cleaning?

    rpcndr.h file in mingw includes that is used during compilation of ClanLib is having typedef unsigned char boolean, while your files expect typedef int boolean. I had to alter this to be able to compile the lib without errors. Did I do the right thing?

    You tutorial on TicTacToe is using static, so I thought that was ok, I just followed the tutorial.

  5. #5
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    The problem is mostly the order in which things get destructed.

    In what file is the boolean defined? I found some MINGW specifics in API/Core/IOData/datatypes.h. Apparently the same check is missing where the boolean thing is defined.

  6. #6
    Knight
    Join Date
    Feb 2009
    Location
    I looked through my window, there are no signs ... but, its definitely planet Earth.
    Posts
    88

    Default

    rpcndr.h had typedef unsigned char boolean and files related to libjpeg and 3-4 more files had conflicting definition of boolean, they had typedef int boolean instead of boolean type defined in rpcndr.h, so first I altered everything to unsigned char, but yesterday I altered just rpcndr.h to typedef int boolean and recompiled clanLib, deinit was crushing at the same spot. But it seems that when its called through destructor it works fine and it has nothing to do with boolean, my mistake.

    I'm not that good in C++, so I don't understand many things. Its actually a miracle that I even compiled your lib .. I just followed the tutorial and downloaded precompiled patches for mingw from site you're referencing. Its obvious that your framework is targeted for people with poor knowledge of C++ enabling them to focus on developing the game and not coding, which is great and it works in my case. Thank you!

  7. #7

    Default

    hi, I'm getting some compile errors and I chanced across this thread. It has to do with typedefs so it sounds related to this i think.. anyway I hope someone can help me out because there are some aspects of the language that are still mysterious to me!

    Code:
    mkdir Providers/.libs
     i586-mingw32msvc-g++ -DPACKAGE_NAME=\"ClanLib\" -DPACKAGE_TARNAME=\"clanlib\" -DPACKAGE_VERSION=\"0.8.1\" "-DPACKAGE_STRING=\"ClanLib 0.8.1\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"clanlib\" -DVERSION=\"0.8.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DUSE_I386_ASSEMBLER=1 -DHAVE_LIBZ=1 -I. -I. -g -O2 -I../../Sources -MT Providers/jpeg_provider.lo -MD -MP -MF Providers/.deps/jpeg_provider.Tpo -c Providers/jpeg_provider.cpp  -DDLL_EXPORT -DPIC -o Providers/.libs/jpeg_provider.o
    In file included from /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/jpeglib.h:26,
                     from Providers/jpeg_provider_generic.h:53,
                     from Providers/jpeg_provider.cpp:34:
    /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/jmorecfg.h:227: error: conflicting declaration 'typedef int boolean'
    /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/rpcndr.h:52: error: 'boolean' has a previous declaration as 'typedef unsigned char boolean'
    make[2]: *** [Providers/jpeg_provider.lo] Error 1
    as this is the .8.1 release I'm trying to compile I'm sure the problem is somewhere between the keyboard and the chair. It could even be a setting I overlooked.. but I'm out of resource on this one .

    I'm compiling on ubuntu linux for a windows target with mingw, per the excellently specific instructions at http://basic.xullum.net/clanlib/old-index.html (on the 'documentation' page of clanlib.org). Thanks in advance for any advice.

  8. #8
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    This compile error is caused by the libjpeg people having named something Boolean, and then it seems something from Microsoft (or mingw?) also having named something Boolean. The compiler notices they do not agree on what Boolean is supposed to be and aborts the compilation.

    There are basically two ways to solve this problem:

    1) Change libjpeg's source code to name Boolean something else

    or

    2) Figure out how rpcndr.h gets included and avoid this so the compiler only see the jpeg definition in this source file.

  9. #9
    Knight
    Join Date
    Feb 2009
    Location
    I looked through my window, there are no signs ... but, its definitely planet Earth.
    Posts
    88

    Default

    I managed to compile it just by setting typedef boolean in that header file to 'int' instead of 'unsigned char' and everything went well.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •