Build system: compiler flags

Build system: compiler flags

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
abompard
Posts: 19
Joined: 17 Jan 2009, 18:26

Build system: compiler flags

Post by abompard »

Hi guys,

I'm currently packaging up Spring for the Fedora Linux distribution. One of their (I should say our) policies is that all packages must be built with the system's compiler flags (CFLAGS && CXXFLAGS).

I see at line 366 of rts/build/scons/rts.py that you disabled the import of compiler flags from the environment variables:
# Do not do this [use env vars] anymore because it may severely mess up our carefully selected options.
# Print a warning and ignore them instead.
I supposed you had problems with some people using weird compiler flags, but I am quite confident that the Fedora flags are sound.

I'd like to use our flags in our spring package, are you OK with that ?

Thanks
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Build system: compiler flags

Post by imbaczek »

using certain compiler flags can and will lead to desynced multiplayer games due to differing results of floating point calculations between players. you don't want that.
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Re: Build system: compiler flags

Post by Auswaschbar »

a) you should use cmake, which allows you to set all compiler flags you want
b) don't use any flag which affects the FPU (mfpmath, etc.)
c) be sure to use O2
d) use march=i686 for x86 and no march for amd64 build

And we are OK with everything, worst case is that everyone using this package will not be able to play online...
abompard
Posts: 19
Joined: 17 Jan 2009, 18:26

Re: Build system: compiler flags

Post by abompard »

Here are our flags :

Code: Select all

-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables
The only non-complying flag seems to be march=i386. Do you think it would prevent people from playing online ?

And I'll switch to cmake.

Thanks for your help.
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Re: Build system: compiler flags

Post by Auswaschbar »

march=i386 may break the package or may break it not. It is also possible that people with one CPU can play online, while others cannot, I would strongly suggest not using it. Same for mtune.

People with CPU older than i686 cannot play the game anyway.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Build system: compiler flags

Post by imbaczek »

i used to compile with -fstack-protector and it worked fine. -march and -mtune should stay at spring defaults, don't know about the rest (you probably shouldn't touch -O either.)
Post Reply

Return to “Engine”