[HOWTO] MacOS X Compilation Guide
NOTE: this information is likely to be outdated! Please refer to http://code.google.com/p/hedgewars/wiki/BuildingOnMac for the newest version
Hi all!
I believe that Hedgewars is really a neat game and i'm sure it will increasly become more popular with such development pace.
I really like the development choices like QT4 and cmake because with them it's really easy to port to several archs.
In fact the linux and windows builds are there and work fine! What about MacOSX?
i've seen many others in the forums asking this question and so i started looking at the problem, making up my mind that i had to find it!
It was a long night, but completely worth it
The problem is at the linking stage for the final hwengine executable! the freepasacal compiler seems to forget every library path that was configured; so with a small modification we finally get the mac executable!
[*update* 04/24/2009] compilation guide has been MUCH simplified; no more hours for compiling, just a couple of libraries to install! The original is still available in my blog
[*update* 07/02/2009] finally when you install the bundle is relocatable but won't work on other computers! If you wish to do so you need to specify -DBUNDLE=1 at cmake step and install the macdeployqt utility as well as the Glasgow Haskell Compiler with DataEnc, utf8 and (a third one i don't remember right now) from the cabal utility (read: create a bundle only if you know what you are doing).
[*update* 04/27/2010] did anyone read this guide? it took one year+ to notice that i was missing the freepascal step xD
LET'S START
- download and install MacPorts from www.macports.org to the default install dir (also Fink from here works).
- from a Terminal, install cmake
Quote:
sudo port install cmake
- download the whole SDL suit, and put the frameworks in /Library/Frameworks
- unpack the Ogg and Vorbis frameworks from this installer (might be a little outdated)
- install the QT SDK using their installer from here
- install Freepascal (>2.2) from here
- unpack the hedgewars source and run this command
Quote:
cmake ../hedgewars-source-DQT_QMAKE_EXECUTABLE=/usr/bin/qmake -DCMAKE_BUILD_TYPE=Release
- run make and make install
- PLAY!!! just open the folder and double click the bundle! You can move it wherever you want
All the separate installers can also be downloaded from macports or fink, just like you did with cmake at first step.
bye
Koda
revisions
*27/04/10* added the freepascal step and fink option
*24/01/09* updated with some error correction
*24/04/09* updated to reflect development changes
*26/04/09* updated for automatic bundle creation
*02/07/09* updated for optional relocatable bundle creation
Let me be the first to congratulate and thank you for successfully making a OSX build!
YOU'RE THE BEST!So it's possible now to create a build that anyone can download from the site?Anyone can do it?
Come to the dark side, we have cookies... - V
Hedgewars script for ubuntu is here...but maybe I have to update it first
Koda,
Is this your page?
http://projectsymphony.blogspot.com/2009/01/hedgewars-finally-compile-on-mac-os-x.html
Your post matches it exactly (or vice versa).
How can you make this compile portable? I am getting library dependency issues on Macs
other than my dev machine.
dyld: Library not loaded: /opt/local/libexec/qt4-mac/lib/QtSvg.framework/Versions/4/QtSvg
Referenced from: /Applications/Hedgewars 0.9.8/bin/hedgewars
Reason: image not found
Trace/BPT trap
you mean something like this?
8-)
just give it some testing and i'll release it
thanks to Tiy for the icon
bye
Koda
ps: yes that's my often abandoned blog
since you asked for it...
http://www.hedgewars.org/node/1140
We need it for 0.9.9 now...
Koda,
Is there any chance that you could post exactly how you got this thing to compile properly? I could never get a compiled version that would work on anything other than the machine that I compiled it on. Your instructions above do not accomplish this. I compiled Qt statically and the SDL components as well, but still no luck. I am really curious as to how you did this. I would like to work in the Glasgow Haskell Compiler and get the server component working on OS X Leopard as well.
Thanks for all of your hard work!
i've posted it at the same place http://www.hedgewars.org/node/1140
yes the instruction here generate an executable that works only on the machine it's compiled on!
In order to compile them statically you have to do some not-so-easy steps:
- completely remove the shared version of libsdl (because cmake always preferes shared over static)
- manually insert all the libs and frameworks qt and sdl depend on
- modify SDLh.pas and change every *.dylib reference into a *.a
so it's rather complicated, it took me a week to figure how to resolve this
if you need assistance i'm often in the irc channel so you can come and ask me
i've heard that the haskell server has some problems on some other oses as well so i wouldn't worry too much (even though i'd love to have it working)
bye
Koda
hi!
i've submitted a patch so next version (0.9.10) should much more easier to compile
that version also solves some bugs of the previous builds
among other news there's also a HEAD build available
http://dl.getdropbox.com/u/24468/hedge-mac-head.tar.bz2
))
enjoy
Koda
I updated the guide to show the lastest developments in the source code
Hedgewars for Mac now properly uses standard Mac frameworks instead of Unix libraries; this mean less time to compile, more platform support and better integration.
Koda
Thanks Koda,
it worked for my local Mac, but if I want to distribute the compiled application, it doesn't work.
How do I excactly build hedgewars for distribution on Mac OS X ?
Thanks.
update for creating relocatable bundles
Hello! I installed GHC, made cmake like
cmake . -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake -DCMAKE_BUILD_TYPE=Release -DBUNDLE=1
-- Found OggVorbis: /opt/local/lib/libvorbisfile.dylib;/opt/local/lib/libvorbis.dylib;/opt/local/lib/libogg.dylib
-- Found Sparkle: /Users/macbook/Library/Frameworks/Sparkle.framework
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/macbook/Downloads/hedgewars-scm-2009-08-16
and I get this during make:
Utils.hs:18:17:
Could not find module `Codec.Binary.UTF8.String':
I think that it's included in GHC, but why? What can I do? Sorry if this is not the correct place to post.
If you don't need the server executable (you intend to play over the official server) you might be able to ignore it.
Right now I'm not sure if Cmake will build the other files. If it doesn't, try to open "\gameServer\CMakeLists.txt" and remove its contents (make a backup copy first). Then build again.
If you really want the server, you'll have to install that module first (can be found here).
At the start of compiling, I get this error:
/Users/macbook/Downloads/hedgewars/trunk/openalbridge/openalbridge.c: In function ‘openal_init’:
/Users/macbook/Downloads/hedgewars/trunk/openalbridge/openalbridge.c:75: error: nested functions are disabled, use -fnested-functions to re-enable
/Users/macbook/Downloads/hedgewars/trunk/openalbridge/openalbridge.c:75: error: syntax error before ‘*’ token
/Users/macbook/Downloads/hedgewars/trunk/openalbridge/openalbridge.c:89: error: ‘default_device’ undeclared (first use in this function)
/Users/macbook/Downloads/hedgewars/trunk/openalbridge/openalbridge.c:89: error: (Each undeclared identifier is reported only once
/Users/macbook/Downloads/hedgewars/trunk/openalbridge/openalbridge.c:89: error: for each function it appears in.)
make[2]: *** [openalbridge/CMakeFiles/openalbridge.dir/openalbridge.c.o] Error 1
make[1]: *** [openalbridge/CMakeFiles/openalbridge.dir/all] Error 2
make: *** [all] Error 2
I modified the CMake file to use the flag -fnested-functions, and it fails too. Why? I made
aquamarine:trunk nico$ cmake . -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake -DCMAKE_BUILD_TYPE=Release -DBUNDLE=1
-- Found OggVorbis: /usr/local/lib/libvorbisfile.dylib;/usr/local/lib/libvorbis.dylib;/usr/lib/libogg.dylib
-- Looking for QT_MAC_USE_COCOA
-- Looking for QT_MAC_USE_COCOA - not found.
-- Found Qt-Version 4.5.2
-- Found Sparkle: /Users/macbook/Library/Frameworks/Sparkle.framework
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/macbook/Downloads/hedgewars/trunk
What's happenning T_T?
Hi,
you need to download the following packages with cabal:
dataenc, hslogger, utf8-string
or use the binary installer from the ghc site (which already contains them)
Hello,
i can't reproduce and the only difference is that I'm using QT 4.4.3 (which i don't really believe might be the cause)
could you try if latests commit fixed the problem for you?
bye
Koda
Hi! Please, help!
error: #error "You are building a 64-bit application, but using a 32-bit version of Qt. Check your build configuration."
What flag I need add to "cmake ../hedgewars-src-0.9.8 -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake -DCMAKE_BUILD_TYPE=Release -DBUNDLE=1"??
I assume you'll have to compile a 64 bit version of Qt first.
Thanks, but I have 32 bit system! I don't know, how I can compile 32 bit version Hedgewars.
Odd, should compile as 32 bit by default then.
Any progress with PPC support?
I'd gladly try out any new versions…
PPC is now functional in HEAD thanks to koda
--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev
updated some missing steps/dependencies (reported by Henek) and added some warnings when creating a bundle
Thanks!
Style is spelled style not stile.
Use Dropbox to backup your important goodies!
this topic is officially outdated!
Check out the newest wiki on http://code.google.com/p/hedgewars/wiki/BuildingOnMac