Compiling Spring (Mac OsX)

Compiling Spring (Mac OsX)

Discuss everything related to compiling and running Spring on Mac OS X.

Moderator: Moderators

GrapeFruit
Posts: 26
Joined: 06 Mar 2009, 14:19

Compiling Spring (Mac OsX)

Post by GrapeFruit »

Hello,

i didnt find a suitable subforum for this, so please forgive me for posting here, i thought to some extend it might be similar to the linux compiling:wink:.
I followed the guide in the Spring wiki, got all dependencies with Macports or compiled them from source.

It worked fine until i got this error at 59% during the compilation of Util.cpp:

Code: Select all

[ 59%] Building CXX object rts/CMakeFiles/spring.dir/System/Util.cpp.o
{standard input}:20:suffix or operands invalid for `push'
{standard input}:23:suffix or operands invalid for `pop'
make[2]: *** [rts/CMakeFiles/spring.dir/System/Util.cpp.o] Error 1
make[1]: *** [rts/CMakeFiles/spring.dir/all] Error 2
make: *** [all] Error 2
Unfortunatly, Util.cpp is written in assembler (right?) , so i cannot even try to fix it, the only thing i figured out was the error was about these lines:

Code: Select all

	void ExecCPUID(unsigned int* a, unsigned int* b, unsigned int* c, unsigned int* d)
	{
	#ifndef __APPLE__
		__asm__ __volatile__(
			"cpuid"
			: "=a" (*a), "=b" (*b), "=c" (*c), "=d" (*d)
			: "0" (*a)
		);
	#else
		__asm__ __volatile__(
			"pushl %%ebx\n\t"
			"cpuid\n\t"
			"movl %%ebx, %1\n\t"
			"popl %%ebx"
			: "=a" (*a), "=r" (*b), "=c" (*c), "=d" (*d)
			: "0" (*a)
		);
Terminal output: http://springonmacosx.pastebin.com/m320030c2
CMakeOutput.log: http://springonmacosx.pastebin.com/m4a3c60a5
CMakeError.log: http://springonmacosx.pastebin.com/m1669b6f

Thanks for ur help, :-)
grapfruit

P.S.: I also tried scons, but i failed configuring because of a lacking jni.h
header file ...
tranchis
Posts: 5
Joined: 01 Dec 2009, 13:15

Re: Compiling Spring (Mac OsX)

Post by tranchis »

Hi,

Try this:

Code: Select all

#else
  __asm__ __volatile__(
    "pushq %%rbx\n\t"
    "cpuid\n\t"
    "movl %%ebx, %1\n\t"
    "popq %%rbx"
    : "=a" (*a), "=r" (*b), "=c" (*c), "=d" (*d)
    : "0" (*a)
  );
#endif
I'm not sure it works, because I'm still building. But at least it compiles.

(http://www.x86-64.org/documentation/assembly.html)
tranchis
Posts: 5
Joined: 01 Dec 2009, 13:15

Re: Compiling Spring (Mac OsX)

Post by tranchis »

Confirmed, it works. I'm testing the game right now :)
GrapeFruit
Posts: 26
Joined: 06 Mar 2009, 14:19

Re: Compiling Spring (Mac OsX)

Post by GrapeFruit »

thx tranchis for your fast help :-)

the util.c fix worked perfectly,
i had to make another fix because there was no error handler window for mac osx, so i used x for it.
And some of the java interface files failed to build, but i read somewhere that they are just important for certain widgets and most widgets dont need that (right?).

But in the end, Spring finally started on my MacBok Pro :mrgreen:

But i still need to figure out where to put the mods and the maps :wink:

[CoW]GrapeFruit :-)

P.S.: are u on osx, tranchis?
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Re: Compiling Spring (Mac OsX)

Post by Auswaschbar »

Does it work, or just compiles? Also, is it 32bit compatible?
GrapeFruit
Posts: 26
Joined: 06 Mar 2009, 14:19

Re: Compiling Spring (Mac OsX)

Post by GrapeFruit »

it compiles, runs with xta and altored and im on a 32 bit machine.
i think osx runs in 32 bit by default, but u can set it to 64 before starting

[CoW]GrapeFruit
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Re: Compiling Spring (Mac OsX)

Post by Auswaschbar »

Was asking because I wanted to apply the patch, but have no mac to test.
tranchis
Posts: 5
Joined: 01 Dec 2009, 13:15

Re: Compiling Spring (Mac OsX)

