Mingw32 4.6.3 builds but blender.exe crashes

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Posts: 3
Joined: Tue Dec 04, 2012 3:43 am

Mingw32 4.6.3 builds but blender.exe crashes

Postby greatwolf » Mon Dec 24, 2012 5:01 pm

The toolchain I downloaded and am using is from here:
http://sourceforge.net/projects/mingw-w ... z/download

It builds for a 32-bit target and this toolchain is built to use DW2 dwarf unwinding instead of setjump longjump for exception handling.

I downloaded blender's svn with TortoiseSVN and proceed to build it with cmake. I had to make a couple of changes to the blender source for it to be able to compile without errors.


The first change: add_definitions(-D__MINGW64__)

that was added keep extern libmv from redefining sincos in its numerical.h file. This function is already present in mingw's math.h

The second change in GHOST_SystemWin32.cpp is because mingw's definition does agree now, at least the headers supplied by ruben's toolchain does. So I had to comment out that workaround so compile can proceed.

The final change in BLI_winstuff.h is because mingw-w64 uses a different macro guard than mingw. For this I just added both of them in there. I believe this issue came up in the past before but it wasn't clear how best to fix it -- the suggested solution at the time was to just pass -D_SSIZE_T_DEFINED when compiling that file in question.

The external library dependencies used during the linking step is whatever is provided in /lib/mingw32.

I'm able to build blender but the compiled executable would just crash during startup. Blender gets as far as creating the window but none of the GUI elements are drawn before the crash happens. So no menus, no viewport, just a blank gray background window with borders.

I have a backtrace of the crash in gdb if anyone's interested. Any idea why this is happening?

Posts: 8
Joined: Sat Jan 05, 2013 7:54 pm
Location: Brazil

Blender Crashes when building with MinGW 32 and CMake

Postby mcleary » Sun Jan 06, 2013 3:21 pm

I'm having the same problem. I build the blender trunk version and when I run it crashes.
I'm trying to build using Visual Studio 2008 but I found some problems compiling the code.

I'll give feedback if I find anything.
Anyday, anytime, anywhere

Posts: 3645
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Postby stiv » Sun Jan 06, 2013 5:33 pm

Without a stack trace or compiler errors, it is difficult to say anything beyond the standard "graphics driver problems".

Someone was having issues with OpenColorIO crashing on Windows the other day.

Posts: 3
Joined: Tue Dec 04, 2012 3:43 am

Postby greatwolf » Tue Jan 22, 2013 2:08 am

Well I found out the root cause for the crash: Mingw64-32bit compiler comes with it's own pthread named

Code: Select all

. The default cmake build for mingw32 (the original compiler from mingw.org NOT mingw-w64.sourceforge.net) does not include the pthread library so blender's ext comes with it (it's under /lib/mingw32/pthreads of the repo).

Linking pthread that's meant for mingw.org's compiler with mingw64-32 bit from mingw-w64.sourceforge.net does not work since they're not binary compatible.

To fix it I modified the cmake to not link to /lib/mingw32/pthreads but instead to just link with libwinpthread-1.dll. That fixes the crashing issue and the compiled blender seems to work now.

Return to “Coding Blender”

Who is online

Users browsing this forum: No registered users and 0 guests