The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 02:24:27 pm
Home Help Search Login Register
News: Celebrating 30 years of Star Control 2 - The Ur-Quan Masters

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  Technical Issues (Moderator: Death 999)
| | |-+  Problems compiling on Mac OS 10.13.3
« previous next »
Pages: [1] 2 Print
Author Topic: Problems compiling on Mac OS 10.13.3  (Read 4339 times)
Kanhef
Zebranky food
*
Offline Offline

Posts: 13



View Profile
Problems compiling on Mac OS 10.13.3
« on: August 17, 2018, 12:19:12 am »

So, I'm trying to build from source after making a few changes, and I've run into a familiar-looking error or two. When running
./build.sh uqm config
it gives me
fatal error: "SDL/SDL_version.h" file not found
Also, Rez is not found.

As per the installation instructions included with source, SDL and SDL_image have been placed in /Library/Frameworks. Instructions say SDL-devel is optional, so it is not installed. I've tried using CFLAGS to include the SDL headers directory, but it has no effect on the output.

Having read through much of this forum, I see that a number of people have had similar issues over the years, and a few even seem to have resolved them, but it is unclear how. This post seems to reference the issues I'm having, but doesn't say how to fix them. Detailed instructions on how to get everything where the build script can find it would be much appreciated. I'd prefer to not have to install fink/macports/etc just for this one thing, but can if it's the only way to make it work.
Logged
Kohr-Ah Death 213
Enlightened
*****
Offline Offline

Posts: 1372



View Profile WWW
Re: Problems compiling on Mac OS 10.13.3
« Reply #1 on: August 17, 2018, 01:28:26 am »

Which version of the source are you compiling from?

I know first hand building in macOS can be a pain so I'll do my best to help.

EDIT:

I checked out the most recent version of the source code and it does behave better in macOS than before but it still loves to give off the SDL.H is not found error.
Resulting in an uncountable amount of compiler errors.

EDIT:

I'm going to create a quick fix you can drop into the source code that will get you to be able to compile without any hitches, hopefully. But it's going to take me a minute.
« Last Edit: August 17, 2018, 02:53:58 am by Serosis » Logged

The artist once again known as Kohr-Ah Death 213.

Get your MegaMod HERE
Kanhef
Zebranky food
*
Offline Offline

Posts: 13



View Profile
Re: Problems compiling on Mac OS 10.13.3
« Reply #2 on: August 17, 2018, 02:32:37 am »

UQM 0.7.0-1

Also, which version of SDL and SDL-image should be used? http://sc2.sourceforge.net/downloads.php says SDL-image 1.2.10, but INSTALL.macosx says there are issues with anything after SDL-image 1.2.7 .

Thanks!
Logged
Kohr-Ah Death 213
Enlightened
*****
Offline Offline

Posts: 1372



View Profile WWW
Re: Problems compiling on Mac OS 10.13.3
« Reply #3 on: August 17, 2018, 02:54:15 am »

Unzip and move the two resulting files to the sc2/build/unix directory: http://files.serosis.net/Misc/macOS-Fix.zip

That should get you to build on High Sierra for the time being until the code is properly fixed.

Use the latest SDL and SDL_Image that you can, which would be 1.2.15 and 1.2.12 respectively.
Anything lower I believe does not work on macOS anymore.

« Last Edit: August 17, 2018, 03:06:18 am by Serosis » Logged

The artist once again known as Kohr-Ah Death 213.

Get your MegaMod HERE
Kanhef
Zebranky food
*
Offline Offline

Posts: 13



View Profile
Re: Problems compiling on Mac OS 10.13.3
« Reply #4 on: August 17, 2018, 05:57:58 am »

Well, it gets through config now, after some tweaking. In config_proginfo_host:
LIB_SDL_LDFLAGS='-F/Library/Frameworks -framework SDL -framework Cocoa -lobjc'

Preprocessor is throwing a fit with "unterminated conditional directive" errors. Noticed that I have a somewhat older version of Xcode installed, updating it to see if that fixes things.
Logged
Kohr-Ah Death 213
Enlightened
*****
Offline Offline

Posts: 1372



View Profile WWW
Re: Problems compiling on Mac OS 10.13.3
« Reply #5 on: August 17, 2018, 06:07:38 am »

I simply used the command line tools without Xcode.

Maybe that's the problem.

Since you're using full-blown Xcode pop open your config_proginfo_build, search for PROG_Rez_NAME="Rez resource compiler (Apple Developer Tools)"
Right below that there's a line that says PROG_Rez_FILE="Rez", change that to say PROG_Rez_FILE="/usr/bin/Rez".
Logged

The artist once again known as Kohr-Ah Death 213.

Get your MegaMod HERE
Kanhef
Zebranky food
*
Offline Offline

Posts: 13



View Profile
Re: Problems compiling on Mac OS 10.13.3
« Reply #6 on: August 18, 2018, 03:05:24 am »

So, somehow a newline got deleted from src/libs/compiler.h, putting a #endif on the same line as a #define. No wonder the preprocessor had issues.

Adapted your fix to set LIB_SDL_image_CFLAGS and LDFLAGS. A few warnings, most of which look relatively inconsequential (though the array bounds violation in src/libs/input/sdl/vcontrol.c:1266 might cause issues). Only error is that it's trying to compile Ogg Vorbis support, even though that's supposed to be optional and it's configured not to use Ogg. Ah well, not the worst thing to have to deal with.

Edit: A bit less straightforward than I expected. Building Ogg/Vorbis only seems to produce x86-64 code, but UQM needs a i386 library to link to. Can't seem to find a precompiled framework, except for one that's meant for iOS. Even with that, linking fails:
Undefined symbols for architecture i386:
  "_IMG_Load_RW", referenced from:
      _sdluio_loadImage in sdluio.c.o