Post by tranchis »

I'm in OSX, yes, in Snow Leopard.

I'm not sure it should compile in 32 bits, because operations like pushq and popq are 64-bit specific. Maybe you could use a flag in there to let the compiler choose between both.

It compiled and I'm pretty sure it works. There are some traces of the CPU identification on the console while running and they seem to retrieve correct information.
GrapeFruit
Posts: 26
Joined: 06 Mar 2009, 14:19

Re: Compiling Spring (Mac OsX)

Post by GrapeFruit »

what lobby client do u use?
i tried springlobby, but the wxmac didnt compile neither through macports nor from source, allthough i used the build flags for snow leopard.

[CoW]GrapeFruit
tranchis
Posts: 5
Joined: 01 Dec 2009, 13:15

Re: Compiling Spring (Mac OsX)

Post by tranchis »

I've committed a fix for Util.cpp in a fork in GitHub just in case someone wants to add it to the master fork:

http://github.com/tranchis/spring/commi ... 9a66a75caf

GrapeFruit, I don't use any Lobby. I'm just testing some coding of AI scripts, and with the test runs it's enough for me.
GrapeFruit
Posts: 26
Joined: 06 Mar 2009, 14:19

Re: Compiling Spring (Mac OsX)

Post by GrapeFruit »

i updated the spring on mac osx wiki page:
http://springrts.com/wiki/Spring_on_MacOSX

grapefruit
initram
AI Developer
Posts: 15
Joined: 07 Sep 2009, 14:28

Re: Compiling Spring (Mac OsX)

Post by initram »

Now all we need is a guide to make an app-file, and you guys would be awesome...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Compiling Spring (Mac OsX)

Post by AF »

wxwidgets compiles fine in snow leapoard as long as you force it to 32bits, Im not sure how to build springlobby in 32bit arch however =/
GrapeFruit
Posts: 26
Joined: 06 Mar 2009, 14:19

Re: Compiling Spring (Mac OsX)

Post by GrapeFruit »

works fine, looks ugly ;) :
http://img69.imageshack.us/img69/3451/s ... 9at180.png

edit:
doesnt accept the unitsync.dylib i compiled cause its 64 bit :(
User avatar
Blue_Falcon
Posts: 155
Joined: 16 Oct 2008, 18:54

Re: Compiling Spring (Mac OsX)

Post by Blue_Falcon »

GrapeFruit wrote:works fine, looks ugly ;) :
http://img69.imageshack.us/img69/3451/s ... 9at180.png

edit:
doesnt accept the unitsync.dylib i compiled cause its 64 bit :(
I don't see what you think is ugly about that.

Why doesn't wxwidgets compile in 64-bits? (That's what I've gathered from AF's post)
GrapeFruit
Posts: 26
Joined: 06 Mar 2009, 14:19

Re: Compiling Spring (Mac OsX)

Post by GrapeFruit »

It did finally compile in 64 bit, but its an unstable build (the stable release is using carbon, but osx has no 64 bit carbon support), so braindamage and koshi had to make fixes for springlobby to compile (thx :-) )
It still gives error messages at random times but it pretty much works fine now ! :wink:

I think we are finally getting a mac build of spring, :mrgreen:
[CoW]GrapeFruit

Image
Attachments
Screen shot 2009-12-13 at 01.49.27.png
Spring Mac OSC
(1.03 MiB) Downloaded 3 times
tranchis
Posts: 5
Joined: 01 Dec 2009, 13:15

Re: Compiling Spring (Mac OsX)

Post by tranchis »

Is anyone already trying to get a MacOS Application bundle?

If no one is already on it, I might try during this week or the next one.
GrapeFruit
Posts: 26
Joined: 06 Mar 2009, 14:19

Re: Compiling Spring (Mac OsX)

Post by GrapeFruit »

yeah braindamage and me are trying that as well, but tbh i wasnt able to try much cause i have to play in a concert on christmas, so im kinda busy practicing not to ruin it ;)

grapefruit
jeremimst
Posts: 1
Joined: 15 Mar 2010, 14:20

Re: Compiling Spring (Mac OsX)

Post by jeremimst »

Hi everybody (is there still anybody ;-) ?

I am trying to compile spring on my macbook pro, osx 10.5.8 (THIS IS NOT SNOW!)

I have followed the wiki
http://springrts.com/wiki/Spring_on_MacOSX

until "make" ("cmake ." is ok)

