Search code examples
macosmakefileosx-liond

Derelict2 on Mac OS X 10.7: SDL failing to build


I'm trying to build Derelict2 on Lion as per the included installation instructions. When I run the command make -fmac.mak DC=dmd the following libraries build fine:

  • DerelictAllegro
  • DerelictFMOD
  • DerelictFT
  • DerelictGL
  • DerelictIL
  • DerelictODE
  • DerelictOgg
  • DerelictPA

Unfortunately once the script gets up to DerelictSDL it spits out the following:

make -C DerelictSDL all PLATFORM=mac
dmd -release -O -inline -I../DerelictUtil -c derelict/sdl/sdl.d derelict/sdl/sdlfuncs.d derelict/sdl/sdltypes.d -Hd../import/derelict/sdl
dmd -release -O -inline -I../DerelictUtil -c derelict/sdl/macinit/CoreFoundation.d derelict/sdl/macinit/DerelictSDLMacLoader.d derelict/sdl/macinit/ID.d derelict/sdl/macinit/MacTypes.d derelict/sdl/macinit/NSApplication.d derelict/sdl/macinit/NSArray.d derelict/sdl/macinit/NSAutoreleasePool.d derelict/sdl/macinit/NSDictionary.d derelict/sdl/macinit/NSEnumerator.d derelict/sdl/macinit/NSEvent.d derelict/sdl/macinit/NSGeometry.d derelict/sdl/macinit/NSMenu.d derelict/sdl/macinit/NSMenuItem.d derelict/sdl/macinit/NSNotification.d derelict/sdl/macinit/NSObject.d derelict/sdl/macinit/NSProcessInfo.d derelict/sdl/macinit/NSString.d derelict/sdl/macinit/NSZone.d derelict/sdl/macinit/runtime.d derelict/sdl/macinit/SDLMain.d derelict/sdl/macinit/selectors.d derelict/sdl/macinit/string.d     -Hd../import/derelict/sdl/macinit
derelict/sdl/macinit/NSString.d(134): Error: cannot implicitly convert expression (this.length()) of type ulong to uint
derelict/sdl/macinit/NSString.d(135): Error: cannot implicitly convert expression (str.length()) of type ulong to uint
derelict/sdl/macinit/NSString.d(140): Error: cannot implicitly convert expression (cast(ulong)(selfLen + aStringLen) - aRange.length) of type ulong to uint
make[1]: *** [dmd_mac_build_sdl] Error 1
make: *** [DerelictSDL_ALL] Error 2

Solution

  • The latest version of Derelict is Derelict3, which is on GitHub.

    As for your error, it looks like you are compiling for 64-bit, which apparently hasn't been taken into consideration in Derelict2.

    You'll just need to fix the source code. The correct way to do this would be to change those instances to use size_t instead of uint, but it might be easier just to cast(size_t) those expressions until the errors go away :-) It's unlikely that the lengths will ever be above 4 billion, so you should be fine until you switch over to Derelict3.