The only object of the game here is to get it compiled and running, not get a full-blown OS X app just yet... that will take a bit of work (although getting it not in X11 would be desirable). There aren't even checks in place to insure that
Now let's just say that I'm astonished at how far my compile gets with SVN R3122 (hey, nobody else has ZSNES working natively on a Mac either). In fact, it compiles with only a few glitches and hitches, some of which I can even dance around. However, a code wizard I am not, so I think I will just post what I have been able to do so far and look around desperately for help!
First, there is svn checkout:
Code: Select all
$ svn co https://svn.bountysource.com/zsnes/trunk/ zsnes
....<blah blah blah>....
$ cd zsnes/src/
Code: Select all
$ patch -p0 < ~/zsnes_osx86-0.patch
Code: Select all
$ aclocal
<bunch of warnings that don't seem to hurt anything on my Gentoo computers, and probably have nothing to do with the stop sign I get later>
$ autoconf
Code: Select all
$ ./configure
But then we hit one snag: Apple's gcc -s is a little buggy:results wrote:checking build system type... i386-apple-darwin8.6.2 I've also seen i686-apple-darwin8 in places, but this seems okay
checking host system type... i386-apple-darwin8.6.2
checking target system type... i386-apple-darwin8.6.2
checking for a BSD-compatible install... /usr/bin/install -c
checking for gcc... gcc GCC 4.0.1 Apple build 5341 to be exact. It has its own quirks, has the GCC4 propensity for flipping out when you use code that's a little off-standard, but its the only one an Intel Mac user really should have any luck using. From Xcode 2.3.
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for nasm... nasm
checking for sdl-config... /sw/bin/sdl-config It's SDL 1.2.9 installed from fink. To potential Mac power users: don't leave home without having either fink or darwinports! You'll never be able to compile very much without 'em!
checking for SDL - version >= 1.2.0... yes
checking for zlib - version >= 1.1.0... yes Comes with OS X
checking for libpng - version >= 1.2.0... no I have this from fink, but it isn't detected... but also, we can solve that problem later
rm: conf.libpngtest: No such file or directory
checking how to run the C preprocessor... gcc -E
checking for X... libraries /usr/X11R6/lib, headers /usr/X11R6/include
checking for glGetError in -lGL... yes
checking for OpenGL... yes But for some reason, it won't detect this later on during the compile... so keep reading
checking for JMA support... yes
checking for cpu info... failed uh ohs!!!
checking if you want gdb friendly executable... no
checking if you want crazy optimizations... no
checking which cpu architecture to optimize for... guessing i386
configure: WARNING: This is not what you want, use --target or force-arch Not good, but not a show-stopper either
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether sys/types.h defines makedev... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
ZSNES vpre1.43
SDL support Version 1.2.9 OK!
NASM support NASM version 0.98.40 (Apple Computer, Inc. build 9) compiled on Apr 6 2006 nasm from Xcode 2.3
zlib support Version 1.2.3 zlib that comes from OS X
PNG support Disabled, library not found Not good, but not a showstopper
OpenGL support Yes I think this will turn out to be OpenGL+X11, but I can't tell
JMA support Yes Thank goodness!
The binary will be installed in /usr/local/bin
Configure complete, now type 'make' and pray. This is the proper course of action!
Code: Select all
$ make
g++ -pipe -I. -I/usr/local/include -I/usr/include -D__UNIXSDL__ -D__MACOSX__ -arch i386 -I/sw/include/SDL -D_THREAD_SAFE -DNO_PNG -D__OPENGL__ -O3 -fomit-frame-pointer -s -march=i386 -fno-rtti -o parsegen parsegen.cpp
./parsegen -D__UNIXSDL__ -cheader psrhead/cfg.h -fname cfg t_cfg.c cfg.psr
dyld: lazy symbol binding failed: lazy pointer not found
dyld: lazy pointer not found
make: *** [cfg.o] Trace/BPT trap
Code: Select all
$ g++ -pipe -I. -I/usr/local/include -I/usr/include -D__UNIXSDL__ -D__MACOSX__ -arch i386 -I/sw/include/SDL -D_THREAD_SAFE -DNO_PNG -D__OPENGL__ -O3 -fomit-frame-pointer -march=i386 -fno-rtti -o parsegen parsegen.cpp
$ strip parsegen
Code: Select all
$ make
...<blah blah blah>...
In file included from cfgload.c:24:
gblhdr.h:83:20: error: GL/gl.h: No such file or directory
make: *** [cfgload.o] Error 1
Code: Select all
$ ./configure --with-opengl-prefix=/usr/X11R6
<blahhhhhh>
$ make
<making making making>
<more making>
<it gets to that "let's link everything together in one piece!" step>
g++ -o zsnes cfg.o cfgload.o debug.o endmem.o init.o initc.o md.o patch.o ui.o uic.o vcache.o version.o zloader.o zmovie.o zstate.o chips/sfxproc.o chips/fxemu2.o chips/dsp1proc.o chips/fxemu2b.o chips/fxemu2c.o chips/fxtable.o chips/sa1proc.o chips/sa1regs.o chips/dsp1emu.o chips/st10proc.o chips/seta10.o chips/dsp2proc.o chips/sdd1emu.o chips/c4emu.o chips/dsp4proc.o chips/dsp4emu.o chips/dsp3proc.o chips/dsp3emu.o chips/obc1emu.o chips/obc1proc.o cpu/dma.o cpu/dsp.o cpu/dspproc.o cpu/execute.o cpu/executec.o cpu/irq.o cpu/memory.o cpu/memtable.o cpu/spc700.o cpu/stable.o cpu/table.o cpu/tableb.o cpu/tablec.o gui/gui.o gui/guifuncs.o gui/menu.o effects/burn.o effects/water.o effects/smoke.o jma/7zlzma.o jma/crc32.o jma/iiostrm.o jma/inbyte.o jma/jma.o jma/lzma.o jma/lzmadec.o jma/winout.o jma/zsnesjma.o mmlib/linux.o mmlib/mm.o video/makev16b.o video/makev16t.o video/makevid.o video/mode716.o video/mode716b.o video/mode716d.o video/mode716e.o video/mode716t.o video/mode7.o video/mode7ext.o video/mv16tms.o video/m716text.o video/newg162.o video/newgfx.o video/newgfx16.o video/newgfx2.o video/procvid.o video/procvidc.o video/sw_draw.o video/2xsaiw.o video/hq2x16.o video/hq2x32.o video/hq3x16.o video/hq3x32.o video/hq4x16.o video/hq4x32.o video/ntsc.o linux/copyvwin.o linux/sdlintrf.o linux/sdllink.o linux/gl_draw.o linux/sw_draw.o linux/zfilew.o linux/safelib.o dos/debug.o dos/joy.o dos/vesa2.o zip/unzip.o zip/zpng.o -pipe -I. -I/usr/local/include -I/usr/include -D__UNIXSDL__ -D__MACOSX__ -arch i386 -I/sw/include/SDL -D_THREAD_SAFE -DNO_PNG -I/usr/X11R6/include -D__OPENGL__ -O3 -fomit-frame-pointer -s -march=i386 -fno-rtti -L/usr/local/lib -L/usr/lib -lz -L/sw/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -Wl,-framework,OpenGL -L/usr/X11R6/lib -lGL
/usr/bin/ld: Undefined symbols:
GUIDoReset
InitDSP2
InitFxTables
SPC7110Load
initregr
initregw
outofmemfix
InitSPC
MMXCheck
StartUp
SystemInit
WaitForKey
allocmem
init
outofmemory
ChangetoLOADdir
ProcessSoundBuffer
_ManyMouseDriver_hidmanager
collect2: ld returned 1 exit status
make: *** [main] Error 1
$ <hit head on keyboard and fall out of chair>
Note that I tried doing this with the 1.42 source before thinking better of it and getting it from SVN. The final link is also where that finally died (hence why a lot of this is essentially pre-packaged; I spent all day fiddling with this).
EDIT1: Okay, I've squashed all but one of these now... This is the patch that makes up all the changes I've made to the ZSNES code right (here). Now someone just needs to figure out what's going on with this one and we just might be in business!
Code: Select all
$ make
g++ -o zsnes cfg.o cfgload.o debug.o endmem.o init.o initc.o md.o patch.o ui.o uic.o vcache.o version.o zloader.o zmovie.o zstate.o chips/sfxproc.o chips/fxemu2.o chips/dsp1proc.o chips/fxemu2b.o chips/fxemu2c.o chips/fxtable.o chips/sa1proc.o chips/sa1regs.o chips/dsp1emu.o chips/st10proc.o chips/seta10.o chips/dsp2proc.o chips/sdd1emu.o chips/c4emu.o chips/dsp4proc.o chips/dsp4emu.o chips/dsp3proc.o chips/dsp3emu.o chips/obc1emu.o chips/obc1proc.o cpu/dma.o cpu/dsp.o cpu/dspproc.o cpu/execute.o cpu/executec.o cpu/irq.o cpu/memory.o cpu/memtable.o cpu/spc700.o cpu/stable.o cpu/table.o cpu/tableb.o cpu/tablec.o gui/gui.o gui/guifuncs.o gui/menu.o effects/burn.o effects/water.o effects/smoke.o jma/7zlzma.o jma/crc32.o jma/iiostrm.o jma/inbyte.o jma/jma.o jma/lzma.o jma/lzmadec.o jma/winout.o jma/zsnesjma.o mmlib/linux.o mmlib/mm.o video/makev16b.o video/makev16t.o video/makevid.o video/mode716.o video/mode716b.o video/mode716d.o video/mode716e.o video/mode716t.o video/mode7.o video/mode7ext.o video/mv16tms.o video/m716text.o video/newg162.o video/newgfx.o video/newgfx16.o video/newgfx2.o video/procvid.o video/procvidc.o video/sw_draw.o video/2xsaiw.o video/hq2x16.o video/hq2x32.o video/hq3x16.o video/hq3x32.o video/hq4x16.o video/hq4x32.o video/ntsc.o linux/copyvwin.o linux/sdlintrf.o linux/sdllink.o linux/gl_draw.o linux/sw_draw.o linux/zfilew.o linux/safelib.o dos/debug.o dos/joy.o dos/vesa2.o zip/unzip.o zip/zpng.o -pipe -I. -I/usr/local/include -I/usr/include -D__UNIXSDL__ -D__MACOSX__ -arch i386 -I/sw/include/SDL -D_THREAD_SAFE -DNO_PNG -I/usr/X11R6/include -D__OPENGL__ -O3 -fomit-frame-pointer -s -march=i386 -fno-rtti -L/usr/local/lib -L/usr/lib -lz -L/sw/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -Wl,-framework,OpenGL -L/usr/X11R6/lib -lGL
/usr/bin/ld: Undefined symbols:
_ManyMouseDriver_hidmanager
collect2: ld returned 1 exit status
make: *** [main] Error 1
Code: Select all
/usr/bin/ld: ui.o has external relocation entries in non-writable section (__TEXT,__text) for symbols:
_malloc
collect2: ld returned 1 exit status
make: *** [main] Error 1