The Castle Doctrine Forums

Discuss the massively-multiplayer home defense game.

You are not logged in.

#1 2014-02-06 15:06:04

jefe78
Member
Registered: 2014-02-06
Posts: 1

Compile on Mac

Hey all!

Trying to compile on OS X is failing with the following error: clang: error: unsupported option '-gstabs+'

After some work I was able to get it to compile on Linux. Trying to compile for OS X on Linux doesn't seem to work either.

Any guidance? After a LOT of reading, I still can't resolve the initial issue of compiling on a Mac.

Thanks!

P.S. I've read all the warnings and understand the implications of having my own client. My intentions are pure.

Offline

#2 2014-02-11 18:33:37

TimeDoctor
Member
Registered: 2014-02-11
Posts: 2

Re: Compile on Mac

I've got the same issue, my guess is that it was tested on an older version of OS X, before clang was made default.

Offline

#3 2014-02-11 19:10:22

TimeDoctor
Member
Registered: 2014-02-11
Posts: 2

Re: Compile on Mac

Here's the pastebin output for anyone adventurous enough to solve this before I do: http://pastebin.com/R6Q4T0s9

Offline

#4 2014-02-19 19:13:54

mps
Member
Registered: 2014-02-18
Posts: 2

Re: Compile on Mac

The -gstabs+ flag is used to set a debugging flag.  If you are not planning on debugging the executable you build, you can disable it by commenting it out in the file minorGems/game/platform/SDL/Makefile.common.

That is, replace the line

DEBUG_ON_FLAG = -gstabs+ #-DDEBUG_MEMORY

with

DEBUG_ON_FLAG = #-gstabs+ #-DDEBUG_MEMORY

When I was compiling this, I also had to change the linker settings for SDL, dropping "-framework SDL" and adding "-L/usr/local/lib -lSDLmain -lSDL" to the definition of PLATFORM_LINK_FLAGS in the file minorGems/game/platform/SDL/Makefile.MacOSX.  My SDL setup is slightly odd, so you might not have to do this.

With these changes I was able to compile the program for OSX Mavericks using the runToBuild script.  However, I noticed that the runToBuild script does not put the game assets where the executable expects to find them.  On my build, ./CastleDoctrineApp looks for assets, settings, and so on in the parent directory instead of as sibling directories.  But adjusting for that and including my download code and email (and using the right secret), I get a playable game.

I'm sorry that this isn't more streamlined, but hopefully it will help you get a working game.

Offline

#5 2014-02-20 09:10:37

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,235

Re: Compile on Mac

Sorry for the weirdness here.  I'm building the game on 10.5, both for backwards compatibility, and also because my only mac doesn't have enough ram to run anything beyond 10.5.

I hadn't even heard of clang until this thread.  What happened to gcc?

Oh... and yeah, on the mac, you MUST "bundle" the game as a manual step AFTER runToBuild finishes.  Go into the "build" folder and run makeDistributionMacOSX

That will make a proper "CastleDoctrine.app" app bundle and copy all necessary game resources into a nice folder for you.  At that point, you should find your "final built folder" in "build/mac".

The "runToBuild" script is pretty much expecting that you are doing the building on Linux (because the game shipped as source for Linux, with no binary at all, back in the day).

Though it may work fine on Windows as well, because no app bundle is needed...

Offline

#6 2014-02-20 17:53:11

mps
Member
Registered: 2014-02-18
Posts: 2

Re: Compile on Mac

Thanks!  I had seen the makeDistributionMacOSX script but had not tried it yet.

Here's a diff to apply to the current version (as I write, 33) to get it to compile on OSX Mavericks with Homebrew SDL:

https://gist.github.com/cokernel/9126596

The clang compiler was originally an internal Apple project.  Between 10.6 and 10.9, OSX phased out gcc in favor of clang.  Rather than dropping debugging symbols entirely, in my diff I've replaced the GCC-specific -gstabs+ with -g in DEBUG_ON_FLAG.

It also appears that 10.9 dropped support for SDL 1.2.  So in my diff above I don't use "-framework SDL" but the linker flags I get from the copy of SDL installed with homebrew.  I can then build the Castle Doctrine with runToBuild and set up the Mac directory with

./makeDistributionMacOSX 33 mac /usr/local/lib/libSDLmain.a

to get a working game.

Last edited by mps (2014-02-20 18:00:07)

Offline

#7 2014-02-21 20:23:12

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,235

Re: Compile on Mac

Oh... OS X never supported SDL!

It was something that I downloaded and installed (and I guess that's where it installed itself  /System/Libraries/Frameworks...)

Offline

Board footer

Powered by FluxBB 1.5.8