SDL.h not being found when compiling as a universal binary

I’m running into a problem with compiling a universal binary using the SDL
framework. (I assume that the latest stable version of SDL, 1.2.11, is a
universal binary, since it has a “Universal Binary Notes” readme in the SDL
disk image. If that’s not correct, please let me know.)

I’m trying to compile D2X-XL as a universal binary (source available at
http://www.descent2.de/ , download the Windows source code for the latest
source, which still includes Xcode files), but even though it’s a linked
framework, Xcode complains with “error: SDL/SDL.h: No such file or directory"
at the source line “# include <SDL/SDL.h>”. I’ve set the target SDK to be
"Mac OS X 10.4 (Universal)”, and I’ve set the architecture for the active
configuration to compile for both ppc and intel processors.

Can anyone help me out?

– Simone

Just a note: D2X-XL compiles perfectly fine when
I’m not trying to create a universal binary – i.e.:
when the SDK is “Current Mac OS” and the architecture
is just ppc, there are no warnings about SDL.h not
being found.

– Simone

You may need to explicitly specify /Library/Frameworks (or
~/Library/Frameworks) as one of the “Library Search Paths” in the
project settings. When you switch to any SDK including the Universal
SDK, all the default search paths get remapped by Xcode to avoid using
the wrong version of system libraries. Unfortunately, this seems to
affect user paths too. But I thought they fixed this in Xcode 2.3.

-Eric

Simone Manganelli wrote:

I’m running into a problem with compiling a universal binary using the SDL
framework. … even though it’s a linked framework, Xcode complains
with "error: SDL/SDL.h: No such file or directory"
at the source line “# include <SDL/SDL.h>”.

Can you post the complete compiler command line that produces that error
(from the middle split pane of the Build Results window)?

I’ve set the target SDK to be “Mac OS X 10.4 (Universal)”, and I’ve
set the architecture for the active configuration to compile for both
ppc and intel processors.

Just a note: D2X-XL compiles perfectly fine when I’m not trying to
create a universal binary – i.e.: when the SDK is "Current Mac OS"
and the architecture is just ppc, there are no warnings about SDL.h
not being found.

What happens when you use the universal SDK, but compile only for PPC?
Or only for i386? (I can’t see why either the SDK or the architectures
setting would cause your problem, but doing a few experiments can’t hurt…)

-Christian

You may need to explicitly specify /Library/Frameworks (or
~/Library/Frameworks) as one of the “Library Search Paths” in the
project settings. When you switch to any SDK including the Universal
SDK, all the default search paths get remapped by Xcode to avoid using
the wrong version of system libraries. Unfortunately, this seems to
affect user paths too. But I thought they fixed this in Xcode 2.3.

Eric –

You nailed it. I had to set “Framework Search Paths” (not
"Library Search Paths") to include /Library/Frameworks , but once I
did that, it compiled perfectly as a universal binary.

Thanks!

– Simone