-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mac OS X Building Instructions #30
Comments
Hi b6i6o6, this is the current situation: I'm a Linux programmer and use the qmake build system on Linux (that's why it had unfortunately no testing whatsoever on other platforms, until your post at least). When humble bundle picked up my engine to use it in one of their ports, @urkle contributed the cmake project files he used to build mkxp on Linux and Mac. That's why the cmake side is so little documented / tested (and I'm unable to give support for it, sorry).
If I recall correctly, OSX has its own built-in OpenAL interface, doesn't it? It would be interesting how to access that from qmake. Maybe it's just a
About boost: it unfortunately creates different library names depending on whether it's compiled with multithreading support (-mt) or single threaded, and sometimes it has no suffix at all. Add to that the fact that boost has no pkg-config support, and you get pretty hard to discover libraries =/ About the "-lGL": That looks like a leftover of when GLEW didn't link to libGL correctly on my setup. My fault, shouldn't have committed that to the main repo. As you can see, the qmake side wasn't ready to deal at all with OSX so far. But if it works for you, we could split the |
Well that's funny that I can't make the project using CMake's Makefile then! ;-) As for qmake not ready for OSX, it's not as bad as you put it. The -lGl at the top of the pro file in LIBS was wrong and I'm sure you'll fix it, but the only real "problem" is -lboost_program_options. Could it be possible to have qmake do something like "if you can link with mt link it, otherwise link without mt" ? |
I just saw you made changes to improve support of CMake on OSX, thank you! And just so you know, I checked CMake output when looking for dependencies, and I am now sure it is linking to OSX OpenAL. I have edited the above instructions and removed the need for OpenAL. |
Fixed by #32. |
It is now compiling on OSX both with cmake and qmake. Note: I didn't spot the problem before because qmake and cmake require different versions of ruby. Apparently qmake was linking the one with rb_funcallv and cmake the one with rb_funcall2, I remember having to sudo port ruby20 and ruby21 for both cmake and qmake to work but I don't recall which one required which version. |
I'm not too keen how this framework stuff works on OSX, but I'd wager a guess that you left the include path for AL soft in the Makefile, so alext.h was sourced from there (even though the linking took place against the osx AL).
qmake uses pkg-config to determine the include/link flags for AL, which only soft has support for (pkg-config is really a Linux thing). Cmake presumably defaults to the framework.
Hm, boost is such a pain in the butt. A quick fix would be to have yet another variable "BOOST_LIB_SUFFIX" where one can specify the "-mt". |
Wouldn't be possible to have a kind of dynamic linking condition ? |
A couple of months after my previous builds, I decided to start from scratch on Mac OS X 10.6.8.
I guess this issue should have been present when mkxp used glew, but glew's workarounds for this issue masked it in the past.
(/opt/X11/include is the path for XQuartz). I also had to modify the gl-fun.h from mkxp and add these lines:
right after |
My mistake. I actually tested the cmake build, but didn't realize that it included files from my qmake build and as such this issue didn't show itself. Fixed now.
Fixed, can be compilable with 2.0 again. Although I'd recommend to use newer ruby than 2.0 regardless. As for the OpenGL issues, how new is your SDL2 install? What happens if you add |
Nvm the last bit about |
Thanks for the fixes. :)
I use SDL 2.0.1 because 2.0.3 fails to build on OS X 10.6.8. |
I just took a look at my family's mac and opened the Can you test this patch please: http://pastebin.com/73B8mBwH |
so, ideally you should only include the SDL_opengl.h and never the system one.. OR use something like GLEW (this is my preference) |
System headers were never included directly, SDL_opengl.h did that. Ie. it was an issue with SDL. |
Ahh.. so just need to upgrade SDL2 then.. |
@Ancurio, I applied your patch, it compiled successfully. :) @urkle, I'm glad to see a comment by you, I greatly benefitted from your contributions while I first started building on Mac back in January. |
Ok, pushed that patch to master. Let me know if there's anything else. |
By the way, when 2.2.0-preview1 is used, mkxp compiles and a simple graphical hello world script works. Maybe cmake should default to 2.1 like qmake does (okay, here you have to edit the file to use a different version)? Or is the default Mac OS X version (2.0, right?) the reason for this discrepancy? |
Yeah, I actually use ruby git head for a game I'm currently working on because of a bug in 2.1. The reason why cmake's default is 2.0 is completely arbitrary, and that wasn't set by me but urkle who originally contributed the cmake build script (I mostly never use cmake myself, so I don't pay as much attention to it). I agree it can be bumped up to 2.1. The ruby version being "hard-coded" in qmake is actually something I've thought about before, there's no need for it to be that way, and I'll probably make it configurable via an option in the future, but until now simply editing the .pro from my IDE was simply faster so I didn't bother. |
OS X 10.6, 10.7 and 10.8 come with Ruby 1.8 while OS X 10.9 comes with both Ruby 2.0 and Ruby 1.8. |
I also agree it can be bumped up (at least for Arch Linux 😄). |
For those who may have experienced audio clipping issues on Yosemite, it is caused by the build of OpenAL bundled with OS X 10.10, it is probably a buffer issue in Audio Streaming, which I have reported to Apple. My October 23 build uses OpenAL Soft 1.15 lib instead of the OS X bundled framework: |
Concerning physfs: «Enter it and build physfs like the previous dependencies.»
This just doesn't work. In fact, this, or actually installing it under /usr (not /usr/local) results in the same, which is, after running qmake in mkxp: |
@Keyaku Have you verified that pkg-config is able to locate your installation?
|
@Ancurio Huh… It isn't locating it. In fact, it's not even locating the Homebrew one. Should've noticed this since it doesn't use (or install even) physfs.pc at all. What's the best approach to fix this? |
pkg-config uses the
and try finding the physfs package again, or just running qmake. Homebrew's package is probably not found because they ship the last stable version (very old, 2012) which didn't yet have pkgconfig support. |
EDIT: I picked the extra/physfs.pc.in and modified it myself (very little effort was needed). qmake now passes that test.
|
Oh, I see now, yes that is actually my fault. Can you download this patch and apply it with (When I added pkgconfig support to PhysFS I knew very little about OSX development and never considered people would be using it like a regular Unix system..) |
@Ancurio No worries, and thanks, the patch also made sure the pc file would be properly installed! |
EDIT: Ummm.... what happened to your original question? o_O Looks like you don't have boost::program_options installed (or linking) Note that boost::program_options is one of boost's few non-header-only ...in your gcc command. (The other boost libraries are header-only, so they Can you provide the output of: Seth On Sat, Jun 20, 2015 at 8:37 PM, Keyaku notifications@github.com wrote:
|
Here's the VERBOSE=1 output, after using -lboost_program_options. @sorlok I deleted my original question because I thought I had fixed the linking problems, and so I decided to just discard it (therefore, deleting the question). Unfortunately, it didn't work, so, here I am again :D |
The -lboost_program_options has to go after your objects (c code). Hint: The reason for this is that the linker will only include symbols it knows Seth On Sat, Jun 20, 2015 at 8:59 PM, Keyaku notifications@github.com wrote:
|
@sorlok Ah, sure. Forgot the linker was this picky. |
Hmmm... not sure what to say, except to double-check that you have the On Sat, Jun 20, 2015 at 10:58 PM, Keyaku notifications@github.com wrote:
|
First, you should verify that you are using the correct library. I see the linker also uses |
@carstene1ns After @sorlok suggested that I double-checked I had the 64-bit installed, I uninstalled Brew's Boost and decided to download the source myself and compile that (following closely their instructions). Then I tried building mkxp once again. The lib in use this time is, like you'd expect, |
@Keyaku, I second @carstene1ns suggestion about |
Maybe it's still worth pointing out www.github.com/OutOfOrder/BoostBuilds I only use it on Linux but the author of it is the one who also did the initial cmake setup for mkxp on OSX, so it should work well. |
@openmac I swear I tried that, and I also looked into @carstene1ns 's links and I still can't manage to get Boost::program_options to link. I'm truly questioning my capabilities in putting code or packages together, but I firmly believe I'm trying best. |
lurk and I recently added a new branch to the BoostBuilds repo that has libc++ (OS X 10.7+) versions of some of the boost libraries (instead of the libstdc++). And there is now iOS builds (libc++) in there too for way too many architectures :). I'm actually using those boot builds for another project on all of those platforms, so it is being maintained. Boost is "fun" to get compiling on OS X :) |
Any chance this could be added as a formula to Homebrew? |
I wrote a Homebrew formula for mkxp. It's not submitted to the official tap, so you should install it directly from my repo:
Please let me know if you have any build / dependency issue. Somehow I couldn't download the prebuilt OS X binary, so testing / comparison was limited. Suggestions are also welcome. By the way, does mkxp have a plan to release any official version? It'd be nice to have a tagged release with some reasonable versioning scheme. Homebrew may not accept HEAD-only packages in their games tap. |
@tomyun Nice job! Some suggestions for you:
|
@openmac Thanks for your feedback!
|
Not in the near future. As long as vital functionality such as font rendering is still broken, it makes little sense to me to start maintaining releases. Besides that, I'd like to focus the little time I spent on the project on writing / fixing code instead of version bureaucracy. |
@tomyun Do you have any idea how to fix it? I tried commenting this line |
….28.1 Bump SDL to 2.28.1
open localization work
Fix windows shim type confusion
Note: This was originaly an issue ticket about my troubles trying to compile mkxp on Mac OS X. I have succeeded in doing so by now, but I don't know where else I could write the instructions I wanted to share with people, so I wrote them here. Feel free to move them wherever suits you, this issue ticket probably isn't the best place, sorry.
I had a lot of troubles building mkxp on Mac OS X so I'll explain the procedure to everyone interested.
Unfortunately, I'm pretty sure I already forgot some part of what I did. At least you have some kind of guideline to start from! Let me know if you encounter problems building mkxp on Mac OS X using these instructions, I'll check what I did that isn't described here and I'll fix it.
To compile mkxp on Mac OS X, you first need to install MacPort (http://www.macports.org/), because it will help getting some of the depencies.
Use MacPort to install the following dependencies:
The syntax is sudo port package, like sudo port boost.
Get libsigc++ sources from their website: http://libsigc.sourceforge.net/ and compile it.
Decompress the archive, then run the following commands:
./configure
make
make install
Do the same for latest pixman that you can find at http://cairographics.org/snapshots/.
Again, the same for:
PhysFS is a bit different, you need Mercurial (http://mercurial.selenic.com/) to be able to download it.
Use the command: hg clone http://hg.icculus.org/icculus/physfs/
Which will create a physfs folder containing the sources. Enter it and build physfs like the previous dependencies.
SDL_Sound is more tricky, you need to use the command:
hg clone http://hg.icculus.org/icculus/SDL_sound/
Which will create a SDL_sound folder. We now need to patch SDL_sound sources with the provided patches for mkxp.
First enter the directory using the command cd SDL_sound.
Then patch the sources using the following command, where, PATH is the path to the folder of your mkxp sources where the pkgconfig.patch lies, for me it is /Users/Malorne/mkxp/patches/SDL_sound:
patch < PATH/pkgconfig.patch
Now you can compile SDL_sound like you did with previous packages.
Now you have all the depencies! Congratulations!
In mkxp root sources folder, use qmake -spec macx-g++.
If everything went fine, you should now have a file called Makefile. Unfortunately, I don't know why but qmake generates a wrong Makefile, at least for Mac OS X.
You have to edit the Makefile to replace "-lGL" by "-framework OpenGL" and "-lboost_program_options" by "-lboost_program_options-mt".
You can now make it, you should then have a mkxp application in the form of a mkxp.app application folder.
You have two possibles ways of running your game with mkxp on OSX.
Either you copy the mkxp executable file that is at mkxp.app/Contents/MacOS/mkxp and you put it at the root of your game files, or you put your game files into the mkxp.app/Contents/Resources/ folder.
I prefer the second way, as it will yield a nice runnable application containing all the required files to run your game, which is the standard way applications are bundled on OSX.
If you encounter any problem building mkxp on Mac OS X, let me know !
The text was updated successfully, but these errors were encountered: