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
User avatar
alexcurylo
Posts: 7
Joined: February 21st, 2009, 7:01 pm

Re: How To Compile On A Mac

Post by alexcurylo »

SnippyHolloW wrote: ... Btw, where did you find this last LUA framework, there ?
Yep, that's the one. Since this Lua thing doesn't appear to be a mainstream feature yet I didn't figure working on it past shutting up the linker was of any immediate point.
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 »

I made and uploaded another "compile stuff" zip. This one is made for 1.6.1 (which will probably be announced tomorrow), and it now compiles the server, and has that library that should make it work on G3s (though I hope no one's going to compile on a G3!). Probably some other small changes as well. I didn't add anakayub's changes yet, but I probably will later. It's also cleaned up a little bit, and has a bit more instructions.

It's available on source forge, or alternately, on my server.
Lord_Aether
Posts: 127
Joined: November 11th, 2005, 9:06 am
Location: California

Re: How To Compile On A Mac

Post by Lord_Aether »

Hey,

I decided that I wanted to try compiling for the first time, and have an issue. I have downloaded your mac_compile_stuff and source code for wesnoth 1.6.1. I open the xcode project file just fine, but it seems to be missing two files: boilerplate_header.cpp and network_boost.cpp. Any idea what's up? The compile process chokes when it misses network_boost.cpp...

Thanks.
Mac OS X 10.5.7
Wesnoth 1.6.2
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 »

I have no idea why those would be missing... boilerplate_header.cpp can safely be removed from the project; it has no code in it. I can see network_boost.cpp is in svn for 1.6.1 here: http://svn.gna.org/viewcvs/wesnoth/tags ... estart=150

You could download it from there if you want. Also, if you have a problem with the prefix header, go into Project > Edit Active Target "Wesnoth" (make sure Wesnoth is the active target, not the server), go to the Build tab, find Prefix Header under "GCC 4.0 - Language", and change it to "Mac Sources/Wesnoth_Prefix.pch".
Lord_Aether
Posts: 127
Joined: November 11th, 2005, 9:06 am
Location: California

Re: How To Compile On A Mac

Post by Lord_Aether »

Okay, I downloaded network_boost.cpp from svn. I also went to set the prefix header, but it was already set to how you recommend. However, xcode couldn't find the file, so I just moved the file to where it was looking (up one step in the directory structure). I then tried to build, but it choked on boilerplate_header.cpp so I downloaded that from svn as well. After putting that in the right place, it built with one warning :) So - It worked. Thanks for your help.
Mac OS X 10.5.7
Wesnoth 1.6.2
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 »

I'm kinda confused about the prefix header, but I'm glad you got it to work anyway!
DCrunch
Posts: 1
Joined: May 20th, 2009, 9:27 am

Re: How To Compile On A Mac

Post by DCrunch »

Hi. I'm new to Wesnoth and I'm a mac user. While researching about mac os building I came across this topic which seems to be dead for a while. But still, is there 1.6.2 MacCompileStuff? I failed to find 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 »

It's not dead, the last post was on the 6th! I haven't made anything for 1.6.2, but there's 1.6.1, which will work with little or no changes (the potential changes would just be adding files). Check the post like 4 posts before yours.
Cuervo
Posts: 11
Joined: December 4th, 2008, 2:25 am

Re: Wesnoth 1.7.0

Post by Cuervo »

I know that the mac compile stuff is available for 1.6.2 for compiling from source. I am wondering if there is a good method for compiling on OS X from SVN / version 1.7. Or am I just missing something on the mac compile thread?

Any help would be appreciated.
-Brennan
penguin
macOS Packager
Posts: 239
Joined: April 17th, 2004, 5:16 pm
Location: Ontario, Canada
Contact:

Re: Wesnoth 1.7.0

Post by penguin »

There isn't, but the main difference (other than having to add a few new files) is just the addition of the lua dependency. So for now, you can just download this, and put the folder into Headers, and the .a file into lib. After that, go into XCode, goto Project > Edit Project Settings. Add "lib/liblua5.1.a" to Other Linker Flags, and "./Headers/lua_5.1.4" to Header Search Paths. When you're done, it should look like this.

Also, if any files show up red (they don't exist), just delete them; they were probably removed from the project.

Something I discovered just the other day, about adding new source files: you can right-click (or ctrl+click) on the group to add them to, and go Add > Existing Files. Previously I would just drag the files in, but this way, it only lets you select the files that aren't already in the project. This makes it really easy to see what's new; just click on the first one you see, and press down. Note though, that you don't wanna add any files that aren't .cpp or .hpp, and you don't need to add the .hpp files.
Cuervo
Posts: 11
Joined: December 4th, 2008, 2:25 am

Re: Wesnoth 1.7.0

Post by Cuervo »

Thank you Penguin for all your help. It got me past my previous errors, but now I have a huge amount more. I followed your indtructions and added all the files, but at first it couldn't find any of the header files that were specified in the header search path.

I changed them all to recursive which fixed that problem. But now I am getting these errors.

/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/powerpc-apple-darwin9/bits/c++locale.h: In function 'int std::__convert_from_v(char*, int, const char*, _Tv, int* const&, int)':
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/powerpc-apple-darwin9/bits/c++locale.h:72: error: 'snprintf' is not a member of 'std'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/powerpc-apple-darwin9/bits/c++locale.h:72: error: 'snprintf' is not a member of 'std'

And many more complaining about std.
I am wondering if this is a problem with the SVN code or what?

I am running 10.5.7 with Xcode 3.1.2

Thanks for your help so far.

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

Re: Wesnoth 1.7.0

Post by penguin »

Having all the header search paths recursive would indeed mess things up. What's happening is system headers (like <string> or something) are trying to include other system headers, but because of the search path setup, they're including something else with the same name instead (probably from Boost headers, or in the case you posted, maybe intl). Anyway, I only had ../src recursive. Just now I made it not recursive (couldn't think of a reason it should be), and it still works fine. Are you sure you added Headers/lua_5.1.4?

Set them back to not recursive, and tell me what the original errors were. Also, this should be moved to the Mac compiling thread.
Cuervo
Posts: 11
Joined: December 4th, 2008, 2:25 am

Re: Wesnoth 1.7.0

Post by Cuervo »

Sorry for the incorrect location, I will make my next post in the correct thread.
-Cuervo
Cuervo
Posts: 11
Joined: December 4th, 2008, 2:25 am

Re: How To Compile On A Mac

Post by Cuervo »

Okay, I made a few silly mistakes with the location of lua, but I fixed those I changed everything to non-recursive.
Then it said can't fin file png.h so I made a libpng.framework and put it in the project. That fixed the issue. Unfortunately, when compiling files like scrollbar.cpp it says "image has not been defined" "get_image() was not declared in this scope."

I can't figure out how to fix this because it appears to correctly include image.hpp which contains the image namespace. There are three image.hpp files in the project, so I was wondering if they was effecting something.

Thanks,
-Cuervo

EDIT: This is obsolete, I fixed it I will post again with my next errors
Last edited by Cuervo on June 19th, 2009, 5:35 pm, edited 1 time in total.
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 »

I only have 2 image.hpp files; one in src/gui/, one in src/. I'm confused about the png thing. Could you give me the exact error? I don't find png.h anywhere in Wesnoth's sources. Also, how did you just make a libpng.framework, and what header did you put in? I was sure OS X came with libpng, but now I can't find it anywhere... but I never did anything with this myself to get it to work, so I don't know what's going on. I DO have libpng installed through fink, but fink isn't in any of my search paths, so it shouldn't be using it.
Locked