Compiling spring (mingw and visual studio 7/8) - Page 17

Compiling spring (mingw and visual studio 7/8)

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
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

x:\..\trunk\game\ I guess.
User avatar
Michilus_nimbus
Posts: 634
Joined: 19 Nov 2004, 20:38

Post by Michilus_nimbus »

I'm getting an error building streflop with a fresh checkout :

Code: Select all

scons: Reading SConscript files ...
make -C libm
make[1]: Nothing to be done for `all'.
process_begin: CreateProcess((null), rm -f streflop.a, ...) failed.
make (e=2): Het systeem kan het opgegeven bestand niet vinden.
make: *** [streflop.a] Error 2
Failed building streflop!
Error in English: make (e=2): The system cannot find the file specified.

I've put a dummy streflop.a to get spring compiling, but obviously it fails when linking. It seems like an easy problem to fix, but I'm afraid I'm not really experienced on the subject.

The solver of this problem will be sumptuously rewarded with dates and figs.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

I vaguely remember renaming streflop.a to libstreflop.a by hand.
User avatar
Michilus_nimbus
Posts: 634
Joined: 19 Nov 2004, 20:38

Post by Michilus_nimbus »

Well, I got the streflop.a and libstreflop.a files from buildbot, so it works like a charm now.
Thanks for the help imbaczek.
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post by submarine »

compiling latest svn with vs net 2003, i get the following error (which im not able to fix, i updated the vcproj by adding the new files, deleting old ones though)

D:\Spiele\TA Spring Source\lua\lua\src\lcode.cpp(651): error C3861: 'floor': identifier not found, even with argument-dependent lookup

D:\Spiele\TA Spring Source\lua\lua\src\lcode.cpp(652): error C3861: 'pow': identifier not found, even with argument-dependent lookup

its in
r = luai_nummod(v1, v2); break;
which calls floor(..)

i checked the definition, math.h should be inlcuded, i dont get whats wrong
zizu
Posts: 14
Joined: 12 Jun 2006, 01:51

Post by zizu »

submarine wrote:compiling latest svn with vs net 2003, i get the following error (which im not able to fix, i updated the vcproj by adding the new files, deleting old ones though)

D:\Spiele\TA Spring Source\lua\lua\src\lcode.cpp(651): error C3861: 'floor': identifier not found, even with argument-dependent lookup

D:\Spiele\TA Spring Source\lua\lua\src\lcode.cpp(652): error C3861: 'pow': identifier not found, even with argument-dependent lookup

its in
r = luai_nummod(v1, v2); break;
which calls floor(..)

i checked the definition, math.h should be inlcuded, i dont get whats wrong
The problem is that streflop excludes the standard library math routines.
The developers have changed most instances of ├óÔé¼┼ô#include <math.h>├óÔé¼┬Ø to ├óÔé¼┼ô#include "float3.h"├óÔé¼┬Ø but apparently missed this one.

Patch:

Code: Select all

Index: lua/lua/include/luaconf.h
===================================================================
--- lua/lua/include/luaconf.h	(revision 3767)
+++ lua/lua/include/luaconf.h	(working copy)
@@ -531,7 +531,9 @@
 @@ The luai_num* macros define the primitive operations over numbers.
 */
 #if defined(LUA_CORE)
-#include <math.h>
+//SPRING#include <math.h>
+#include "float3.h"
+
 #define luai_numadd(a,b)	((a)+(b))
 #define luai_numsub(a,b)	((a)-(b))
 #define luai_nummul(a,b)	((a)*(b))
Index: rts/lib/streflop/Math.cpp
===================================================================
--- rts/lib/streflop/Math.cpp	(revision 3767)
+++ rts/lib/streflop/Math.cpp	(working copy)
@@ -3,33 +3,31 @@
 
 namespace streflop {
 
-	// MSVC chokes on these constants,
-	// TODO: we need another way to specify them. (hardcode the bitpattern?)
-#ifndef _MSC_VER
-
     // Constants
 
-    const Simple SimplePositiveInfinity = Simple(1.0f) / Simple(0.0f);
-    const Simple SimpleNegativeInfinity = Simple(-1.0f) / Simple(0.0f);
+    const Simple SimpleZero(0.0f);
+    const Simple SimplePositiveInfinity = Simple(1.0f) / SimpleZero;
+    const Simple SimpleNegativeInfinity = Simple(-1.0f) / SimpleZero;
     // TODO: non-signaling version
     const Simple SimpleNaN = SimplePositiveInfinity + SimpleNegativeInfinity;
 
-    const Double DoublePositiveInfinity = Double(1.0f) / Double(0.0f);
-    const Double DoubleNegativeInfinity = Double(-1.0f) / Double(0.0f);
+    const Double DoubleZero(0.0f);
+    const Double DoublePositiveInfinity = Double(1.0f) / DoubleZero;
+    const Double DoubleNegativeInfinity = Double(-1.0f) / DoubleZero;
     // TODO: non-signaling version
     const Double DoubleNaN = DoublePositiveInfinity + DoubleNegativeInfinity;
 
 // Extended are not always available
 #ifdef Extended
 
-    const Extended ExtendedPositiveInfinity = Extended(1.0f) / Extended(0.0f);
-    const Extended ExtendedNegativeInfinity = Extended(-1.0f) / Extended(0.0f);
+    const Extended ExtendedZero(0.0f);
+    const Extended ExtendedPositiveInfinity = Extended(1.0f) / ExtendedZero;
+    const Extended ExtendedNegativeInfinity = Extended(-1.0f) / ExtendedZero;
     // TODO: non-signaling version
     const Extended ExtendedNaN = ExtendedPositiveInfinity + ExtendedNegativeInfinity;
 
 #endif
 
-#endif // _MSC_VER
 
 
     // Default environment. Initalized to 0, and really set on first access

submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post by submarine »

compiling with vs.net 2003 seems to work, now i get a linker error

"rts fatal error LNK1104: cannot open file '../zlib/lib/zlib.lib'"

-> i added "../../../crashrpt/zlib/lib" and "../../../crashrpt" to the linker paths (since the file mentioned is located at ../../../crashrpt/zlib/lib/zlib.lib but this doesnt solve the issue. i also added "zlib.lib" to the list of additional dependencies (tried ../../../crashrpt/zlib/lib/zlib.lib as well)
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Post by ivand »

Hi, guys!

Sorry for stupid question, but I wonder if it's possible to build /trunk version of Spring. I've tried, but I've got lots of errors because of wrong file location or unresolved externals... Could someone explain me the /trunk purpose and how to use it, and if it's possible to build it could you please spare me correct rts.vsproj!

P.S. My compiler is MSVC7.1 and I've build /tags/taspring_0.74b3 successfully, So it's not about missing libraries.

Thanks in advance!
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

ivand, you need the vclibs package, read the start of this sticky.

submarine, in VS you cant just stick a path on the start of a library filename when its expecting a filename. Remove the ..\ stuff and add the folder path to the list of folders it looks in so your referencing zlib.lib not ..\libs\zlib\zlib.lib etc.
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Post by ivand »

AF wrote:ivand, you need the vclibs package, read the start of this sticky.

submarine, in VS you cant just stick a path on the start of a library filename when its expecting a filename. Remove the ..\ stuff and add the folder path to the list of folders it looks in so your referencing zlib.lib not ..\libs\zlib\zlib.lib etc.
AF, as I wrote before it's not because of missing VCLIBS, I've managed to compile any /tags/* version, so i do know about additional libs...

The compiler whines because some Lua source files have been referenced wrong in rts.vcproj: some of them actually missing in specified location or pointing to wrong directories.

For instance:
These files are referenced in rts.vcproj (for 7.1):

Code: Select all

"..\..\Lua\LuaConstSpring.h"
"..\..\Lua\LuaConstSpring.cpp"
But there are no such files in /trunk at all.

Am I doing something wrong?

Any useful advice would be great.
Last edited by ivand on 07 Jul 2007, 04:35, edited 1 time in total.
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Post by ivand »

I've just tried to compile /trunk using MSVC2005 and "rts\build\vstudio8\rts.vcproj" accordingly. So what can I say? It's NOT as broken as "rts\build\vstudio7\rts.vcproj" is, but it's also doesn't compile with the errors like those below:

Code: Select all

Error	57	error LNK2001: unresolved external symbol "public: static class creg::ClassBinder CUnitSet::binder" (?binder(at)CUnitSet(at)(at)2VClassBinder(at)creg(at)(at)A)	Group.obj

Error	60	error LNK2019: unresolved external symbol __imp__iluCrop(at)24 referenced in function "public: bool __thiscall Glyph::Outline(unsigned int)" (?Outline(at)Glyph(at)(at)QAE_NI(at)Z)	FontTexture.obj
^^^ Replaced all "at" symbol with (at).

I think I'll try to fix them by myself, If someone does not give me a hint.

========
Added later:
========

I managed to fix rts.vcproj for MSVC2005 by myself. Anyone need it?
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Post by BrainDamage »

out of curiosity, may i ask you why you wanted to compile using visual studio?

to debug or to play?

beware that visual studio builds are NOT compatible with the "official" builds and the "offical test builds"
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Post by ivand »

Brain Damage wrote:out of curiosity, may i ask you why you wanted to compile using visual studio?

to debug or to play?

beware that visual studio builds are NOT compatible with the "official" builds and the "offical test builds"
Hmm, never knew about it. Thx for info.

To code and to debug actually. I think it won't be a problem to compile it later with official compiler :roll:
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Post by very_bad_soldier »

Brain Damage wrote: beware that visual studio builds are NOT compatible with the "official" builds and the "offical test builds"
What exactly makes it incompatible? Any ideas?
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

Different compilers....they calculate things differently and thus insta-desync.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Post by very_bad_soldier »

Peet wrote:Different compilers....they calculate things differently and thus insta-desync.
Ok, but they should both get to the same result right? :?:
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

No...they're different compilers written by separate organizations. Something like hello world might come out identical (probably not), but something as complex as Spring does not.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Post by very_bad_soldier »

Can u give more details on this? I cant really imagine how this works.
Is it an issue with non-integer values? Lets say the mingw-version calculates a unit position to 32.4434534635 while VC gets to 32.4434534636 or something like that?

Thanks for info!
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

It simply compiles into a different set of instructions.

edit: I stand corrected.
Last edited by Peet on 07 Jul 2007, 19:17, edited 1 time in total.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

very_bad_soldier wrote:Can u give more details on this? I cant really imagine how this works.
Is it an issue with non-integer values? Lets say the mingw-version calculates a unit position to 32.4434534635 while VC gets to 32.4434534636 or something like that?

Thanks for info!
yes
Post Reply

Return to “Engine”