after several try I found that gcc4.0 was the best (and not 4.2) but I have this problem at 16% of compiling : Does anyone has the same problem ? I guess it is problem of compiler version but I cannot find any information on that... thanks !

Code: Select all

[ 16%] Building CXX object rts/CMakeFiles/spring.dir/Game/GameServer.cpp.o
/opt/local/include/boost/functional/hash/detail/float_functions.hpp: In member function ÔÇÿfloat boost::hash_detail::call_cpp_frexpf<true>::operator()(float, T) const [with T = int*]ÔÇÖ:
/opt/local/include/boost/functional/hash/detail/hash_float_generic.hpp:44:   instantiated from ÔÇÿsize_t boost::hash_detail::float_hash_impl2(T) [with T = float]ÔÇÖ
/opt/local/include/boost/functional/hash/detail/hash_float_generic.hpp:84:   instantiated from ÔÇÿsize_t boost::hash_detail::float_hash_impl(T) [with T = float]ÔÇÖ
/opt/local/include/boost/functional/hash/detail/hash_float.hpp:92:   instantiated from ÔÇÿsize_t boost::hash_detail::float_hash_value(T) [with T = float]ÔÇÖ
/opt/local/include/boost/functional/hash/hash.hpp:299:   instantiated from here
/opt/local/include/boost/functional/hash/detail/float_functions.hpp:200: error: call of overloaded ÔÇÿfrexp(float&, int*&)ÔÇÖ is ambiguous
/usr/include/architecture/i386/math.h:331: note: candidates are: double frexp(double, int*)
/usr/include/c++/4.0.0/cmath:269: note:                 long double std::frexp(long double, int*)
/usr/include/c++/4.0.0/cmath:265: note:                 float std::frexp(float, int*)
/Users/guiochet/Desktop/spring_0.81.2/rts/lib/streflop/SMath.h:466: note:                 streflop::Double streflop::frexp(streflop::Double, int*)
/Users/guiochet/Desktop/spring_0.81.2/rts/lib/streflop/SMath.h:258: note:                 streflop::Simple streflop::frexp(streflop::Simple, int*)
/opt/local/include/boost/functional/hash/detail/float_functions.hpp: In member function ÔÇÿfloat boost::hash_detail::call_cpp_ldexpf<true>::operator()(float, T) const [with T = int]ÔÇÖ:
/opt/local/include/boost/functional/hash/detail/hash_float_generic.hpp:57:   instantiated from ÔÇÿsize_t boost::hash_detail::float_hash_impl2(T) [with T = float]ÔÇÖ
/opt/local/include/boost/functional/hash/detail/hash_float_generic.hpp:84:   instantiated from ÔÇÿsize_t boost::hash_detail::float_hash_impl(T) [with T = float]ÔÇÖ
/opt/local/include/boost/functional/hash/detail/hash_float.hpp:92:   instantiated from ÔÇÿsize_t boost::hash_detail::float_hash_value(T) [with T = float]ÔÇÖ
/opt/local/include/boost/functional/hash/hash.hpp:299:   instantiated from here
/opt/local/include/boost/functional/hash/detail/float_functions.hpp:188: error: call of overloaded ÔÇÿldexp(float&, int&)ÔÇÖ is ambiguous
/usr/include/architecture/i386/math.h:328: note: candidates are: double ldexp(double, int)
/usr/include/c++/4.0.0/cmath:284: note:                 long double std::ldexp(long double, int)
/usr/include/c++/4.0.0/cmath:280: note:                 float std::ldexp(float, int)
/Users/guiochet/Desktop/spring_0.81.2/rts/lib/streflop/SMath.h:467: note:                 streflop::Double streflop::ldexp(streflop::Double, int)
/Users/guiochet/Desktop/spring_0.81.2/rts/lib/streflop/SMath.h:259: note:                 streflop::Simple streflop::ldexp(streflop::Simple, int)
make[2]: *** [rts/CMakeFiles/spring.dir/Game/GameServer.cpp.o] Error 1
make[1]: *** [rts/CMakeFiles/spring.dir/all] Error 2
make: *** [all] Error 2
axyd
Posts: 4
Joined: 07 Jul 2010, 23:50

Re: Compiling Spring (Mac OsX)

Post by axyd »

iMac 24, can't build, here's stack trace:

Code: Select all

