Mac OS X compiled version of the game

For topics that do not fit in another sub-forum.

Moderators: Oberlus, Oberlus

Message
Author
User avatar
space_is_the_place
Space Krill
Posts: 2
Joined: Fri Apr 07, 2006 1:40 pm
Location: Paris

Mac OS X compiled version of the game

#1 Post by space_is_the_place » Tue May 30, 2006 3:23 pm

Hi everyone

Well done, it's fantastic to see this kind of game ressurrection ! But that would be a dream in the reality when this game could be downloadable in a MAC OX 10.3 ( sooner than 10.4 please !!! )compiled version.
The next post should be "do it yourself", but the problem is that I don't know how to and further, what kind of book ( in french ) should I read.

Thanks

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12422
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

#2 Post by Geoff the Medio » Tue May 30, 2006 4:14 pm

I don't think there are any developers or FO regulars using OSX, unfortunately. You might have more luck on an OSX board, by asking someone there to check out FO and compile it for you... (And then they're welcome to then join the project and contribute the OSX version for others to download.)

User avatar
LithiumMongoose
Audio Lead Emeritus
Posts: 188
Joined: Fri Jul 25, 2003 1:52 pm
Location: Cincinnati OH, USA

#3 Post by LithiumMongoose » Tue May 30, 2006 5:52 pm

I use OS X, Geoff. Been a Mac person since the dawn of time. I also have a PC but it's only for games.

Unfortunately I've been planning to buy a new Mac for years now and, knowing that, have refused to shell the $120 for a new version of the OS since it's free with new hardware. So I'm still running 10.2. Going to finally proceed when Apple adopts the Merom chips I think.

In any case I don't really have the time or energy to delve into compiling atm, though it's been on my longterm to-do list for ages. Heh. Someone did actually have it working on OS X a while back too btw, back with early FO 0.2 I think. The thread is probably still around here somewhere.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12422
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

#4 Post by Geoff the Medio » Tue May 30, 2006 8:05 pm

Apologies for my ignorance; I suppose I could have figured it out from your music URL... Though you can't compile in the short term, it's effectively as if you weren't for the purposes of this discussion...

appleide
Space Krill
Posts: 4
Joined: Thu Jun 08, 2006 11:24 am

#5 Post by appleide » Sat Jun 10, 2006 8:57 am

Just to let every know there is another Mac OS X user here...

alcimedes
Space Krill
Posts: 3
Joined: Tue Nov 29, 2005 3:15 pm

#6 Post by alcimedes » Thu Jul 13, 2006 9:01 pm

One more actually. I'll see if I can dig up some coders that are looking for projects and get a working OSX compile.

If so, would the team be OK with my hosting the static .31 compile on my own server, or would they want it hosted with the rest of the project?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12422
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

#7 Post by Geoff the Medio » Thu Jul 13, 2006 9:20 pm

alcimedes wrote:would the team be OK with my hosting the static .31 compile on my own server, or would they want it hosted with the rest of the project?
You can do anything you want with FreeOrion assets as long as you follow the terms of the GPL and applicable art / music licenses.

User avatar
tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

#8 Post by tzlaine » Fri Jul 14, 2006 2:55 pm

alcimedes wrote:One more actually. I'll see if I can dig up some coders that are looking for projects and get a working OSX compile.

If so, would the team be OK with my hosting the static .31 compile on my own server, or would they want it hosted with the rest of the project?
If you want to host it as well, that would be great, but I'd like to see any binary downloads we ahve all available at the same place -- our SourceForge.net download page. That's where most (if not all) people will go looking.

User avatar
Sheldar
Space Floater
Posts: 31
Joined: Mon Jul 24, 2006 9:28 pm

OSX here too

#9 Post by Sheldar » Wed Jul 26, 2006 4:10 pm

I have been looking at doing some programming for this but only have access to OSX. I could use the underlying Unix shell I suppose. But I haven't looked into that yet. I usually program on a PC for a PowerPC embedded system so it may be a while before I am up to speed.

User avatar
captainobvious
Krill Swarm
Posts: 13
Joined: Thu Aug 17, 2006 8:17 am
Location: The G-State, USA

Mac X 10.4 Intel Build

#10 Post by captainobvious » Thu Aug 17, 2006 8:38 am

Hey, I'm new here, so I'm sorry if I'm repeating something, but I couldn't find a clear consensus on the issue of FreeOrion builds for Mac OS X. What I know is that I tried once, on 10.3 PPC a few months ago when I first found out about FO, but ran into issues with Quicktime and Apple linking against newer libraries or something like that and failed and gave.

Now, I have a new macbook w/ 2 GHz CoreDuo and 1 GB ram and some free time, and I've succeeded in building a runnable and "playable" version of FO on Mac OS 10.4.

What I'm wondering is, if anyone else has done it, and if they could help me, because there are some issues (like crashing on save/load). And if not, and anyone wants to know about what I did, or how to do it themselves, I kept pretty good notes, I could probably help a little bit or put together a howto or a wiki page with some help or encouragement. Is there interest, are there already people doing it?

User avatar
pd
Graphics Lead Emeritus
Posts: 1924
Joined: Mon Mar 08, 2004 6:17 pm
Location: 52°16'N 10°31'E

Re: Mac X 10.4 Intel Build

#11 Post by pd » Thu Aug 17, 2006 9:50 am

Is there interest, are there already people doing it?
That would be really nice! I'm sure there are people around who will find this helpful. Check this site and edit it. You could create a new section called 'Compiling in MacOS' or something.

User avatar
tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

Re: Mac X 10.4 Intel Build

#12 Post by tzlaine » Thu Aug 17, 2006 2:27 pm

captainobvious wrote:Hey, I'm new here, so I'm sorry if I'm repeating something, but I couldn't find a clear consensus on the issue of FreeOrion builds for Mac OS X. What I know is that I tried once, on 10.3 PPC a few months ago when I first found out about FO, but ran into issues with Quicktime and Apple linking against newer libraries or something like that and failed and gave.

Now, I have a new macbook w/ 2 GHz CoreDuo and 1 GB ram and some free time, and I've succeeded in building a runnable and "playable" version of FO on Mac OS 10.4.

What I'm wondering is, if anyone else has done it, and if they could help me, because there are some issues (like crashing on save/load). And if not, and anyone wants to know about what I did, or how to do it themselves, I kept pretty good notes, I could probably help a little bit or put together a howto or a wiki page with some help or encouragement. Is there interest, are there already people doing it?
First, could you send me any source code changes you may have had to make to get it compiled on that platform?

Second, if you can tell me where the crash is occurring, I can probably help with a fix. Run freeorion in gdb like so: "gdb --args freeorion [your args here, if any]", then type "run" at the gdb prompt. When you see the initial game menu come up, hit Ctrl-C in the gdb window to get access to the gdb console again, and type "catch throw" (this is in case the crash is caused by an uncaught exception). Type "continue", then save or load as you normally do when the crash occurs. When you see the crash, control will return to gdb. type "bt" for backtrace to get a stacktrace, and post it here.

User avatar
captainobvious
Krill Swarm
Posts: 13
Joined: Thu Aug 17, 2006 8:17 am
Location: The G-State, USA

Load/Save Crash Stacktrace

#13 Post by captainobvious » Fri Aug 18, 2006 12:07 am

Alright, this is probably going to be a long post, but maybe someone will find the information useful.

As far as compiling freeorion (and GiGi) there are only a few changes that I had to make (note for anyone out there trying to compile it themself, there are also changes to dependencies that I'm not mentioning here).

I had to create some sym links so scons could find OpenGL and boost.

Modify build_support.py in gigi/GG, line 325, from
int main()
to
int main(int argc, char **argv)
Note about this: it's alright to define main() with no arguments
normally, but when a header file (SDL I Think) replaces main with
SDLMain, it must conform to the prototype.

This also had to be done in freeorion/FreeOrion/build_support.py, line 297

In gigi/GG/SConstruct, line 309, change from
#if !ILUT_USE_OPENGL
to
#ifndef ILUT_USE_OPENGL

or else scons won't think you have DevIL with OpenGL, because
#if !
by itself is bad C code and ILUT_USE_OPENGL is defined, but to nothing

also did this in freeorion/FREEORION/SConstruct line 289

in gigi/GG/SConstruct, there are three groups, around line 550, that tell how to install GiGi, GiGiSDL, and GiGiNet They include clauses like

Code: Select all

if env['dynamic']:
Alias('install',
  env.Command(lib_dir + '/' + gigi_libname,
  lib_dir + '/' + installed_gigi_libname,
  'ln -s ' + lib_dir + '/' + installed_gigi_libname + ' ' + lib_dir + '/' + gigi_libname))
comment them out, because the installed names are the same as the original names (thus causing an attempt to link an item to itself)

also in the Sconstruct file for GG, around line 484, change

Code: Select all

# define libGiGiSDL objects
if not env['disable_sdl']:
    sdl_env = env.Copy()
    if str(Platform()) == 'win32':
        sdl_env.Append(LIBS = ['SDL', 'GiGi'])
        if not env['disable_net']:
       	sdl_env.Append(LIBS = ['GiGiNet'])
to

Code: Select all

# define libGiGiSDL objects
if not env['disable_sdl']:
    sdl_env = env.Copy()
    #if str(Platform()) == 'win32':
    sdl_env.Append(LIBS = ['SDL', 'GiGi'])
    if not env['disable_net']:
    	sdl_env.Append(LIBS = ['GiGiNet'])
Note the careful indenting. This is required because SDL, GiGi, and GiGiNet are required libs for GiGiSDL (on darwin as well)
Someone with knowledge of an "or" command in python could also add (str(Platform()) == 'win32' OR str(Platform()) == 'darwin'), since that is what the platform is (I've checked with print statements)

line 29 of gigi/GG/SConstruct also needs to be fixed so that 'darwin' is not handled the same as 'win32' and 'location to install GG' is /usr/local/ rather than C:\\

gigi/GG/GG/Texture.h lines 150, 151
change the type of m_width and m_height to be GLint instead of int

this is important, since the addresses are passed to a function which takes GLint*

next, the following lines appear in
gigi/GG/src/SDL/SDLGUI.h (around line 208)
and
freeorion/FreeOrion/client/human/HumanClientApp.cpp (around line 450)

Code: Select all

#ifdef __APPLE__
        GG::Pt mouse_pos(event.motion.x, m_app_height - event.motion.y);
        GG::Pt mouse_rel(event.motion.xrel, -event.motion.yrel);
#else
        GG::Pt mouse_pos(event.motion.x, event.motion.y);
        GG::Pt mouse_rel(event.motion.xrel, event.motion.yrel);
#endif
First off, it obviously wasn't tested in the freeorion version, since m_app_height is private, and second, the effect seems to be that everybody gets a mouse, except mac users get a weird backwards mouse... maybe it fixed a bug in MacOS that was later fixed?

that's all it took for GG (a few more tricks I didn't mention for GG-Sketch), and like I said before, a lot of these were the same in freeorion

However, in addition to the fixes above, I also had to do this to freeorion

on freeorion/FreeOrion/SConstruct, line 311 add this line

Code: Select all

context.env.Append(LIBS = ['SDL', 'SDLmain'])
scons also wants a FreeOrion/libltdl so ln -s FreeOrion/GG/libltdl FreeOrion/ltdl

freeorion/FreeOrion/SConstruct, line 480, add

Code: Select all

end.AppendUnique(LIBS = ['GiGi', 'GiGiNet', 'GiGiSDL'])

Then it works!

A bit more about the bugs I found.

When loading, the game throws an uncaught exception, like you predicted.  When saving, it actually seg faults.  I think the problems may be related?

Thanks for tip about gdb, I've got gdb stack traces when [url=http://www.geocities.com/realmanppp/gdb_crash_info_load.txt]loading[/url] and when [url=http://www.geocities.com/realmanppp/gdb_crash_info_save.txt]saving[/url].  Also, I have an Apple crash reporter [url=http://www.geocites.com/realmanppp/apple_crash_report_fo_save.txt]file[/url] from the saving crash.  This isn't possible in the loading scenario because, as far as the OS is concerned, there is no actual error, just a sudden quit from the uncaught exception. 

I'd also like to report that the program is kind of "picky" about the file structure in the following way:

freeoriond and freeorionca have to be installed in /usr/local/bin or else there is an execv error when you attempt to start a game (although freeorion still launches).  I assume this is because the game can't figure out how to launch freeoriond or freeorionca?

Finally, the path that the freeoriond command is run from has to have in it the "default" directory with the data folder, in order to start a new game.  Otherwise, freeoriond crashes.  Here is an [url=http://www.geocities.com/realmanppp/apple_crash_report_fod_dirissue.txt]apple[/url] and [url=http://www.geocities.com/realmanppp/gdb_crash_info_dirissue.txt]gdb[/url] crash report of that occurance.  There are two ways to ensure freeoriond launches with the right path.  The first is to launch freeorion from the right path, the second is to launch freeoriond from the correct directory manually before starting freeorion.[/url]

User avatar
tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

#14 Post by tzlaine » Sat Aug 19, 2006 4:48 pm

Since there are so many changes, can you email me the affected files, or a ptach if you know how to make one? My email address is in a PM to you.

User avatar
captainobvious
Krill Swarm
Posts: 13
Joined: Thu Aug 17, 2006 8:17 am
Location: The G-State, USA

Building on Mac OS X Howto

#15 Post by captainobvious » Mon Aug 21, 2006 4:12 am

I've written up something, somewhat in the style of "User Stories" about compiling on Mac OS X. http://www.freeorion.org/index.php/User ... OS_X_Intel

Post Reply