ENIGMA Forums

General fluff => General ENIGMA => Topic started by: sorlok_reaves on August 26, 2014, 02:06:54 AM

Title: OSX Trials and Tribulations
Post by: sorlok_reaves on August 26, 2014, 02:06:54 AM
Hello all,

So, I've been trying to get ENIGMA running on OSX Mavericks, but it seems that it's been some time since anyone used it. (If there are any OSX ENIGMA users out there, please chime in.) Problems are listed in order of appearance.

The compiler still hardcodes the include "/opt/X11/include", when it should be "/opt/local/include" (assuming MacPorts).

The application links "./ENIGMA" as the project path, when it should link "../ENIGMA" (or possibly ../../ENIGMA) due to how the working directory functions.

The built application is missing an Info.plist, so OSX complains it can't launch it. (This is probably related to the next issue.)

Adding an Info.plist to the built app and telling it "this is a Cocoa app" will cause the app to launch a terminal describing the current working directory, and then there's no further output. No OpenGL window is shown.

I'd really like to figure out how to get around these errors, but I'm not experienced with Mac development. Anyone have any ideas?
Title: Re: OSX Trials and Tribulations
Post by: TGMG on August 26, 2014, 11:59:51 AM
Did you do this:
After cloning the repository run the following command in terminal to install the main binary files
python install.py mac

What do you mean ./ENIGMA in the project path? what project, the xcode project?

I still seems to work for me...
Title: Re: OSX Trials and Tribulations
Post by: sorlok_reaves on August 26, 2014, 12:17:34 PM
Did you do this:
After cloning the repository run the following command in terminal to install the main binary files
python install.py mac

What do you mean ./ENIGMA in the project path? what project, the xcode project?

I still seems to work for me...

Thanks for the feedback; I noticed that you've fixed a lot of OSX things in the past.

I actually ran "python install.py", but not "python install.py mac". I will try that.

In terms of ./ENIGMA in the path, I am trying to run a default (empty) project from LateralGM. So, I run "java -jar lateralgm.jar", then click "Run". The gcc output line includes "-I./ENIGMA", but it can't find the Preprocessor_Environment_Editable files (that ShellMain #includes) until I add "-I../ENIGMA".
Title: Re: OSX Trials and Tribulations
Post by: Josh @ Dreamland on August 26, 2014, 09:20:32 PM
Expert timing, TGMG. Nice to see you're still alive!

FWIW, uname -s works on the two operating systems you're trying to get install.py to support. :P

Anyway, cheeseboy moved those preprocessor_etc files since TGMG wrote the OS X port. It's probably a simple matter of figuring out where they end up on OS X and updating paths in the XCode project. I wouldn't own an Apple, so I can't be much help.
Title: Re: OSX Trials and Tribulations
Post by: sorlok_reaves on August 30, 2014, 06:47:34 PM
Ok, thanks for the advice. I've had some luck building simple games; I'll update everyone once Iji builds.
Title: Re: OSX Trials and Tribulations
Post by: sorlok_reaves on August 31, 2014, 08:33:26 PM
We have progress:
(http://i.imgur.com/Pw2x8cX.png)

Unfortunately, the game crashes immediately upon switching rooms with the following error message:
Code: [Select]
2014-08-31 18:19:03.027 EnigmaXcode[24227:7c03] self is not first responder
Bus error: 10
logout

I'll be working on OSX support as I can find time. However, I must note that the current code is NOT sufficient (or I am doing something very wrong). In particular:

The Iji port is so very close to working on OSX, but I think I've reached the limits of my creativity. I'll revisit this later, but if anyone knows what the "Bus error: 10" or "self is not first responder" messages mean, I'd really appreciate some feedback. For the record, I'm compiling with Lateral GM and gcc-4.8 from Macports.
Title: Re: OSX Trials and Tribulations
Post by: Josh @ Dreamland on August 31, 2014, 08:57:13 PM
The JDI bug... concerns me, vaguely. Do you know what JDI git revision ENIGMA master is on? This is probably something I've already fixed. If not, I'll ask you to send me a preprocessed version of the engine so I can triage it.
Title: Re: OSX Trials and Tribulations
Post by: sorlok_reaves on August 31, 2014, 09:12:34 PM
What's the easiest way to tell what JDI revision master is on? Also, I guess I am slightly off of master on my branch. The JDI I am using is this:
https://drive.google.com/file/d/0B1P7NepPcOslOVNsa0Y4eUNHb3c

Fixing so that this works with the default OSX gcc would be great, but I think it probably won't fix the runtime error I'm seeing.
Title: Re: OSX Trials and Tribulations
Post by: sorlok_reaves on September 01, 2014, 12:41:09 PM
Ok, strangely, although compiling on OS-X is still not working right, I can cross-compile from Linux and the resulting binary runs on OS-X. Behold!
https://www.youtube.com/watch?v=qg-aRfj-_WI&feature=youtu.be

Thanks to everyone for your help on this; I guess for now I'm pretty happy to be able to compile for all 3 systems from Linux, as it's faster and easier for me.
Title: Re: OSX Trials and Tribulations
Post by: Goombert on September 01, 2014, 02:48:02 PM
I'd like to add that I am honestly surprised there are not a million more errors on Mac considering I've been contributing to that part of the repository for months without testing.

But I would like to ask how are you compiling for Windows from Linux? Using a VM or a cross-compiler?
Title: Re: OSX Trials and Tribulations
Post by: sorlok_reaves on September 01, 2014, 03:11:15 PM
Using a cross-compiler, detailed here:
http://enigma-dev.org/docs/Wiki/CrossCompileWithAudio

I am still having problems loading MP3s using this approach, so there's at least 1 thing I'm doing wrong.... but WAVs work.
Title: Re: OSX Trials and Tribulations
Post by: Goombert on September 02, 2014, 10:36:35 AM
I think you built OpenAL wrong because you need to compile it with the formats you expect to use. For instance take a look at sound_add it just reads the binary and then hands it to OpenAL.
Title: Re: OSX Trials and Tribulations
Post by: sorlok_reaves on September 04, 2014, 10:01:40 AM


UPDATE: I would appreciate it if the OS-X developers could have a look at the following pull request and provide any feedback or criticism. (In addition to the normal devs, of course.)
https://github.com/enigma-dev/enigma-dev/pull/813



I think you built OpenAL wrong because you need to compile it with the formats you expect to use. For instance take a look at sound_add it just reads the binary and then hands it to OpenAL.

Thanks, I'm beginning to suspect that I did in fact build it wrong. This bug is high on my list; 150MB of WAV files is no fun for an 8 year old game.