There are a bunch more similar errors if I configure it to not use Ogg, all from oggaud.c
« Last Edit: August 18, 2018, 08:17:31 pm by Kanhef » Logged
CelticMinstrel
Enlightened
*****
Offline Offline

Posts: 522



View Profile
Re: Problems compiling on Mac OS 10.13.3
« Reply #7 on: August 21, 2018, 05:10:22 am »

That missing symbol is from SDL_Image - do you have that installed?
Logged
Kanhef
Zebranky food
*
Offline Offline

Posts: 13



View Profile
Re: Problems compiling on Mac OS 10.13.3
« Reply #8 on: August 21, 2018, 07:39:24 am »

Yeah, it compiles to object code just fine, so it's finding the SDL image header files, but it seems like it can't find the shared library when it goes to link everything. The build script is fairly convoluted, so I'm having trouble understanding what exactly is going on at this step, and why it doesn't work right.
Logged
Kohr-Ah Death 213
Enlightened
*****
Offline Offline

Posts: 1372



View Profile WWW
Re: Problems compiling on Mac OS 10.13.3
« Reply #9 on: August 21, 2018, 07:48:28 am »

Are you using the latest SDL & SDL_Image or what the Install file recommends?
Because the older versions of SDL absolutely do not behave with High Sierra at all.
Logged

The artist once again known as Kohr-Ah Death 213.

Get your MegaMod HERE
Kanhef
Zebranky food
*
Offline Offline

Posts: 13



View Profile
Re: Problems compiling on Mac OS 10.13.3
« Reply #10 on: August 21, 2018, 01:25:27 pm »

SDL 1.2.15, SDL-image 1.2.12
Logged
Kohr-Ah Death 213
Enlightened
*****
Offline Offline

Posts: 1372



View Profile WWW
Re: Problems compiling on Mac OS 10.13.3
« Reply #11 on: August 21, 2018, 02:10:54 pm »

Try this for me.

Get a fresh copy of the source, slap those two edited files I uploaded for you into it and see if it compiles.
It definitely should compile with a few warnings.

Another option to try is to clear the frameworks you downloaded by instruction from the Install file and instead pull them straight out of the official macOS release: https://sourceforge.net/projects/sc2/files/UQM/0.7/uqm-0.7.0-1-macosx.dmg/download

That way you know you are using the frameworks that were actually used to build it.
Logged

The artist once again known as Kohr-Ah Death 213.

Get your MegaMod HERE
Kanhef
Zebranky food
*
Offline Offline

Posts: 13



View Profile
Re: Problems compiling on Mac OS 10.13.3
« Reply #12 on: August 22, 2018, 12:27:59 am »

Fresh copy of source plus Sarosis' config files.

Config fails: Simple DirectMedia Layer not found.

Add '-F/Library/Frameworks' to LIB_SDL_LDFLAGS in config_proginfo_host. Get errors about 'SDL/SDL.h' not found.

Okay, the full path to SDL.h is /Library/Frameworks/SDL.framework/Versions/Current/Headers/SDL.h, not contained in an SDL directory. 'cd /Library/Frameworks/SDL.framework/Headers ; ln -s . SDL' makes a symlink so the path will resolve.

No more SDL.h errors, but can't find 'SDL_image/SDL_image.h'.
LIB_SDL_image_CFLAGS='-I/Library/Frameworks/SDL_image.framework/Headers'
LIB_SDL_image_LDFLAGS='-F/Library/Frameworks -framework SDL_image'

And the same symlink trick.

Compiles and links. Okay, pull out FileMerge to figure out what's different.

Derp.

Lib_SDL_image_LDFLAGS="-F/Library/Frameworks -framework SDL

Copy-and-paste without double-checking got me. Working 50-60 hour weeks probably hasn't been helping either.

Try to install, can't find SDL/SDL.h and SDL_image/SDL_image.h again. Looking at build.config, it's trying to copy frameworks into the app, but nothing in the command to locate them is telling it to look in /Library/Frameworks, rather than the standard include directories.
Logged
CelticMinstrel
Enlightened
*****
Offline Offline

Posts: 522



View Profile
Re: Problems compiling on Mac OS 10.13.3
« Reply #13 on: August 22, 2018, 02:46:37 pm »

Rather than

Code:
LIB_SDL_image_CFLAGS='-I/Library/Frameworks/SDL_image.framework/Headers'

I believe you're supposed to use

Code:
LIB_SDL_image_CFLAGS='-framework SDL_image'
Logged
Kanhef
Zebranky food
*
Offline Offline

Posts: 13



View Profile
Re: Problems compiling on Mac OS 10.13.3
« Reply #14 on: August 22, 2018, 11:38:04 pm »

Compiling process is working; it doesn't find the frameworks without using -I. Current hangup is in this part of build.config:
   # Find Frameworks and copy them into the application.
   echo "Copying dependancy Frameworks..." >&2
   HEADERS="ogg/ogg.h SDL.h SDL_image.h vorbis/vorbisfile.h"
   if [ "$uqm_SOUNDMODULE" = openal ]; then
      HEADERS="$HEADERS OpenAL/al.h"
   fi
   for HEADER in $HEADERS; do
      HEADER_FILE=`basename $HEADER`
      eval FRAMEWORK=`echo '' | \
            $PREPROC_C -D__MACOSX__ -include $HEADER - | \
            awk '(/'$HEADER_FILE'/ && $2 == 1) { print $3; exit }' | \
            $SED 's/.Headers.*$/"/'`
      cp -r "$FRAMEWORK" "$INSTROOT/Frameworks"
   done

It's checking standard include directories, but not /Library/Frameworks/ .
Logged
Pages: [1] 2 Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!