mingw32 4.2.1-sjlj cross-compilation and inline-functions

mingw32 4.2.1-sjlj cross-compilation and inline-functions

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
bibim
Lobby Developer
Posts: 959
Joined: 06 Dec 2007, 11:12

mingw32 4.2.1-sjlj cross-compilation and inline-functions

Post by bibim »

When I cross-compile spring using mingw32 4.2.1-sjlj and -finline-functions flag (flag included since r5883), produced binaries crash instantly.

Here is the stacktrace obtained with r5888 when I simply launch spring.exe manually:

Code: Select all

??:0
e:/projects/libogg-1.1/src/bitwise.c:447
WinFileSystemHandler.cpp:0
e:/projects/libogg-1.1/src/bitwise.c:447
e:/projects/libogg-1.1/src/bitwise.c:447
e:/projects/libogg-1.1/src/bitwise.c:447
mingwlibs/include/boost/regex/v4/basic_regex.hpp:255
rts/System/Platform/FileSystem.cpp:281
rts/System/FileSystem/ArchiveScanner.cpp:111
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/bits/basic_string.h:288
rts/System/Platform/FileSystem.cpp:62
rts/System/SpringApp.cpp:166
rts/System/SpringApp.cpp:836
rts/System/Main.cpp:49
rts/System/Main.cpp:111
WinFileSystemHandler.cpp:0
/home/ron/devel/debian/mingw32-runtime/mingw32-runtime-3.13/build_dir/src/mingw-runtime-3.13-20070825-1/crt1.c:237
/home/ron/devel/debian/mingw32-runtime/mingw32-runtime-3.13/build_dir/src/mingw-runtime-3.13-20070825-1/crt1.c:271
??:0
Even unitsync.dll crashes as soon as TASClient tries to use it.

However, cross-compiled binaries for releases < r5883 work fine, as well as cross-compiled binaries for releases >= r5883 if I manually remove the -finline-functions flag.

Finally, any cross-compiled binaries work fine with -finline-functions flag if I use mingw32 3.4.5 .

Any idea on this ?
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: mingw32 4.2.1-sjlj cross-compilation and inline-functions

Post by imbaczek »

borked compiler... try gcc 4.3 if you can; this produces completely broken unitsync, though, at least on Windows.

Looks like you used addr2line - did you use -i option? No windows box handy ATM, but you could also try running under gdb.
User avatar
bibim
Lobby Developer
Posts: 959
Joined: 06 Dec 2007, 11:12

Re: mingw32 4.2.1-sjlj cross-compilation and inline-functions

Post by bibim »

imbaczek wrote:borked compiler... try gcc 4.3 if you can; this produces completely broken unitsync, though, at least on Windows.
The version I use is the latest available on Debian. The mingw32 gcc 4.3 is in alpha state anyway isn't it ? Not sure it worths compiling it if it doesn't compile unitsync correctly neither...
imbaczek wrote:Looks like you used addr2line - did you use -i option? No windows box handy ATM, but you could also try running under gdb.
Here is what I obtain with -i:

Code: Select all

??:0
e:/projects/libogg-1.1/src/bitwise.c:447
WinFileSystemHandler.cpp:0
e:/projects/libogg-1.1/src/bitwise.c:447
e:/projects/libogg-1.1/src/bitwise.c:447
e:/projects/libogg-1.1/src/bitwise.c:447
mingwlibs/include/boost/regex/v4/basic_regex.hpp:255
mingwlibs/include/boost/regex/v4/basic_regex.hpp:293
mingwlibs/include/boost/regex/v4/basic_regex.hpp:268
rts/System/Platform/Win/WinFileSystemHandler.cpp:124
rts/System/Platform/FileSystem.cpp:281
rts/System/FileSystem/ArchiveScanner.cpp:111
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/bits/basic_string.h:288
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include/c++/bits/basic_string.h:483
rts/System/Platform/Win/WinFileSystemHandler.cpp:38
rts/System/Platform/FileSystem.cpp:62
rts/System/SpringApp.cpp:166
rts/System/SpringApp.cpp:836
rts/System/Main.cpp:49
rts/System/Main.cpp:111
WinFileSystemHandler.cpp:0
/home/ron/devel/debian/mingw32-runtime/mingw32-runtime-3.13/build_dir/src/mingw-runtime-3.13-20070825-1/crt1.c:237
/home/ron/devel/debian/mingw32-runtime/mingw32-runtime-3.13/build_dir/src/mingw-runtime-3.13-20070825-1/crt1.c:271
??:0
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: mingw32 4.2.1-sjlj cross-compilation and inline-functions

Post by Tobi »

I removed the flags, not worth the trouble.

I think -finline-functions isn't needed anyway for functions marked 'inline' (as jK suggested).

If I read the docs correctly, -finline-functions considers ALL functions for inlining, not just functions marked 'inline', which are already inlined with -O1 I think (which also enabled -finline-small-functions already)

bibim: GCC 4.3 is released already (somewhere in march IIRC).

EDIT: this is probably what I've seen long time ago already when I was testing sync: GCC 4.3 -O3 crosscompiled binaries segfaulted at start, and -O3 includes -finline-functions. Back then I never bother to figure out which exact flag of -O3 caused this though.

EDIT 2: I guess GCC guys would 'like' it if someone could rip out all of the spring code except the few lines that trigger this compiler bug :-)

EDIT 3: maybe boost regex would need to be compiled with -finline-functions too? (though it seems weird to me if -finline-functions influences ABI)
User avatar
bibim
Lobby Developer
Posts: 959
Joined: 06 Dec 2007, 11:12

Re: mingw32 4.2.1-sjlj cross-compilation and inline-functions

Post by bibim »

Tobi wrote:I removed the flags, not worth the trouble.
It seems the unroll-loops flag was working however, but maybe it could introduce some more silent problems ?
Tobi wrote:bibim: GCC 4.3 is released already (somewhere in march IIRC).
Yeah, but I was speaking about the mingw port of gcc 4.3.
Post Reply

Return to “Engine”