How to compile Wesnoth on Mac OS X

Get help with compiling or installing the game, and discuss announcements of new official releases.

Moderator: Forum Moderators

Locked
Cuervo
Posts: 11
Joined: December 4th, 2008, 2:25 am

Re: How To Compile On A Mac

Post by Cuervo »

Well, I got it to compile... The issue was that some files that should have been targets for the MP Server. It has two errors: No Fifodir has been set and Line Location SDLMain.m:123: warning: passing argument 2 of 'NSApplicationMain' from incompatible pointer type... So I tried to run it from the build directory and it booted and closed...
This is the debuggers message:
Battle for Wesnoth v1.7.0+svn
Started on Fri Jun 19 11:26:01 2009


Data directory:
User configuration directory: /Users/Brennan/.wesnoth1.7

20090619 11:26:02 error filesystem: Trying to open file with empty name.
20090619 11:26:02 error config: Could not open file
could not initialize fonts

Thanks,
-Cuervo
penguin
macOS Packager
Posts: 239
Joined: April 17th, 2004, 5:16 pm
Location: Ontario, Canada
Contact:

Re: How To Compile On A Mac

Post by penguin »

Oh right, I forgot about that. Pretty much all files not in server/ or tests/ should go in Wesnoth, but only some of them need to go in the server as well. I basically just added them based on linker errors; so I'd start with not having them in the server, and add them if necessary (you don't have to add the file again, just get info on it and add it to the other target).
Cuervo
Posts: 11
Joined: December 4th, 2008, 2:25 am

Re: How To Compile On A Mac

Post by Cuervo »

Yes, I fixed that, so it compiles, but won't run... I was wondering how to set the data dir because that seems to be the problem...

EDIT: Well now that everything was fixed on the irc. Thanks a lot for your help.
-Cuervo
User avatar
Turuk
Sithslayer
Posts: 5283
Joined: February 28th, 2007, 8:58 pm
Contact:

Re: How To Compile On A Mac

Post by Turuk »

penguin wrote:Also, this should be moved to the Mac compiling thread.
Merged all of the other posts in here to tidy it all up a bit.
Mainline Maintainer: AOI, DM, NR, TB and THoT.
UMC Maintainer: Forward They Cried, A Few Logs, A Few More Logs, Start of the War, and Battle Against Time
penguin
macOS Packager
Posts: 239
Joined: April 17th, 2004, 5:16 pm
Location: Ontario, Canada
Contact:

Re: How To Compile On A Mac

Post by penguin »

For anyone else reading, this was solved (on IRC). The data and user data paths weren't being set for some reason.
sakuraischerry
Posts: 6
Joined: June 18th, 2009, 1:32 am
Location: Japan

Re: How To Compile On A Mac

Post by sakuraischerry »

I want to debug and compile wesnoth-1.7.6 on Xcode.

I could compile wesnoth-1.6.1.

"wesnoth_compile_mac_1.6.1" helped me.

However, wesnoth-1.7.6 can't use "wesnoth_compile_mac_1.6.1".

I want "wesnoth_compile_mac_1.7.6(?)".

Or, I want to know how to compile and debug wesnoth-1.7.~ series.

Thank you for your cooperation. :o
penguin
macOS Packager
Posts: 239
Joined: April 17th, 2004, 5:16 pm
Location: Ontario, Canada
Contact:

Re: How To Compile On A Mac

Post by penguin »

Noted. I'll try to make a new compiling package soon; just have to make sure everything's working good again first (this last release was rather buggy). Also need to catch up on a lot of stuff, since my harddrive broke, and I just got a new one today.
sanjeev
Posts: 3
Joined: January 11th, 2010, 10:49 pm
Contact:

Re: How To Compile On A Mac

Post by sanjeev »

I needed to compile the latest 1.7.11 - 1.8 build, so I took the Mac Compile stuff and and got it working with the latest trunk release (svn 40697). Here it is if anyone is interested. There are still some warnings, and there is a font missing for pango, but the game will build and run. Mac Compile Stuff

This package was made using Max OS X 10.6.2 Snow Leopard, XCode 3.2.1 64 bit.

Cheers.
iPhone App Development http://www.beefyapps.com
penguin
macOS Packager
Posts: 239
Joined: April 17th, 2004, 5:16 pm
Location: Ontario, Canada
Contact:

Re: How To Compile On A Mac

