There's a similar question about running breakout on Linux variants: Can't run Breakout outside of appliance
My question is specifically about compiling breakout (and hence SPL) on Mac OS X.
So far I have tried running make
in the source directory, but the compiler complains that the SPL (spl/lib/libcs.a) is not built for the current architecture, e.g.:
MacBook-Pro:pset4 luke$ make
clang -ggdb3 -Ispl/include -O0 -std=c99 -Wall -Werror -Wno-unused-variable -o breakout breakout.c -Lspl/lib -lcs -lm
ld: warning: ignoring file spl/lib/libcs.a, file was built for archive which is not the architecture being linked (x86_64): spl/lib/libcs.a
Undefined symbols for architecture x86_64:
"_add", referenced from:
_initScoreboard in breakout-5b09af.o
_initBricks in breakout-5b09af.o
_initBall in breakout-5b09af.o
_initPaddle in breakout-5b09af.o
_initLives in breakout-5b09af.o
Thought this might be because SPL is 32 bit, I tried compiling for 32-bit mode by adding a -m32
option for clang, but that results in similar errors:
MacBook-Pro:pset4 luke$ clang -ggdb3 -Ispl/include -O0 -std=c99 -Wall -Werror -Wno-unused-variable -o breakout -m32 breakout.c -Lspl/lib -lcs -lm
ld: warning: ignoring file spl/lib/libcs.a, file was built for archive which is not the architecture being linked (i386): spl/lib/libcs.a
Undefined symbols for architecture i386:
"_add", referenced from:
_initScoreboard in breakout-007735.o
_initBricks in breakout-007735.o
_initBall in breakout-007735.o
_initPaddle in breakout-007735.o
_initLives in breakout-007735.o
It seems that SPL is compiled with some architecture that is not compatible with OS X, although I would have thought it would be standard.
Update 25 July '14
Marty Stepp responded to my email requesting C source:
The libraries are nowadays distributed as source here:
http://stanford.edu/~stepp/cppdoc/
This site also contains the latest documentation on how to use the libraries.
This links to what appears to be C++ code only. This doesn't seem to be directly compatible with C. I'm assuming there is no official C version. I'm guessing the version provided for CS50 is from another source.