Compiling for OSX Mavericks

  • minecraft-physics
    1st Feb 2014 Member 0 Permalink

    Yes, this topic again. After following up on SDL, I found a patch that involved deleting one of the outdated lines of code; and so far I have been able to compile scons and SDL. The problem has come with TPT itself now; when I type

     

    scons --macosx --release --stable --sse2 --nofft

     

    It gives the error

     

    SCons Error: --stable option requires an argument

     

    Instead, I decided to remove the --stable option, giving me this

     

    Input:

    scons --macosx --release --sse2 --nofft

    Output:

    (A bunch of stuff)
    src/PowderToySDL.cpp:6:10: fatal error: 'SDL.h' file not found #include "SDL.h" ^

     

    It seems to be SDL bringing up the problem again. Can anyone advise what to do? The SDL folder itself seems to be missing the suspect  src/SDL.h file; but it does have a src/SDL.c file.

    Edited once by minecraft-physics. Last: 1st Feb 2014
  • boxmein
    1st Feb 2014 Former Staff 1 Permalink
    @minecraft-physics (View Post)
    Well you'll need the SDL headers, not the source code (.c files). See if you have a directory like this under your include directory:
    http://puu.sh/6FYzQ.txt

    If not, acquire the Mac OS X Runtime Library package, extract it or something and then follow this path inside it:
    SDL-1.2.15-OSX10.4/2/SDL/SDL.framework/Versions/A/Headers
    .
    It contains the headers you'll need for development.
    Copy/paste them into
    /usr/include/
    both under the SDL directory and right into there.
    Basically, depending on project, people might use
    "SDL/SDL.h"
    and
    "SDL.h"
    (which are automatically tried for every path in the include directories, the most known of which is /usr/include)

    Alternatively, if you don't like having SDL in your /usr/include, which is okay, you can also specify the exact path under which to find SDL.h with
    --sdl-dir="~/some_folder/"


    Then XCode's command-line tools should find the headers as necessary and compile your project fine.
    Edited once by boxmein. Last: 1st Feb 2014
  • minecraft-physics
    1st Feb 2014 Member 0 Permalink

    I have all of these files in the include folder, but specifying --sdl-dir="~/Desktop/Programming/SDL-1.2.15"

     

    as an argument to scons doesn't seem to affect the outcome.

    --sdl-dir="~/Desktop/Programming/SDL-1.2.15/include"

    doesn't seem to do it either. I think I might have made a mistake... 

     

     

    Oh no whoops I meant to post in Development Assistance... Can a mod move it pls?
    EDIT: Thanks

    Edited 2 times by minecraft-physics. Last: 2nd Feb 2014
  • minecraft-physics
    2nd Feb 2014 Member 0 Permalink

    Anyone?

  • minecraft-physics
    5th Feb 2014 Member 0 Permalink

    UPDATE: After asking a question on Stack Overflow I managed to get it to start compiling until this happened:

    /SDL-1.2.15/include src/cat/LegacyLuaAPI.cpp

    In file included from src/cat/LegacyLuaAPI.cpp:10:

    src/cat/LuaScriptInterface.h:6:10: fatal error: 'lua.h' file not found

    I don't even have this file. Where do I get it, is it actually needed for OSX, and how to I get scons to recognise it?  

    Edited once by minecraft-physics. Last: 5th Feb 2014
  • wolfy1339
    5th Feb 2014 Member 0 Permalink

    @minecraft-physics (View Post)

    Do you have the lua5.1 development packages installed.

    If so, try specifying the location of the headers.

  • jacob1
    5th Feb 2014 Developer 0 Permalink
    The mac guide is very incomplete (needs updating), and as far as I can tell does not use lua. If you don't have lua, use the argument --nolua and tpt won't be compiled with the lua console, might fix things.

    https://powdertoy.co.uk/Wiki/W/Compiling_for_Mac_OS_X.html is the old guide, it has instructions on getting lua. Maybe with this you could compile it with the lua console, just find where it's installed. Telling me what you did so I can update the guide would be nice :D, although I still can't test it.
  • nucular
    5th Feb 2014 Member 0 Permalink
    @minecraft-physics
    Either you download the Lua 5.1 source from here and then specify the path to the directory where lua.h is using the --lua-path flag OR you just use the --nolua flag, which disables all scripting features though.
  • minecraft-physics
    6th Feb 2014 Member 0 Permalink

    Let me try...

    BTW I have been updating the wiki as my saga continues. Turns out I had to modify SConstruct a bit...

     

    EDIT: WIth the --nolua flag (I just want the damn thing to work) it's failing to recognise strcasecmp() in src/cat/TPTScriptInterface.cpp, it seems be failing to recognise one of the header files? which one?

    Edited once by minecraft-physics. Last: 6th Feb 2014
  • jacksonmj
    6th Feb 2014 Developer 0 Permalink

    What exactly do you mean by "failing to recognise"?

     

    According to this man page, strcasecmp is in strings.h, which should be included on line 7 of TPTScriptInterface.cpp (provided MACOSX is defined by scons), and the function resides in the standard C library (libc, -lc).