MacOsX Version issues

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
LaplaceOperator
Space Squid
Posts: 60
Joined: Wed Sep 08, 2004 3:20 pm
Location: Switzerland

MacOsX Version issues

#1 Post by LaplaceOperator »

Hi all.

Some days ago I managed to get FO up and running on MacOsX10.3 (panther). For that i had to do some minor changes/additions to the source-code of both freeorion and libgg. Some where little-endian/big-endian related. But one problem still remains: I'ts not possible to compile libGG with full optimizations on: "gcc3.3 -O3 ...." because whenever it gets to
XMLDoc.cpp or GGFileDlg.cpp the compiler seems to hang in a loop and allocate all the systems-memory until it exceeds the virtual mem limit (around 6 gbytes) and is being killed by the system.
The part causing this (in GGFileDlg.cpp) :

Code: Select all

//	Killer This is where the gcc3.3 compiler from apple hangs ------------------------------------------------------------------------
			
                file_filters[i] = 
                    if_p (LeadingWildcard(filter_specs[i])) [
                        *(wildcard - f_str_p(FrontStringBegin(non_wildcards), FrontStringEnd(non_wildcards))) 
                        >> f_str_p(FrontStringBegin(non_wildcards), FrontStringEnd(non_wildcards))
                    ] .else_p [
                        f_str_p(FrontStringBegin(non_wildcards), FrontStringEnd(non_wildcards))
                    ] 
                    >> for_p (Index(1), IndexLess(static_cast<int>(non_wildcards->size()) - 1), IndexIncr()) [
                        *(wildcard - f_str_p(IndexedStringBegin(non_wildcards), IndexedStringEnd(non_wildcards)))
                        >> f_str_p(IndexedStringBegin(non_wildcards), IndexedStringEnd(non_wildcards))
                    ] 
                    >> if_p (TrailingWildcard(filter_specs[i])) [
                        *wildcard
                    ];
            }
//		------------------------------------------------------------------------------------------------------------------------------

