JHGuitarFreak / UQM-MegaMod

A fork of The Ur-Quan Masters + HD-mod that remasters the HD graphics with a veritable smorgasbord of extra features, options, QoL improvements, and much more...
https://uqm-mods.sourceforge.net
GNU General Public License v2.0
78 stars 22 forks source link

[question] Help building for 64-bit macOs Catalina #30

Closed nagualcode closed 4 years ago

nagualcode commented 4 years ago

Hello, I really would like to play on my mac, that is Catalina. Could someone help building ? Older building wont run. The Ur-Quan Masters (vanilla) runs without a problem.

Serosis commented 4 years ago

Unfortunately I do not have a Mac that can run Catalina (2010 iMac is not supported).

There's nothing I can really do at this time without outside help from other Apple devs.

Sorry.

nagualcode commented 4 years ago

Second option would be to run linux on virtualbox. Is there any linux distro supporting ?

Serosis commented 4 years ago

Sorta kinda.

I haven't tested it recently but I've heard it does compile and run.

JoshuaPettus commented 4 years ago

Well I don't have a Mac environment anymore but I use to be heavy into compiling stuff. I haven't touched the OS since 10.12 And Its been years since I built mega mod, but I do know it worked at one point. You just have to make sure you have the frameworks in the right places and that they aren't stripped down versions without headers, XCode's command line utilities setup and use macports for any holes.

Couple of other thoughts:

You can compile a program on an earlier version of the OS and for the most part will run just fine on a later versions of the OS minus a few major milestones: The PowerPC to Intel switch after 10.5 and the the dropping of all 32bit support last year. I did hear that Gatekeeper has changed in Catalina so I wonder if that's now an issue...

I can also tell you VirtualBox will run on any linux distro and also Windows 10. Windows 10 also has HyperV but I don't know how feasible that is. OSX runs fine in VirtualBox but you still have all of the same problems you would setting up an actual Hackintosh. Especially if you have an AMD processor or graphics card. If you do, your not totally out, but you have to do a lot of research. There is a whole community dedicated to creating modified OSX kernels for such hardware.

nagualcode commented 4 years ago

I guess your 2010 imac can compile a 64-bit only osx executable. https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/64bitPorting/building/building.html I will be happy to test it for you.

JoshuaPettus commented 4 years ago

Actually the earlier os is better. 10.13 should be able to run a 64 bit app from 10.11 but not the other way arround. Barring you arnt using any features of the later OS and your dependencies work on tge older one. Thats why i use to build my apps as 64 bit on a 10.6 vm. (Which i lost when my mac laptop died)

But then i guess you are limmited by what sdl2 supports

Serosis commented 4 years ago

Oh, I know it can build it. But my problem has always been will it build.

I've always stuck to building the Mac binaries on Snow Leopard because Xcode 3.2.6 was the only SDK that worked without any major editing. And it also spit out binaries that worked up to High Sierra.

Also, without taking my iMac out of the closet, I know for a fact MegaMod won't be buildable using Xcode 3.2.6 anymore. The change over to SDL2 and the updated Mac install process from McMartin assured that I would have to research how to do it again.

nagualcode commented 4 years ago

Yes, I just tried to compile it here and had problems with SDL2. I wonder what the original Ur-Uquan Masters is doing, theier 2018 binary runs just fine on Catalina.

Serosis commented 4 years ago

I wonder what the original Ur-Uquan Masters is doing, theier 2018 binary runs just fine on Catalina.

Same thing as before but with added x86_64 build process.

Which I am well beyond the point of reversing back in to without undoing all the SDL2 work.

JoshuaPettus commented 4 years ago

There has to be a way to get sdl2 to work. I build 64bit binaries on linux no problem. Sounds like something isnt right with your build environment. Where are you putting your SDL2.framework? Are you sure it has the sdl2.h in it? If you stole it from another app, they may have removed the header files to save space as they arnt needed for runtime

Serosis commented 4 years ago

McMartin uses something called "brew" to get his version built.

Which is probably how I'll have to get MegaMod built when it comes to release time.

JoshuaPettus commented 4 years ago

yeah you can make use of brew, fink or my preferred was macports to download the libraries, but then you get everything as dylibs, which then have to be relinked into the app. (Can be done but it's easy to get into dll heck). Using the OSX standard of frameworks is much easier.

On Thu, Apr 16, 2020 at 1:30 PM Serosis notifications@github.com wrote:

McMartin uses something called "brew" to get his version built.

Which is probably how I'll have to get MegaMod built when it comes to release time.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Serosis/UQM-MegaMod/issues/30#issuecomment-614790340, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGPHZDU4OCOZ7GSQHX2NWLRM46EFANCNFSM4MHVLISQ .

JoshuaPettus commented 4 years ago

Maybe one day I'll get another HD for my computer and make a hackentosh out of it again.

Serosis commented 4 years ago

If I had an Intel CPU I would simply do that on an external drive. But for now I have this god awful 2010 iMac that's heavier than a dying star.

I wish I could keep it plugged in while it's in the closet so I could just Teamviewer into it whenever I need.

JoshuaPettus commented 4 years ago

There is a whole community dedicated to getting OSX running on AMD hardware, but it is time consuming, and even then once you do get it running it's a pain to update (most don't).

I know your pain, the last Apple desktop I bought was a G5, and its a beast...I don't think they have gotten any lighter ever since with their full aluminum construction...

nagualcode commented 4 years ago

as a fix, I started playing the windows version of the game, using the last version of wine32to64, where they magically trunk 32 bit code to 64 bit, so it runs inside Catalina. Performance is good, and soo far, no crashes. Said that, I stand here to help with building and testing a macOS build of this great game, for the next generations to come.

Serosis commented 4 years ago

When it comes time to start testing Mac builds your help will most definitely be welcome.

Serosis commented 4 years ago

To give you an update I was able to successfully build the latest version of the MegaMod in High Sierra using McMartin's methods so when release day comes it should work on 10.6 - 10.15.

Serosis commented 4 years ago

The build process for macOS is a tad ridiculous and very involved if you want a complete .app file that you can move anywhere you want. And it's actually quite simple if you just want to run it in place where you build it.

For the bundled app

Make sure you have installed Perl and Xcode (with additional components installed on first run),

For MegaMod you'll need to clone both the main repository and the content repository (you can nest the content repository inside the main one, then rename it "content". Basically change UQM-MegaMod/UQM-MegaMod-Content to UQM-MegaMod/content).

Then you need to make a new folder inside the main repository called dist-packages. (So UQM-MegaMod/dist-packages) And slap the base content .uqm file in there. (In the content folder ".zip up" base, menu.key, uqm.key, and uqm.rmp and name the resulting .zip file to whatever you want as long as the extension is .uqm)

Onto even more fun stuff...

For SDL2 you need build libogg, libvorbis, and libpng in Xcode "as archives" with a "deployment target of 10.6".
There's also a patch you need to apply for libogg if you're using Xcode under High Sierra (macOS 10.13), like I was. (This patch will only be necessary until it makes its way into mainline libogg.)

You can download SDL2's compiled frameworks straight from their site and they'll work perfectly.

Once you have all that situated you can slap the compiled frameworks in /Library/Frameworks/ Run the build.sh script like so: DEPS_PATH=/Library/Frameworks ./build.sh uqm -j Making sure to choose a release build when the configuration comes up.

Hopefully it link a binary in the root of the UQM-MegaMod repository folder.

If you have a binary, congratulations. Now you can run the Perl script like so: perl ./build/unix_installer/copy_mac_frameworks.pl And it will automagically build you a bundled app.

For running it straight from the binary

Make sure you have installed Xcode (with additional components installed on first run),

For MegaMod you'll need to clone both the main repository and the content repository (you can nest the content repository inside the main one, then rename it "content". Basically change UQM-MegaMod/UQM-MegaMod-Content to UQM-MegaMod/content).

Install Homebrew by opening up a terminal and inputting this command /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Once that is done you can install the frameworks straight from Homebrew by executing this command in terminal: brew install libogg libpng libvorbis sdl2

Then you can go into the UQM-MegaMod repository and run the build script like so: ./build.sh uqm -j This will make a binary that you can run from the same terminal by executing: ./UrQuanMasters or ./UrQuanMastersDebug Depending on if you chose to make a debug or release binary.

And now, I close this issue.

EDIT: Add some clarification on the libogg patch

JoshuaPettus commented 4 years ago

Yup bundling in app bundles are quite a challenge but remember an app bundle is an entire installation not just an executable and everything has to link against the executable in a portable manner... So it can definitely be much more involved :)

Sorry I wasn't able to build my hackentosh and help you out there. I'm afraid equipment just wont do it anymore these days.

Serosis commented 4 years ago

No worries, I shifted all my annoying questions right on to McMartin and with his help I figured out all the nuances

Now I can delete the Snow Leopard partition and use it for hacking Catalina or Big Sur onto my 2010 iMac.

ylluminate commented 1 year ago

Given the new location of Homebrew for Apple Silicon, it appears the build script is no longer working as expected (even when the support libraries are installed):

$ ./build.sh uqm -j
'echo -n' capable echo found.
Sed stream editor found.
tr found.
Make found.
build/unix/config_proginfo_host: line 253: libmikmod-config: command not found
build/unix/config_proginfo_host: line 254: libmikmod-config: command not found
build/unix/config_proginfo_host: line 255: libmikmod-config: command not found
GNU C compiler found.
We have a C preprocessor.
We have a C dependency generator.
We have a C compiler.
We have a C++ preprocessor.
We have a C++ dependency generator.
We have a C++ compiler.
We have a linker.
We have a Objective-C preprocessor.
We have a Objective-C dependency generator.
We have a Objective-C compiler.
Rez resource compiler (Apple Developer Tools) found.
We have a MacOS X resource compiler (Rez).
Little-endian machine detected.
Simple DirectMedia Layer not found.
Simple DirectMedia Layer version 2.x found.
libpng not found.

I'm assuming there's a pkg config variable I'm missing somewhere that needs to be changed or generalized since Homebrew now lives at /opt/homebrew/?