Compiling current SDL 1.3 on XCode?

I’ve got Snow Leopard and XCode 3.2.1. Did a “hg clone” of the latest SDL earlier today. It build just fine under Terminal, but with XCode, both the SDL and SDL Test projects fail, complaining that “SDL_revision.h” is missing (from 38 or so references). I found a copy of this file from an older version of SDL 1.3 I had from last year, and put this in the header’s folder. Compile again, and XCode instantly deletes the file! I repeat this process, and XCode deletes the file each time, as soon as it starts building the project. (If I move the file into the Headers folder mid-build, it gets deleted the instant I move it.)

Any idea what’s going on here?

Side-note: The Read Me for MacOS X that comes with SDL 1.2 neglects to mention the step ./autogen.sh before doing ./configure. I couldn’t get it to build in Terminal until a friend told me to do this first, then viola, it works. Updating the read me would help for Unix newbies like me. :wink:

So the SDL_revision.h is supposed to be a dynamically generated file.
You are not supposed to copy this from somewhere else. Unfortunately,
the commands needed to generate the project require Mercurial which on
my last attempt has caused some problems. The issue is that some of
the underlying scripts invoke the ‘hg’ command to get certain info to
generate the file. But since Mercurial is a non-standard component, it
is not typically installed into a path that is searched by the default
environment. So when ‘hg’ is executed, it is not found because Xcode
does not inherit any environmental variables from anything you might
setup in your shells.

Unfortunately, I haven’t come up with a good solution yet. Currently,
my solution adds a ‘source .bashrc’ in one of the Xcode shell script
phases before the SDL scripts get invoked hoping to capture a path
export to Mercurial. But this will fail if the path is not declared in
that script, for instance if you changed the default shell to zsh,
csh, etc, or it was never added in the first place.

So for the moment, to see if this is the problem, you might humor me
and delete the SDL_revision.h file and make sure something like:
export PATH="$PATH:/usr/local/bin"
is inside your ~/.bashrc file.
(/usr/local/bin should be the path to where your hg is installed to)

If it works, this was the problem.

I don’t have a good general solution to this yet. (I’d rather avoid
doing a full brute-force disk search.)

I’m not sure why the SDL_revision.h is getting deleted by Xcode
though. I did setup some dependency tracking in Xcode for some of the
generated files like this one, but it’s not immediately obvious to me
why its being deleted.

-EricOn 5/21/10, VernJensen wrote:

I’ve got Snow Leopard and XCode 3.2.1. Did a “hg clone” of the latest SDL
earlier today. It build just fine under Terminal, but with XCode, both the
SDL and SDL Test projects fail, complaining that “SDL_revision.h” is missing
(from 38 or so references). I found a copy of this file from an older
version of SDL 1.3 I had from last year, and put this in the header’s
folder. Compile again, and XCode instantly deletes the file! I repeat this
process, and XCode deletes the file each time, as soon as it starts building
the project. (If I move the file into the Headers folder mid-build, it gets
deleted the instant I move it.)

Any idea what’s going on here?

Side-note: The Read Me for MacOS X that comes with SDL 1.2 neglects to
mention the step ./autogen.sh before doing ./configure. I couldn’t get it to
build in Terminal until a friend told me to do this first, then viola, it
works. Updating the read me would help for Unix newbies like me. :wink:

Whaddya know, that totally did the trick!

I actually didn’t even have a ~/.bashrc file. So now one exists, with the single line you suggested putting in it. And now SDL and SDLTest both compile and run great! Thanks so much. :slight_smile: