shinyspirtomb / mupen64plus

Automatically exported from code.google.com/p/mupen64plus
0 stars 0 forks source link

OSX 10.7+ (XCode 4.3+) build issues/fixes #532

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I originally posted this in the Wiki, but I figure reporting this might be a 
better way to get the devs/others to see this problem/fix. At the moment, 
mupen64plus 1.99.5 doesn't build on OSX 10.7 with XCode 4.3+. I got mupen to 
build from source on OSX 10.7 with some minimal modifications to the build 
scripts. 

First off, starting from XCode 4.3, SDKs are no longer located at 
/Developer/SDKs. Secondly, the 10.5 SDK is pretty old, and most users with 10.7 
or higher are unlikely to have it (or even have the 10.6 SDK).

So almost all Makefiles have to be changed for the OSX portion. Here's a fix to 
determine which SDK to link to and where it is:

  # Select the proper SDK
  # Also, SDKs are stored in a different location since XCode 4.3
  OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .)
  OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .)
  OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .)
  OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`")
  ifeq ($(OSX_XCODEGE43), 11)
    OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
  else
    OSX_SYSROOT := /Developer/SDKs
  endif

I usually put this in the OSX part of the "# set special flags per-system" 
section. Then CFLAGS need to be changed so that the -mmacosx-version-min and 
-isysroot flags reflect the detected settings:

-mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk

Additionally, this means that you could specify the SDK to use by setting the 
OSX_SDK environment variable.

This should fix the biggest issues. There were some minor other issues with the 
third-party plugins and the console UI (I think); basically projects which use 
OpenGL or SDL, or other libraries which are detected either through pkg-config 
or sdl-config or some such.

First, on OSX (at least for 10.7), OpenGL headers are included as 
<OpenGL/gl.h>, <OpenGL/glext.h>, etc., and not <GL/gl.h>, or <GL/glext.h>.

Secondly, as far as I know, for anything using `pkg-config --cflags` or 
`sdl-config --cflags` and the likes, it's usually recommended to include the 
headers directly, and not as <SDL/SDL.h> or <GL/glew.h>, i.e. it's better to 
include <SDL.h> directly, since `sdl-config --cflags` should return something 
like -I/usr/local/include/SDL, i.e. a direct path to the directory containing 
SDL.h and the likes.

Finally, there was a minor issue with the ASM optimizations for Glide64, in 
Main.cpp, which I fixed by replacing the following

asm volatile ("bswap %[cur]"
           : [cur] "=g"(cur)
           : "[cur]"(~*(data++))
           );

with

asm volatile ("bswap %1"
       : "=r"(cur)
       : "r"(~*(data++))
 );

Admittedly, I'm no expert with ASM, so I could be doing something wrong here.

There might've been other minor things, but I think that's the gist of it.

Original issue reported on code.google.com by n.pepi...@gmail.com on 30 Dec 2012 at 10:52

GoogleCodeExporter commented 8 years ago
The patches for Richards parts were just merged. The extra plugins are awaiting 
wahrhafts judgement

Thanks

Original comment by s...@narfation.org on 1 Jan 2013 at 4:52

GoogleCodeExporter commented 8 years ago
ecsv has posted better changes for the ASM stuff on the bitbucket repo, so 
hopefully those'll be accepted :)

Original comment by n.pepi...@gmail.com on 1 Jan 2013 at 4:54

GoogleCodeExporter commented 8 years ago
Issue 482 has been merged into this issue.

Original comment by s...@narfation.org on 3 Jan 2013 at 4:06

GoogleCodeExporter commented 8 years ago
This can probably be closed, since the latest source contains those fixes 
(except for the third party plugins).

Original comment by n.pepi...@gmail.com on 3 Jan 2013 at 4:09

GoogleCodeExporter commented 8 years ago

Original comment by s...@narfation.org on 3 Jan 2013 at 4:14