Mac help

The saga so far: I managed to get SDL, gcc, and other tools installed on this
borrowed Mac (OSX 10.4 PPC). After a very slight massaging of the source
code, my application now compiles, but I get the following linker error:

/usr/bin/ld: /Library/Frameworks/SDL.frameworks/SDL load command 5 unknown cmd
field

I have no idea what “load command 5 unknown cmd field” means.

Also, although both SDL v1.2.14 and SDL-devel 1.2.14 are installed, there
isn’t any sdl-config program, so I had to comment out references to it in the
Makefile. Is that normal for Macs? Could it have anything to do with the
linker error?

Any help appreciated.

Thanks,
Jeff

I don’t recognize that error. Some Google searches suggest you need to
be using Xcode 2.5 on 10.4 to avoid this problem.

The official framework distribution does not use sdl-config.

Are you able to build a simple test program using the sample Xcode
template or following the gcc instructions in ReadMeDevLite.txt?

-EricOn 2/26/11, Jeff Post <j_post at pacbell.net> wrote:

The saga so far: I managed to get SDL, gcc, and other tools installed on
this
borrowed Mac (OSX 10.4 PPC). After a very slight massaging of the source
code, my application now compiles, but I get the following linker error:

/usr/bin/ld: /Library/Frameworks/SDL.frameworks/SDL load command 5 unknown
cmd
field

I have no idea what “load command 5 unknown cmd field” means.

Also, although both SDL v1.2.14 and SDL-devel 1.2.14 are installed, there
isn’t any sdl-config program, so I had to comment out references to it in
the
Makefile. Is that normal for Macs? Could it have anything to do with the
linker error?


Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

I don’t recognize that error. Some Google searches suggest you need to
be using Xcode 2.5 on 10.4 to avoid this problem.

The version of Xcode I have is whatever came on the CDs; I assume it’s the
correct one.

The official framework distribution does not use sdl-config.

Interesting. Thanks for letting me know.

Are you able to build a simple test program using the sample Xcode
template or following the gcc instructions in ReadMeDevLite.txt?

I had only read ReadMe.txt; thanks for bringing that to my attention.

I’ve attached the Makefile in case that might shed any light on the problem. I
compile natively on Linux, cross compile on Linux to build a Windows binary,
and now trying to compile natively on OSX. Since we have both PPC and Intel
Macs, I’d like to make a universal binary for OSX.

Thanks for your assistance,
Jeff
-------------- next part --------------
A non-text attachment was scrubbed…
Name: Makefile
Type: text/x-makefile
Size: 2462 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20110227/10e6ac56/attachment.binOn Saturday 26 February 2011 23:25, Eric Wing wrote:

Chances are you installed an older version of Xcode (e.g. 2.0). 10.4
was a long-lived/patched OS by Apple standards. This is because it was
released originally for PowerPC, and then the Intel switch happened
and a new version of the OS was made to handle Intel, but it was still
called 10.4. Xcode had to go through many incarnations during this
period to keep up. Most people downloaded new versions of Xcode.

-EricOn 2/27/11, Jeff Post <j_post at pacbell.net> wrote:

On Saturday 26 February 2011 23:25, Eric Wing wrote:

I don’t recognize that error. Some Google searches suggest you need to
be using Xcode 2.5 on 10.4 to avoid this problem.

The version of Xcode I have is whatever came on the CDs; I assume it’s the
correct one.


Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

Most people downloaded new versions of Xcode.

Umm… little problem there. When I tried to register as a developer, the site
claimed my email address was already used. Go figure.

I don’t suppose you could email it to me privately, could you?

Thanks,
JeffOn Sunday 27 February 2011 12:40, Eric Wing wrote:

Sorry, I don’t have a copy of it, and even if I did, it’s probably
over a gigabyte.
-EricOn 2/27/11, Jeff Post <j_post at pacbell.net> wrote:

On Sunday 27 February 2011 12:40, Eric Wing wrote:

Most people downloaded new versions of Xcode.

Umm… little problem there. When I tried to register as a developer, the
site
claimed my email address was already used. Go figure.

I don’t suppose you could email it to me privately, could you?


Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

Most people downloaded new versions of Xcode.

Umm… little problem there. When I tried to register as a developer, the site
claimed my email address was already used. Go figure.

I don’t suppose you could email it to me privately, could you?

If it claims your email address is already used, you should be able to use the forgot password feature to have a new one emailed to you :slight_smile:

-ShawnOn Feb 27, 2011, at 1:12 PM, Jeff Post wrote:

On Sunday 27 February 2011 12:40, Eric Wing wrote:

Except that I’ve never registered before this, so it’s not a matter of a
forgotten password. Might be interesting to try that though, just to see what
happens. I don’t recall seeing a forgot password feature; I’ll check it out
tomorrow.

Thanks for the tip,
JeffOn Sunday 27 February 2011 19:20, Shawn Walker wrote:

If it claims your email address is already used, you should be able to use
the forgot password feature to have a new one emailed to you :slight_smile:

Except that I’ve never registered before this, so it’s not a matter of a
forgotten password. Might be interesting to try that though, just to see what
happens. I don’t recall seeing a forgot password feature; I’ll check it out
tomorrow.

Might have an iTunes account, perhaps. Anyway, I second the previous
posters that you should get a recent version of XCode first, if you
can

Now, the way I handle building on OSX is the following:

Create /usr/local, put it in your PATH, download all 3rd party libs
you depend on and compile on the command line via their respective
configure scripts. So everything you’ll have to bundle with your
application binary will end up in /usr/local. When it comes to
creating the binary, I have a little script (borrowed and adjusted to
my needs) that figures out the dependencies, copies them to the app
bundle and fixes their rpath. See:

https://github.com/ksterker/adonthell/blob/master/scripts/make-bundle.sh

That gives me a native binary on whatever OSX platform I compile. I
have not yet attempted to create a universal build, as I would be
content to distribute a PPC and X64 version (The poor sods that run
OSX on a 32bit intel mac will have to use the PPC package and run it
through the emulation, but you can’t care for everyone, I gues).

Now, in theory, the way to produce universal builds is building for
the different architectures and using lipo to combine the results into
one set of binaries and libs. Not sure if you can get away with
merging the build results from a PPC and Intel Mac.

I believe that if you want to get 64bit (intel) support, you’ll need
OSX 10.5 and compile the PPC (and 32bit intel) versions against the
10.4u SDK. Latest XCode on 10.4 comes with the 10.4u SDK, but I doubt
that it contains x64 support. (The ‘u’ obviously stands for
universal). SDL 1.2 used to contain a script that would compile
against the different SDKs and merge the result into a universal
binary. That might give you an idea how that works on the command
line:

http://hg.libsdl.org/SDL/file/f14cf9d71233/build-scripts/fatbuild.sh

Sorry if all of that is a bit unspecific. Personally, I prefer to
treat OSX as a generic *nix and stay away from platform specifics such
as Frameworks and building from within XCode. But either way, expect
to invest some time before getting results.

Kai

P.S. Apologies for any oversights or grave mistakes. Even though I’m a
long-time OSX user, I wouldn’t consider myself an expert. To me It
just used to be the “better” Linux for the desktop, for a while.On Mon, Feb 28, 2011 at 5:04 AM, Jeff Post <j_post at pacbell.net> wrote:

Might have an iTunes account, perhaps.

Uh, you’re probably right. Years ago when I got an iPhone I did set up an
iTunes account just for grins. It boggles my mind though that they would mix
iTunes and Mac developer accounts.

Now, in theory, the way to produce universal builds is building for
the different architectures and using lipo to combine the results into
one set of binaries and libs. Not sure if you can get away with
merging the build results from a PPC and Intel Mac.

My understanding is that “universal binary” means it runs on either PPC or
Intel, but since I’m new to Macs I could be wrong.

http://hg.libsdl.org/SDL/file/f14cf9d71233/build-scripts/fatbuild.sh

Thanks for the link. That might be the ticket.

Personally, I prefer to
treat OSX as a generic *nix and stay away from platform specifics such
as Frameworks and building from within XCode.

So would I. It seems though that Apple likes to keep everything tightly under
their control, so I don’t yet see a way to do that. Maybe I just
misunderstand. I’m running make from the command line, the linker references
SDL in the Frameworks directory, and as far as I know Xcode just means the
compiler and linker tools. Or does it refer to GUI tools such as Visual
Studio in Windows?

Thanks for the info,
JeffOn Monday 28 February 2011 10:31, Kai Sterker wrote:

My understanding is that “universal binary” means it runs on either PPC or
Intel, but since I’m new to Macs I could be wrong.

Universal binaries can contain the object code for ppp, ppc64, i386
and x64 in parallel. I don’t have my Mac at hand right now, else I
could give you the command to list the different architectures
supported by any given library or executable. It’s probably also lipo
with some switch…

So as I understand it, you essentially compile one native version of
your application and cross compile for the other architecture, then
merge the results. Doing this for ppc and i386 will result in a binary
that should run on any Mac, but you could add in ppc64 and x64 too.
Not sure when Apple will drop 32bit intel support, but according to
Wikipedia, it’ll be with the upcoming OSX 10.7.