Putting child 0x01a35640 (rts/CMakeFiles/spring.dir/Game/GameServer.cpp.o) PID 15114 on the chain.
Live child 0x01a35640 (rts/CMakeFiles/spring.dir/Game/GameServer.cpp.o) PID 15114 
[ 14%] Reaping winning child 0x01a35640 PID 15114 
Live child 0x01a35640 (rts/CMakeFiles/spring.dir/Game/GameServer.cpp.o) PID 15115 
Building CXX object rts/CMakeFiles/spring.dir/Game/GameServer.cpp.o
Reaping winning child 0x01a35640 PID 15115 
Live child 0x01a35640 (rts/CMakeFiles/spring.dir/Game/GameServer.cpp.o) PID 15116 
/opt/local/include/boost/functional/hash/detail/float_functions.hpp: In member function 'float boost::hash_detail::call_cpp_frexpf<true>::operator()(float, T) const [with T = int*]':
/opt/local/include/boost/functional/hash/detail/hash_float_generic.hpp:44:   instantiated from 'size_t boost::hash_detail::float_hash_impl2(T) [with T = float]'
/opt/local/include/boost/functional/hash/detail/hash_float_generic.hpp:84:   instantiated from 'size_t boost::hash_detail::float_hash_impl(T) [with T = float]'
/opt/local/include/boost/functional/hash/detail/hash_float.hpp:92:   instantiated from 'size_t boost::hash_detail::float_hash_value(T) [with T = float]'
/opt/local/include/boost/functional/hash/hash.hpp:282:   instantiated from here
/opt/local/include/boost/functional/hash/detail/float_functions.hpp:200: error: call of overloaded 'frexp(float&, int*&)' is ambiguous
/usr/include/architecture/i386/math.h:331: note: candidates are: double frexp(double, int*)
/usr/include/c++/4.0.0/cmath:269: note:                 long double std::frexp(long double, int*)
/usr/include/c++/4.0.0/cmath:265: note:                 float std::frexp(float, int*)
/Users/alex/Projects/tmp/spring/src/rts/lib/streflop/SMath.h:466: note:                 streflop::Double streflop::frexp(streflop::Double, int*)
/Users/alex/Projects/tmp/spring/src/rts/lib/streflop/SMath.h:258: note:                 streflop::Simple streflop::frexp(streflop::Simple, int*)
/opt/local/include/boost/functional/hash/detail/float_functions.hpp: In member function 'float boost::hash_detail::call_cpp_ldexpf<true>::operator()(float, T) const [with T = int]':
/opt/local/include/boost/functional/hash/detail/hash_float_generic.hpp:57:   instantiated from 'size_t boost::hash_detail::float_hash_impl2(T) [with T = float]'
/opt/local/include/boost/functional/hash/detail/hash_float_generic.hpp:84:   instantiated from 'size_t boost::hash_detail::float_hash_impl(T) [with T = float]'
/opt/local/include/boost/functional/hash/detail/hash_float.hpp:92:   instantiated from 'size_t boost::hash_detail::float_hash_value(T) [with T = float]'
/opt/local/include/boost/functional/hash/hash.hpp:282:   instantiated from here
/opt/local/include/boost/functional/hash/detail/float_functions.hpp:188: error: call of overloaded 'ldexp(float&, int&)' is ambiguous
/usr/include/architecture/i386/math.h:328: note: candidates are: double ldexp(double, int)
/usr/include/c++/4.0.0/cmath:284: note:                 long double std::ldexp(long double, int)
/usr/include/c++/4.0.0/cmath:280: note:                 float std::ldexp(float, int)
/Users/alex/Projects/tmp/spring/src/rts/lib/streflop/SMath.h:467: note:                 streflop::Double streflop::ldexp(streflop::Double, int)
/Users/alex/Projects/tmp/spring/src/rts/lib/streflop/SMath.h:259: note:                 streflop::Simple streflop::ldexp(streflop::Simple, int)
Reaping losing child 0x01a35640 PID 15116 
make[2]: *** [rts/CMakeFiles/spring.dir/Game/GameServer.cpp.o] Error 1
Removing child 0x01a35640 PID 15116 from chain.
Reaping losing child 0x001118b0 PID 15113 
make[1]: *** [rts/CMakeFiles/spring.dir/all] Error 2
Removing child 0x001118b0 PID 15113 from chain.
Reaping losing child 0x00107790 PID 15046 
make: *** [all] Error 2
Removing child 0x00107790 PID 15046 from chain.
Post Reply

Return to “Mac OS X”