Post by penguin »

Thanks sanjeev. Sorry I never got around to that myself.
penguin
macOS Packager
Posts: 239
Joined: April 17th, 2004, 5:16 pm
Location: Ontario, Canada
Contact:

Re: How To Compile On A Mac

Post by penguin »

Now that we're at 1.8, and with GSoC going on, I finally made a new build package:
http://wesnoth.happyspork.com/files/wes ... ac_1.8.zip

(May move it later, but it's fine there for now.)
ctrl_freak
Posts: 1
Joined: April 4th, 2010, 7:58 pm

Re: How To Compile On A Mac

Post by ctrl_freak »

penguin wrote:Now that we're at 1.8, and with GSoC going on, I finally made a new build package:
http://wesnoth.happyspork.com/files/wes ... ac_1.8.zip

(May move it later, but it's fine there for now.)
Works great. To build the debug configuration with this package, you'll need to add

Code: Select all

LOCALEDIR=\"translations\"
to your preprocessor macros, or else you'll get an error about LOCALEDIR being undefined in filesystem.cpp (for the server). Thanks to penguin for helping me with this on IRC.
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: How To Compile On A Mac

Post by Eleazar »

I've never used Xcode before, but i thought i'd give penguin's package a try.

The direction seem to assume i want to distribute wesnoth. At least i don't know why i'd want to make a DMG for personal use when compiling, but awayway...

1. Update version numbers in Info.plist
Does this matter? I changed it to 1.9.0

2. Update the changelog in SDLMain.nib with player_changelog
There were two "SDLMain.nib" files. I don't know which one (or both) should be updated, nor how to update the .nib with a changelog. But this didn't seem important so i skipped it.

3. Rebuild all in XCode (clean all, then build)
This seems clear. I clean all, then build.

I get 1 error and 2 warnings. I can't figure out how to copy/paste this info, everything seems to be a link, so i attached it as a picture. I can't find anything on the wiki that seems applicable, so i'm just going off "packaging.txt" in the package.


Any help would be appreciated.
Attachments
Picture 5.png
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: How To Compile On A Mac

Post by AI »

The addon management code has been moved around recently, the projectfile may not have been updated yet.
This is probably because the xcode project file is not checked into svn, so when someone adds/removes/moves files, they can't update it.
penguin
macOS Packager
Posts: 239
Joined: April 17th, 2004, 5:16 pm
Location: Ontario, Canada
Contact:

Re: How To Compile On A Mac

Post by penguin »

Yeah, just go through all the C++ files on the left, and look for all the red ones (the ones that don't exist) - select them all, and delete them (there shouldn't be many). You also need to add any new files; to do this, just right-click (ctrl-click) on the "src" group, go to Add > Existing Files, and add most of the C++ files that it'll allow you to. The fact that it doesn't allow you to select ones that are already there makes it easier, but there are still a couple you don't want to add - for instance, campaign_server/campaign_server.cpp. What I would recommend, is compile before doing this step, then if you get linker errors, look at them and try adding the files that sound related.

I'm sorry you have to do all this; the reason is just that I don't update the package very frequently, and files do get added or removed from time to time. Once you get familiar with the process it's pretty easy, and once you've got it working, you can see in svn's output when updating to see which files were added (A) and removed (D).

You are correct that all of those steps are only required for packaging - I just wanted to document them somewhere so I didn't forget, or in case someone else wanted to package, etc. Are you sure you don't have an SDLMain.nib file though? It should be in Resources. To update the changelog, you go to the changelog window, double-click the text area, make it editable, add the newest release's notes, select the header for the version name, press cmd+= twice, and cmd+b (two sizes up, bold). Make it uneditable, save. But again, don't worry about that stuff unless you're building for distribution. Also, you may want to turn off building for ppc or i386, whichever you don't have yourself; that'll half your compile time. Just go into Project > Edit Active Target, the Build tab, change Architectures to "Native Architecture of Build Machine".

Good luck!
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: How To Compile On A Mac

Post by Eleazar »

penguin wrote:Edit Active Target, the Build tab, change Architectures to "Native Architecture of Build Machine".!
To clarify, literally typeing in "Native Architecture of Build Machine", doesn't seem to work, but choosing my processor from the list immediately below does.

thanks penguin.
It took me 6 or 7 rounds to get all the necessary source files added, but finally it works.
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
Locked