So would I. It seems though that Apple likes to keep everything tightly under
their control, so I don’t yet see a way to do that. Maybe I just
misunderstand. I’m running make from the command line, the linker references
SDL in the Frameworks directory, and as far as I know Xcode just means the
compiler and linker tools. Or does it refer to GUI tools such as Visual
Studio in Windows?

It’s both. XCode is what the IDE is called, but the package also
contains gcc, libraries, and SDKs for the different versions of OSX.
The IDE hides a lot of the complexities, but I think all the actual
work is done by command line tools.

As for pointing to stuff inside the framework, I’ve got mixed
feelings, but it might work. I found it cleaner to compile SDL myself
and not worrying about frameworks.

KaiOn Tue, Mar 1, 2011 at 5:30 AM, Jeff Post <j_post at pacbell.net> wrote:

My understanding is that “universal binary” means it runs on either PPC or
Intel, but since I’m new to Macs I could be wrong.

Universal binaries can contain the object code for ppp, ppc64, i386
and x64 in parallel. I don’t have my Mac at hand right now, else I
could give you the command to list the different architectures
supported by any given library or executable. It’s probably also lipo
with some switch…

lipo -info

So as I understand it, you essentially compile one native version of
your application and cross compile for the other architecture, then
merge the results. Doing this for ppc and i386 will result in a binary
that should run on any Mac, but you could add in ppc64 and x64 too.
Not sure when Apple will drop 32bit intel support, but according to
Wikipedia, it’ll be with the upcoming OSX 10.7.

If you have Leopard or Snow Leopard, you can use our most recent Xcode
project template. All this stuff is setup automatically for you. It
also embeds the SDL.framework inside the .app bundle so your
application is completely stand-alone and ready for drag-and-drop
installation.

Under Tiger, you probably could dig around for an older Xcode template
we provided way back. I think we still provide it. (It’s probably
under source control too.)

If you do it yourself, there are lots of subtle rules you have to be
aware of. Some (but not all) are mentioned here:
http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html

This is why we provide a ready-to-go template.

It’s both. XCode is what the IDE is called, but the package also
contains gcc, libraries, and SDKs for the different versions of OSX.
The IDE hides a lot of the complexities, but I think all the actual
work is done by command line tools.

Mostly, though there are some things particularly on the iOS side
where there are no command line tool equivalents. However, as I
already described in another recent thread, there are numerous
switches you need to be aware of and there were even bugs with gcc
where a simple reordering of switches would completely break things.
And Apple is moving away from gcc to llvm. Xcode insulates you from
all these issues.

As for pointing to stuff inside the framework, I’ve got mixed
feelings, but it might work. I found it cleaner to compile SDL myself
and not worrying about frameworks.

You can do this yourself, but again, there are more rules to learn.
Again, the official precompiled framework is set up so it is ready to
be embedded inside your application bundle for total self-containment.
If you make end-users “install” SDL to run your app, you screwed up.

And you can achieve all this with plain dylibs, but Frameworks have
some nice advantages on the platform. And in my opinion, they meet the
spirit of the LGPL more closely as they also contain the public header
files so anybody can rip out the framework and compile their own stuff
against it.

-EricOn 3/1/11, Kai Sterker <kai.sterker at gmail.com> wrote:

On Tue, Mar 1, 2011 at 5:30 AM, Jeff Post <j_post at pacbell.net> wrote:

Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

If you do it yourself, there are lots of subtle rules you have to be
aware of. Some (but not all) are mentioned here:
http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html

This is why we provide a ready-to-go template.

It’s both. XCode is what the IDE is called, but the package also
contains gcc, libraries, and SDKs for the different versions of OSX.
The IDE hides a lot of the complexities, but I think all the actual
work is done by command line tools.

Mostly, though there are some things particularly on the iOS side
where there are no command line tool equivalents. However, as I
already described in another recent thread, there are numerous
switches you need to be aware of and there were even bugs with gcc
where a simple reordering of switches would completely break things.
And Apple is moving away from gcc to llvm. Xcode insulates you from
all these issues.

I recently wrote an article about setting up a project with the Xcode SDL
template. It’s a complete walk-through and shows how to add
additional Frameworks and other Xcode details.

http://www.noquarterarcade.com/xcode-sdl-development-setup

Although I sometimes use a make driven build system on OS X, to
package an application into a .app bundle I’ve found it easiest to use
Xcode.–
Todd Steinackle
http://www.noquarterarcade.com/