The International Simutrans Forum

Development => Technical Documentation => Topic started by: An_dz on February 26, 2014, 09:10:02 PM

Title: Own compiled Simutrans not running (MinGW problem)
Post by: An_dz on February 26, 2014, 09:10:02 PM
I'm a little unsure of what's wrong, I have MinGW & MSYS installed, all libs compiled and working. I'm running 'make BACKEND=gdi OSTYPE=mingw COLOUR_DEPTH=16'. When I run the executable it crashes even before the window opens. The executable runs a child instance of itself. No modifications in the tree. I'm doing exactly what I did before I changed my HDD.

Executable download (http://simutrans-germany.com/files/upload/sim.7z)
Title: Re: Own compiled Simutrans not running
Post by: TurfIt on February 26, 2014, 10:12:58 PM
Is this a relatively recent MinGW installation - Aug 2013 or later? I ran into a compiler bug last fall that had me try updating my MinGW installation, and that was disastrous. IIRC the code wouldn't even compile, so atleast you are past that. Also IIRC it would crash immediately on startup when using the __argv/c. Changing to _argv/c worked, but MSVC hated that or something. In the end I managed to stick with my older installation using w32api3.x (it was w32api4.x that broke everything I think) and just updated the compiler.

I think Ters had done some further investigation, but I don't think any of the required changes made it into the Simutrans code. So I think the current state is if you want to use MinGW, you need an older installation.
Title: Re: Own compiled Simutrans not running
Post by: An_dz on February 26, 2014, 11:33:53 PM
I'm using an old version of MinGW, I had the same problem before when I tried using an updated version.

I was using w32api4.x and tried downgrading to 3.x but to no avail. I'll try using everything from 2012.
Title: Re: Own compiled Simutrans not running
Post by: An_dz on February 27, 2014, 12:58:51 AM
Yeah, older version worked, thanks for the light of w32api 3.x. Now I'm using:
gcc 4.6.2
w32api 3.17
make 3.82
msys 1.0.17
Title: Re: Own compiled Simutrans not running
Post by: Ters on February 27, 2014, 06:45:43 AM
Quote from: TurfIt on February 26, 2014, 10:12:58 PM
I think Ters had done some further investigation, but I don't think any of the required changes made it into the Simutrans code. So I think the current state is if you want to use MinGW, you need an older installation.

The only solutions are: to not use mingw32's w32api 4.x, or to add some #ifdefs so that one underscore is used with mingw32, and two for everything else. mingw64 is supposed to have more up-to-date header files, and may also not have broken __argc and __argv, but it wasn't so easy to actually find a binary release of mingw64. In fact, the one I found was from another separate project, although one dedicated to making a mingw64 installer. I haven't tried building Simutrans with it yet (mingw64 can also build 32-bit executable, although that appears to require two serarate installations at the moment), but the header is very different when it comes to __argc and __argv.