Never seen such a crazy expression before. As i don't know boost::spirit i couldn't yet try to exactly localize the problem inside it. Now this gcc3.3 i'm using is a special version with apple-specific additional stuff. So i'm not really sure what to do. I'm trying to build a bootstrap version of gcc3.4 and recompile those two files with it. If this works i'll have to contact Apple about that (because it's their fault). If it doesn't i don't know what i could do.
Did anyone else ever encounter problems with those two files during compiling?


Greetings from Switzerland

LaplaceOperator

Yoghurt
Programmer
Posts: 376
Joined: Sat Jun 28, 2003 8:17 pm
Location: Heidelberg, Germany

#2 Post by Yoghurt »

What does O3 do? The highest O-switch in vanilla 3.3 is 2. Does it work with this? If yes, which flags are additionally set with O3?

LaplaceOperator
Space Squid
Posts: 60
Joined: Wed Sep 08, 2004 3:20 pm
Location: Switzerland

#3 Post by LaplaceOperator »

No idea. Don't know Vanilla.
-finline-functions and -frename-registers are set additionally to those by -O2. And it doesn't work at all with -Os,-O3,-O2, -O1. Only with -O0.
I did a bootstrap of gcc3.3 yesterday and managed to compile the problematic code-line with -O2. So i think it has definitely to do with the changes Apple did to gcc3.3.

Yoghurt
Programmer
Posts: 376
Joined: Sat Jun 28, 2003 8:17 pm
Location: Heidelberg, Germany

#4 Post by Yoghurt »

"Vanilla" means "unmodified (upstream) version". As (vanilla) GCC works for you, I think it's time to blame Apple ;)

LaplaceOperator
Space Squid
Posts: 60
Joined: Wed Sep 08, 2004 3:20 pm
Location: Switzerland

#5 Post by LaplaceOperator »

ah. thanks. Now I get it.
I thought that's just another compiler. :D

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

#6 Post by LithiumMongoose »

Blame Apple?! Heresy! You cannot "blame Apple", they are Divine Fruit (tm), they are above such petty concepts as blame!!!

<ahem> I'm pretty impressed you got this working, I figured there'd be more serious incompatibilities than that. I'm still running 10.2.8 -- refused to spend good money on Panther when I've been *planning* to replace my old G4 PowerMac with a PowerBook (that would come with Panther for free) for ages now but they keep refusing to meet my main requirement, a bigger resolution on the 17" model's screen, and it looks like that won't happen til the G5 'books now -- but I'd still be interested in helping at some point with this. In particular I'm curious how practical it would be to do real development work on the official CVS version using a port like this; attempting to do so with Windows quickly fizzled for me and I have no pressing desire to install Linux on my PC.

LaplaceOperator
Space Squid
Posts: 60
Joined: Wed Sep 08, 2004 3:20 pm
Location: Switzerland

#7 Post by LaplaceOperator »

Well i was impressed too, that there was not that much to change, to get it working. The hardest part was just to find the places that need changes.
Yesterday i tried to run multiplayer over the internet with another mac.
But somehow both clients always crashed during turn update. This is kinda strange because i tried it before with 4 clients running on my machine and it worked out fine. maybe it has something to do with my friend being behind a firewall.
LithiumMongoose wrote:I'm curious how practical it would be to do real development work on the official CVS version using a port like this; attempting to do so with Windows quickly fizzled for me and I have no pressing desire to install Linux on my PC.
It's very practical. Because you have all you need already with the Os. Xcode comes with it and if you don't have it you can download version 1.5 it at apple's developer site. It comes with gcc3.3 and all the devtools you need. CVS is already integrated into Xcode. But you have to get the FO & LibGG code through commandline, because the CVS and CVSROOT folders have to exist already in order for Xcode to work with cvs. There's lots of funcionality in Xcode that supports cvs. So once cvs is set up you don't need to deal with the commandline any longer.

Do you have already all the libraries needed to compile fo?
Because if you don't it can get very annoying to get all those libs working. As some of them need additional libs not listed in the wiki.
By the way. Building fo / libgg from commandline doesn't work (yet). I'll address that issue as soon as my exams are over (in 3 1/2 weeks).

cbedgar
Space Krill
Posts: 5
Joined: Fri Oct 08, 2004 4:09 am
Location: San Diego

#8 Post by cbedgar »

LaplaceOperator,

Thanks for working on this. I would love to have a MacOS build.

I too am trying to get the game built under MacOS 10.3, but my programming skills are a little rusty, and with all the various libraries, there is a lot to build/install.

So, I have upgraded Xcode to 1.5 and upgraded aclocal, autoconf, make, etc using Darwin ports. (Mac OSX 10.3 comes with automake version 1.6 -- GiGi says it wants version 1.7 min). I copied config.local and config.sub from the local automake directory. I loaded the MacOSX10.3.0 SDK to get the OpenGL libraries. I loaded SDL and FreeType2 and GiGi and I added the m4 files to the m4 directorys in FreeOrion and GG. I added an include to the Mac m4 files to autogen.sh.

I got SDL, FreeType2, and GiGi to build with no errors. Unfortunately, I have had less success with boost. I am getting link error on 16 files. It is also complaining about the -share option. This is not suprising since -share is not supported with GCC 3.3.

I will keep working at it, but since you did get everything to build at least once, I am asking,

Any hints?

LaplaceOperator
Space Squid
Posts: 60
Joined: Wed Sep 08, 2004 3:20 pm
Location: Switzerland

#9 Post by LaplaceOperator »

Hm I'm sorry, at the moment i can't help you with automake/make etc. stuff because i'm doing nearly everything in xcode (I could send you my Xcode-Project if you like..). except the boost-stuff. Yes i had problems too with compiling boost 1.30.2. But then i took 1.31.0 and it worked. which version are you using?

Here you can get the Mac Os X binaries:

only binaries
http://www.n.ethz.ch/student/schwadri/fov0.2xonly.zip

Binaries & gamedata:
http://www.n.ethz.ch/student/schwadri/fov0.2.zip

Only the frameworks:
http://www.n.ethz.ch/student/schwadri/frameworks.zip
All the Frameworks have to be put into the /Library/Framworks/ folder.
Maybe ~Library/Frameworks or System/Library/Frameworks works too...

Would be cool the hear if it works on a different OsX machine. Cause i could only test it on Panther 10.3.5 so far

Xcode-Project following soon.

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

#10 Post by LithiumMongoose »

I'll see about testing it too when I get around to it, am still using 10.2.8. Thanks again for working on this. :)

cbedgar
Space Krill
Posts: 5
Joined: Fri Oct 08, 2004 4:09 am
Location: San Diego

#11 Post by cbedgar »

Thanks for the reply. Thanks for posting the link to the binaries.

Unfortunately, the link to the frameworks doesn't work for me. So, I can't get it to run.

I wouldn't mind building in X-code. Did you just load all the source into one big project? Did you have separate project for each library?

Thanks for the hint about boost 31.0. I will give that a try.

LaplaceOperator
Space Squid
Posts: 60
Joined: Wed Sep 08, 2004 3:20 pm
Location: Switzerland

#12 Post by LaplaceOperator »

yes the link didn't work. I had some problems with uploading the stuff, because i just found out about my student-ftp account and have still to get used to using it. it should work now.
If it still doesn't you have to clear your browser's cache and then it should.

ildoge25
Space Krill
Posts: 5
Joined: Sat Oct 30, 2004 8:41 am
Location: Lisbon, Portugal

#13 Post by ildoge25 »

I tried to run install the game and it did not work... When I click on the file "freeorion" it opens the terminal and gives


/Applications/Jogos/fov0.2/freeorion; exit
dyld: /Applications/Jogos/fov0.2/freeorion can't open library: /usr/local/lib/libvorbisfile.0.dylib (No such file or directory, errno = 2)
Trace/BPT trap
logout
[Process completed]

Can you help?

Thanks
Il Doge

cbedgar
Space Krill
Posts: 5
Joined: Fri Oct 08, 2004 4:09 am
Location: San Diego

It doesn't work for me either.

#14 Post by cbedgar »

Same error for me. I updated the Wiki. I am not sure this is appropriate or not.

Laplace, where do we get this file?

cbedgar
Space Krill
Posts: 5
Joined: Fri Oct 08, 2004 4:09 am
Location: San Diego

Libvorbisfile error solved!

#15 Post by cbedgar »

WooHoo! I finally got it running on my mac! Wow, looks really great guys! Great job!

Here is how I got it working. I also posted this on the download wiki discussion page.

The key is to download and install libvorbis. I had some trouble with this, but then found out about Darwin Ports. The Darwin Ports system makes it easy to install many standard open source packages on a mac. Go to http://darwinports.org/getdp/. Follow the instructions to download and install Darwin Ports. They are very clear.

Then install libvorbis as follows:

Code: Select all

 cd ~/darwinports/base            (I don't know if this is needed but it is what I did)
 sudo port install libvorbis      (This installs the package you need)
 sudo port install vorbis-tools   (Again, not sure this is needed)
Now you need to put the Vorbis lib in the right place. Darwin ports puts libraries in /opt/local/lib/. FreeOrion wants them in /usr/local/lib/. Also FreeOrion calls the libvorbisfile library libvorbisfile.0.dylib. Darwin ports calls it a lot of things, but that isn't one them. So, these commands will sort things out:

Code: Select all

 cd /opt/local/lib/
 ln -s libvorbisfile.dylib libvorbisfile.0.dylib
 sudo ln ./* /usr/local/lib/ 
Lastly, running FreeOrion is not completely obvious. There are three executibles that seem to want to be run from the command line. One calls all the others, so just change directory to the location where you put FreeOrion and type ./freeorion. If everything goes well a window will open a FreeOrion will start up in all its glory.

Have fun!

Post Reply