2024-04-24 01:31 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004638Spring engineMac OS Xpublic2015-01-03 15:52
Reportermoobyfr 
Assigned TojK 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version98.0.1+git 
Target VersionFixed in Version 
Summary0004638: Compile error with gcc4.8
DescriptionHi
I'm trying to get spring back on OS X 10.10.
(I used "brew" to get all required libraries)

I'm stuck at this error, which is perhaps similar to http://springrts.com/mantis/view.php?id=4347

[ 38%] Building CXX object rts/builds/legacy/CMakeFiles/engine-legacy.dir/__/__/ExternalAI/SkirmishAIHandler.cpp.o
In file included from /Volumes/Stockage/Users/e.blindauer/tmp/spring/rts/System/creg/creg.h:373:0,
                 from /Volumes/Stockage/Users/e.blindauer/tmp/spring/rts/System/creg/creg_cond.h:16,
                 from /Volumes/Stockage/Users/e.blindauer/tmp/spring/rts/Game/Players/TeamController.h:6,
                 from /Volumes/Stockage/Users/e.blindauer/tmp/spring/rts/ExternalAI/SkirmishAIBase.h:6,
                 from /Volumes/Stockage/Users/e.blindauer/tmp/spring/rts/ExternalAI/SkirmishAIData.h:6,
                 from /Volumes/Stockage/Users/e.blindauer/tmp/spring/rts/ExternalAI/SkirmishAIHandler.h:6,
                 from /Volumes/Stockage/Users/e.blindauer/tmp/spring/rts/ExternalAI/SkirmishAIHandler.cpp:3:
/Volumes/Stockage/Users/e.blindauer/tmp/spring/rts/System/creg/TypeDeduction.h: In instantiation of 'boost::shared_ptr<creg::IType> creg::DeduceTypeClass<T>::Get() [with T = long unsigned int]':
/Volumes/Stockage/Users/e.blindauer/tmp/spring/rts/System/creg/STL_Map.h:105:104: required from 'boost::shared_ptr<creg::IType> creg::DeduceType<std::map<TKey, TValue> >::Get() [with TKey = long unsigned int; TValue = int]'
/Volumes/Stockage/Users/e.blindauer/tmp/spring/rts/System/creg/TypeDeduction.h:135:20: required from 'boost::shared_ptr<creg::IType> creg::GetType(T&) [with T = std::map<long unsigned int, int>]'
/Volumes/Stockage/Users/e.blindauer/tmp/spring/rts/ExternalAI/SkirmishAIHandler.cpp:22:1: required from here
/Volumes/Stockage/Users/e.blindauer/tmp/spring/rts/System/creg/TypeDeduction.h:20:111: error: 'StaticClass' is not a member of 'long unsigned int'
  boost::shared_ptr<IType> Get() { return boost::shared_ptr<IType>(IType::CreateObjInstanceType(T::StaticClass())); }
                                                                                                               ^
make[2]: *** [rts/builds/legacy/CMakeFiles/engine-legacy.dir/__/__/ExternalAI/SkirmishAIHandler.cpp.o] Error 1
make[1]: *** [rts/builds/legacy/CMakeFiles/engine-legacy.dir/all] Error 2
make: *** [all] Error 2
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0013870

abma (administrator)

Last edited: 2014-12-20 18:58

View 2 revisions

which version of spring are you tring to compile?

also are you sure gcc 4.8 is used?

~0013873

moobyfr (reporter)

I'm sure about using gcc4.8 (4.8.3 to be precise, got it from brew. 4.7 isn't installable on yosemite)
I'm on the "develop" branch

~0013874

lamer (reporter)

I confirm this with gcc4.9, OS X 10.10
Also ran a size test on archlinux and OS X:
  printf("long long unsigned int: %i\n", sizeof(long long unsigned int));
  printf("long unsigned int: %i\n", sizeof(long unsigned int));
  printf("unsigned int: %i\n", sizeof(unsigned int));
  printf("boost::uint64_t: %i\n", sizeof(boost::uint64_t));
  printf("unsigned short: %i\n", sizeof(unsigned short));
  printf("char: %i\n", sizeof(char));
  printf("float: %i\n", sizeof(float));
  printf("double: %i\n", sizeof(double));
  printf("bool: %i\n", sizeof(bool));
  printf("size_t: %i\n", sizeof(size_t));

Both systems have same results:
long long unsigned int: 8
long unsigned int: 8
unsigned int: 4
boost::uint64_t: 8
unsigned short: 2
char: 1
float: 4
double: 8
bool: 1
size_t: 8

So why this issue doesn't occur on Linux?
My quickfix is to add
CREG_SUPPORT_BASIC_TYPE(long unsigned int, crUInt64)
in https://github.com/spring/spring/blob/340f70ecad9263c44ab655cb08c9dba91e17f611/rts/System/creg/TypeDeduction.h#L46-L56

But don't know if that is correct as http://springrts.com/mantis/view.php?id=4347 suggests to replace all size_t with "unsigned int".

~0013875

cleanrock (reporter)

I think the problem you ran into is what they talk about here: http://stackoverflow.com/questions/11603818/why-is-there-ambiguity-between-uint32-t-and-uint64-t-when-using-size-t-on-mac-os

Looks like jk removed long support because long can be 32 and 64 bits depending on platform:
https://github.com/spring/spring/commit/97f3aa1 "fix `unsigned long` 32/64 bit conflict in creg"

Perhaps we should avoid using size_t in CREG-stuff (like kloots quick fix), let's see what jk says.

You could try to replace size_t with unsigned int in SkirmishAIHandler:
std::map<size_t, int> id_dieReason;
typedef std::map<size_t, SkirmishAIKey> id_libKey_t;

~0013876

lamer (reporter)

More about sizes
https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/64bitPorting/transition/transition.html
http://stackoverflow.com/questions/384502/what-is-the-bit-size-of-long-on-64-bit-windows
So it is removing size_t from CREG. Still not sure if it's correct as kloot wrote "quickfix".

~0013878

abma (administrator)

https://github.com/spring/spring/pull/147
+Notes

-Issue History
Date Modified Username Field Change
2014-12-20 18:38 moobyfr New Issue
2014-12-20 18:53 abma Note Added: 0013870
2014-12-20 18:58 abma Note Edited: 0013870 View Revisions
2014-12-21 21:47 moobyfr Note Added: 0013873
2014-12-25 17:59 lamer Note Added: 0013874
2014-12-26 14:41 cleanrock Note Added: 0013875
2014-12-26 15:53 lamer Note Added: 0013876
2015-01-02 16:42 abma Note Added: 0013878
2015-01-02 16:42 abma Status new => resolved
2015-01-02 16:42 abma Resolution open => fixed
2015-01-02 16:42 abma Assigned To => abma
2015-01-03 15:52 jK Changeset attached => spring release 39542e35
2015-01-03 15:52 jK Assigned To abma => jK
+Issue History